device is not connected - windows

i am very new to window phone application development. i have just write a simple code of button click.but when i try to run it, it shows error like "Device is not connected" but when i connected to internet my application run. is it essential to connected to the internet to run my application.
i don't have window phone.
i have just downloaded the window sdk 7.0 which automatically installed window phone emulator.
i don't have window phone . what should i do ?
this is my code
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Name="_playaudio" Height="80" Width="150"
HorizontalAlignment="Left" VerticalAlignment="Top" Click="_playaudio_Click">
<Button.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#FFDB2422" Offset="0.36" />
<GradientStop Color="#FFAD3A3A" Offset="1" />
</LinearGradientBrush>
</Button.Background> Click Me
</Button>
<MediaElement x:Name="mymedia" VerticalAlignment="Bottom" Source="/assest/Audio/Animals/Lion.wav" Volume="100" AutoPlay="False" >
</MediaElement>

No, you don't have to be connected to any network in order to make it run.
The error you get is due to the debug device you selected.
On the top bar of Visual Studio there is a button with a green triangle on it, on the right you probably see the caption "Device". Use the dropdown menu to select an emulator instead of the phisical device. When you hit on the button, the emulator will open, the app will be installed and then will be launched.

You dont require internet or physical device to build or debug application. Make sure the targetted debug platform is emulator and not the device. That should solve the issue.

Related

syncfusion xamarin form button control, click event not fired on IOS simulator but fired on my IPHONE

I am using syncfusion xamarin form button control on my project, the click event didn't fire on the IOS simulator but fired on both my IPHONE and IPAD. anyone experienced this issue?
the XMAL is attached below,
<buttons:SfButton Padding="10"
x:Name="btnCamera"
Grid.Column="1"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnCamera_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="Camera.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
<buttons:SfButton Padding="10"
x:Name="btnImageFolder"
Grid.Column="3"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnImageFolder_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="ImageFolder.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
Query: StackOverflow : syncfusion xamarin form button control, click event not fired on IOS simulator but fired on my IPHONE
We are unable to replicate the reported issue on our side. We are prepared a sample based on the provided code snippet since the ButtonClick event is properly called on our side. We have prepared a sample and video for your reference. Sample
Please make sure you have added SfButtonRenderer for iOS in the AppDelagates.cs file. Refer to the below link,
Link: https://help.syncfusion.com/xamarin/button/gettingstarted#additional-step-for-ios
Please check and let us know once the problem was resolved on your side.
Regards,
Ruba Shanmugam

VisualStudio XAML designer preview differs from actual Windows Phone app view

Take a look at the photo, Visual Studio 2013 (as well as Blend) designer shows different rendering than on actual Windows Phone 8.1 device (Lumia 930):
Look at the red backgrounds widths: designer shows it like left aligned, but device renders as stretch.
The questions are: why and what causes this problem and how to fix it or workaround?
Sample project.
Gist:
<Page.Resources>
<SampleData:SampleDataSource x:Key="SampleDataSource" d:IsDataSource="True"/>
<DataTemplate x:Key="TestItemTemplate">
<Border Background="#FFA20F00">
<TextBlock Text="{Binding Property1}" Style="{ThemeResource ListViewItemTextBlockStyle}" />
</Border>
</DataTemplate>
</Page.Resources>
<Grid DataContext="{Binding Source={StaticResource SampleDataSource}}">
<ItemsControl ItemTemplate="{StaticResource TestItemTemplate}" ItemsSource="{Binding TestCollection}"/>
</Grid>
Found workaround:
<ItemsControl ItemTemplate="{StaticResource TestItemTemplate}" ItemsSource="{Binding TestCollection}">
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter"/>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
It seems to be a bug in the VisualStudio. Here's the MS Connect bug report.
It might be that Visual Studio just has a different template than what is actually on the device for some reason. Try setting the alignment of the itemcontainer manually by adding an ItemContainerStyle to your ItemsControl.
Depending on what you want to do, change the value of the setter. Set it to left to mimic the behavior in Visual Studio, or Stretch to make it look like it is on the device.
<ItemsControl ItemTemplate="{StaticResource TestItemTemplate}"
ItemsSource="{Binding TestCollection}">
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>

Designer showing image but emulator doesn't windows phone 7.1

I have created code to show image in panorama page. There is designer of that page showing but when i execute the program with my emulator or on my windows phone 8 they both are doesn't showing that images. Images are edited in paint. what is the resolution to show image perfectly in grid ??
my code is:
<controls:PanoramaItem >
<Grid Margin="0,-120,0,0">
<Image HorizontalAlignment="Left" Height="612" VerticalAlignment="Top" Width="420" Source="/HubTilesPanorama;component/powers.jpg" Margin="0,102,0,0" />
</Grid >
</controls:PanoramaItem>

Windows phone ads don't show up

I put my adcontrol control to my page. While using test unitid and test appid the ads show up. When I type my app ID and normal adunitid anything shows up in emulator. Place where ad should be visible is transparent.
one more q; how can I "pin" my ad to scroll at the bottom of the screen with scrollviewer?
When I type my app ID and normal adunitid anything shows up in emulator
Many ad-providers are able to detect the emulator and turn off the ads. Deploy to a real device to test them.
how can I "pin" my ad to scroll at the bottom of the screen with scrollviewer?
Just change the layout of your page and put the adcontrol outside of the scrollviewer. For instance:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0">
<!-- Whatever -->
</ScrollViewer>
<AdControl Grid.Row="1" AdUnit="..." />
</Grid>
To find out what is the problem with the Ad control, register to the AdControlError event and look at the e.ErrorCode and e.ErrorDescription.
I don't think that "pinning" the ad control at the bottom of a ScrollViewer is a good idea. You'd better place both the ScrollViewer and the AdControl inside a Grid with two rows.

WP7 - How can I display a menu when holding down my finger on a ListBoxItem

Almost everywhere in Windows Phone (for instance in the People hub), when you hold down your finger anywhere, a context-menu-ish menu pops up that says "Refresh".
How can I recreate this menu in my own application? I don't even know what to call it.
You can achieve this by using the toolkit's (August 2011) ContextMenu.
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
<ListBoxItem>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="something" Command="{Binding SomeCommand}" />
<toolkit:MenuItem Header="something else" Command="{Binding SomeOtherCommand}" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>

Resources