I'm working on VisualBasic Windows Phone Application. I was trying to add pushpins on the bing map on my content panel but I can't seem to access the 'Pushpin' class properly. This surely will sound so noob but I just started learning last 2 days. I'm very careful to ask in here and researched it well but I cannot see what I'm doing wrong.
My xaml.vb header looks like this
Imports System
Imports System.Threading
Imports System.Windows.Controls
Imports Microsoft.Phone.Controls
Imports Microsoft.Phone.Shell
Imports System.Collections.ObjectModel
Imports System.Windows.Controls.Primitives
Imports System.Device.Location
Imports System.Threading.Tasks
Imports Windows.Devices.Geolocation
Imports System.IO.IsolatedStorage
Imports Microsoft.Phone.Maps
Imports Microsoft.Phone.Maps.Controls
Imports Microsoft.Phone.Maps.Toolkit
And the pivot item, the map tag is incorporated here
<Grid Margin="0,0,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="0*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<maps:Map x:Name="myMap" Margin="0,0,10,10" Grid.RowSpan="2"/>
<TextBlock HorizontalAlignment="Left" Margin="10,37,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Latitude:" VerticalAlignment="Top" Height="27" Width="76"/>
<TextBlock HorizontalAlignment="Left" Margin="10,59,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Longitude:" VerticalAlignment="Top" RenderTransformOrigin="0.646,1.019" Height="27" Width="94"/>
<TextBlock x:Name="lat_dbl" HorizontalAlignment="Left" Margin="124,37,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Lat_double" VerticalAlignment="Top" Height="27" Width="97"/>
<TextBlock x:Name="long_dbl" HorizontalAlignment="Left" Margin="124,59,0,0" Grid.Row="1" TextWrapping="Wrap" Text="long_double" VerticalAlignment="Top" Height="27" Width="110"/>
<TextBlock x:Name="Status" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Location Service Status" VerticalAlignment="Top" Margin="10,5,233,0" Grid.Row="1" Height="27" Width="203"/>
<Slider x:Name="pitchSlider_pitch" ValueChanged="sliderChanged_pitch" HorizontalAlignment="Left" Margin="342.844,210.275,-87.156,0" VerticalAlignment="Top" Width="190.312" Height="165.45" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Grid.Row="1">
<Slider.RenderTransform>
<CompositeTransform Rotation="-89.579"/>
</Slider.RenderTransform>
</Slider>
<Slider x:Name="pitchSlider_zoom" ValueChanged="sliderChanged_zoom" HorizontalAlignment="Left" Margin="244.844,-37.725,0,0" VerticalAlignment="Top" Width="190.312" Height="165.45" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Grid.Row="1">
<Slider.RenderTransform>
<CompositeTransform Rotation="0.598"/>
</Slider.RenderTransform>
</Slider>
</Grid>
</phone:PivotItem>
Related
Hi Everyone, I want to create an GridView like this in windows phone 8.1
1.GridView is not supporting AutoGenerateColumns
This is the outpuit i got. Here i tried to obtain the data from Sqlite and binded to the ItemsSource property of gridview in gridview load event of the cs file.
My code:
<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
<GridView x:Name="grdUser" HorizontalAlignment="Left" Height="auto" VerticalAlignment="Top" Width="auto" Loaded="grdUser_Loaded">
<GridView.HeaderTemplate><DataTemplate>
<Border Margin="5" BorderBrush="White" BorderThickness="1"><Grid ><Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock Text="UserName" />
<TextBlock Text="UserPassword" Grid.Column="1"/>
<TextBlock Text="CreatedDate" Grid.Column="2"/>
</Grid></Border> </DataTemplate></GridView.HeaderTemplate><GridView.ItemTemplate>
<DataTemplate>
<Border Margin="5" BorderBrush="White" BorderThickness="1"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock x:Name="tbUserName" Text="{Binding UserName}"/>
<TextBlock x:Name="tbUserPassword" Text="{Binding UserPassword}" Grid.Column="1"/>
<TextBlock x:Name="tbCreatedDate" Text="{Binding CreationDate}" Grid.Column="2"/>
</Grid></Border></DataTemplate></GridView.ItemTemplate></GridView> </Grid>
Is there any other controls for kind of requirements.
Take a look at the MyToolkit library, it has a datagrid control that could be ok for you.
https://github.com/MyToolkit/MyToolkit/wiki/DataGrid
I am a Beginner.
in my visual studio for express phone 2013 using c# there is in my app consider the many internal tiles. tiles showing reflected latters and also doesn't showing image.
how to navigate another page when tiles clicked. I have created tiles using the xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
my source code is
<StackPanel Orientation="Horizontal" Margin="12,0,0,0" >
<toolkit:WrapPanel x:Name="horizontalWrapPanel" Orientation="Horizontal" VerticalAlignment="Top"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<toolkit:HubTile Title="Quadratic Equation" Source="C:\SEM'S\windows dev center\samples\HubTilesPanorama\HubTilesPanorama\Images\quadratic equ.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" Background="#696969" GroupTag="StaticHubTile"/>
<toolkit:HubTile Title="Logarithm" Source="/HubTilesPanorama;component/Images/logaritham.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="12,0,0,0" Background="#696969" GroupTag="StaticHubTile"/>
<toolkit:HubTile Title="Polynomials" Source="/HubTilesPanorama;component/Images/polynomials.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="12,0,0,0" Background="#696969" GroupTag="StaticHubTile"/>
</StackPanel>
</StackPanel>
how to navigate another page through click on that tiles.
Try this:
Check if Images are Showing or not. It must Show by this Code below. Check that you are passing right path of images or not.
XAML:
<StackPanel Orientation="Horizontal" Margin="12,0,0,0" >
<toolkit:WrapPanel x:Name="horizontalWrapPanel" Orientation="Horizontal" VerticalAlignment="Top"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<toolkit:HubTile Title="Quadratic Equation" Source="/Assets/ApplicationIcon.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" Background="#696969" GroupTag="StaticHubTile" Tap="HubTile_Tap"/>
<toolkit:HubTile Title="Logarithm" Source="/Assets/ApplicationIcon.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="12,0,0,0" Background="#696969" GroupTag="StaticHubTile" Tap="HubTile_Tap"/>
<toolkit:HubTile Title="Polynomials" Source="/Assets/ApplicationIcon.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="12,0,0,0" Background="#696969" GroupTag="StaticHubTile" Tap="HubTile_Tap"/>
</StackPanel>
</StackPanel>
CS:
private void HubTile_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
}
I have just begun developing for windows phone 8. I am having trouble with the ScrollViewer controller. It was originally working, but now when I click and drag to the bottom of the panel I can see the content until i release click, then it springs back to the top of the view.
I have tried removing my animations, and tried using fixed stack panel heights. I have also tried using different grid rows. Could there be a syntax error? Here is a snippet of the xaml file, any help would be much appreciated:
<Grid x:Name="LayoutRoot"
Background="#FFDBDBDB">
<i:Interaction.Triggers>
<i:EventTrigger>
<eim:ControlStoryboardAction Storyboard="{StaticResource PageViewAnimation}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="100" />
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel"
Grid.Row="0"
Margin="12,0,0,0" Height="Auto" VerticalAlignment="Top">
<Image x:Name="image1" Height="100" Source="/Assets/Logo/Logo.png" HorizontalAlignment="Left"/>
<ScrollViewer x:Name="scrollViewer" Grid.Row="1">
<StackPanel x:Name="ContentPanel"
VerticalAlignment="Top" Margin="12,0,0,0">
<!--CurrentJob-->
<Image x:Name="image" Stretch="UniformToFill" Margin="0,0,12,0" VerticalAlignment="Top" Source="{Binding BusinessCardImage}" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<CompositeTransform/>
</Image.RenderTransform>
</Image>
<!--CurrentJob-->
<TextBlock x:Name="currentJobLbl" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Current Job" VerticalAlignment="Top" Margin="12,0,0,0"/>
<TextBox x:Name="currentJobTxt"
TextWrapping="Wrap"
Text="{Binding CurrentJob, Mode=TwoWay}"
VerticalAlignment="Top"
AcceptsReturn="True"
Visibility="{Binding IsEditMode, Converter={StaticResource TrueToVisibleConverter}}"/>
<TextBlock x:Name="currentJobTextBlock"
TextWrapping="Wrap"
Text="{Binding CurrentJob, Mode=TwoWay}"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"
Visibility="{Binding IsEditMode, Converter={StaticResource FalseToVisibleConverter}}"/>
<!--Websites-->
<TextBlock x:Name="websitesLbl" HorizontalAlignment="Left" Margin="12,0,0,0" TextWrapping="Wrap" Text="Websites" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<CompositeTransform/>
</TextBlock.RenderTransform>
</TextBlock>
<TextBox x:Name="websitesTxt"
TextWrapping="Wrap"
Text="{Binding Websites, Mode=TwoWay}"
VerticalAlignment="Top"
AcceptsReturn="True" RenderTransformOrigin="0.5,0.5"
Visibility="{Binding IsEditMode, Converter={StaticResource TrueToVisibleConverter}}">
<TextBox.RenderTransform>
<CompositeTransform/>
</TextBox.RenderTransform>
</TextBox>
<TextBlock x:Name="websitesTextBlock"
TextWrapping="Wrap"
Text="{Binding Websites, Mode=TwoWay}"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"
Visibility="{Binding IsEditMode, Converter={StaticResource FalseToVisibleConverter}}">
<TextBlock.RenderTransform>
<CompositeTransform/>
</TextBlock.RenderTransform>
</TextBlock>
<Grid>
<Button x:Name="editSaveBtn"
Content="{Binding EditSaveButtonText, Mode=TwoWay}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Width="150">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click" SourceName="editSaveBtn">
<Command:EventToCommand x:Name="InvokeEditModeCommand"
Command="{Binding InvokeEditModeCommand, Mode=OneWay}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
</StackPanel>
</ScrollViewer>
</StackPanel>
</Grid>
Try changing the grid row definitions to this:
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
I'm trying to design a windows phone 8 app where I need a listbox containing information. I'm using a data template to show my data. The datatemplate looks like this:
<DataTemplate x:Key="NewPortfolioHoldingTemplate">
<Grid Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="35*"/>
<ColumnDefinition Width="30*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<toolkit:PhoneTextBox x:Name="Ticker" Grid.Column="0" HorizontalAlignment="Left" Height="80" TextWrapping="Wrap" VerticalAlignment="Top" Width="Auto" Text="{Binding Ticker}" Hint="Ticker" FontSize="32" />
<toolkit:PhoneTextBox x:Name="Shares" Grid.Column="1" HorizontalAlignment="Left" Height="80" TextWrapping="Wrap" Text="{Binding Share}" VerticalAlignment="Top" Width="Auto" Hint="Shares" />
<toolkit:PhoneTextBox x:Name="Price" Grid.Column="2" HorizontalAlignment="Left" Height="80" TextWrapping="Wrap" VerticalAlignment="Top" Width="Auto" Hint="Price"/>
<Button x:Name="Add" Content="+" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="3" FontSize="32" />
<Button x:Name="Remove" Content="-" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="4" FontSize="32" />
</Grid>
</DataTemplate>
And I'm using this datatemplate like this:
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock x:Name="NewPortNameBlock" Grid.Row="0" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top" Margin="19,19,0,0" FontSize="24"/>
<TextBox x:Name="NewPortNameBox" Grid.Row="0" HorizontalAlignment="Left" TextWrapping="Wrap" Text="PortName" VerticalAlignment="Top" Margin="87,0,0,0" FontSize="24" Width="369"/>
<TextBlock x:Name="NewPortCashBlock" Grid.Row="1" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Cash" VerticalAlignment="Top" Margin="19,19,0,0" FontSize="24"/>
<TextBox x:Name="NewPortCashBox" Grid.Row="1" HorizontalAlignment="Left" TextWrapping="Wrap" Text="CashAmt" VerticalAlignment="Top" Margin="87,0,0,0" FontSize="24" Width="369"/>
<TextBlock x:Name="NewPortHoldingBlock" Grid.Row="2" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Holding" VerticalAlignment="Top" Margin="19,10,0,0" FontSize="24"/>
<ListBox x:Name="NewPortHoldingList" Grid.Row="2" Margin="10,47,10,10" ItemsSource="{Binding Holdings}" ItemTemplate="{StaticResource NewPortfolioHoldingTemplate}">
</ListBox>
</Grid>
Notice the template for ListBox. When I run it in the emulator(WVGA 512MB) I can't see any of the buttons for some reason. What did I do wrong? The template looks just fine when I'm editing it in Blend.
This is a side effect of the Style of the Button control. Within the ControlTemplate of the Button is a Grid with a Border control. The Border has a Margin set to the value of the "PhoneTouchTargetOverhang" resource. It does this to ensure that there is enough space to touch the button (harder to touch with a finger than it is with a mouse pointer). To remove this Margin, do the following
Right click on your ListBox (in design view) and select Edit Additional Templates -> Edit Item Template -> Edit Current. Now you will be editing your DataTemplate.
Now right click the Button, and select Edit Template -> Edit a copy... This will create a style resource for the button.
In the style, remove the Margin property (with the value noted above) from the Border control (it should be located under the VisualStateManager element).
The Border for your Button style should look like this
<Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" CornerRadius="0" >
<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
I'm going through the Windows 8 Bing Translator Walkthrough
I was able to follow everything except the XAML part. I'm very new to XAML. Below is what the walkthrough appears to recommend, however VS2012 indicated the markup is invalid, and the error displayed says "the property "content" is set more than once". Is this the only issue? Where this is set more than once?
<GridView ItemTemplate="{StaticResource TweetTemplate}" SelectionMode="None" ItemsSource="{Binding tweets}"></GridView>
<DataTemplate x:Key="TweetTemplate">
<Grid>
<Rectangle Fill="#FFDA713F" HorizontalAlignment="Left" Height="115" Margin="10,11,0,0"
VerticalAlignment="Top" Width="455" RadiusX="20" RadiusY="20"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="50"
Margin="176,12,0,0" TextWrapping="Wrap" x:Name="txtTweet"
Text="{Binding Title}" VerticalAlignment="Top" Width="277" FontSize="12"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="50"
Margin="176,72,0,0" TextWrapping="Wrap" x:Name="txtTrans"
Text="{Binding translatedText}" VerticalAlignment="Top" Width="277"
FontSize="12"/>
<Image Source="{Binding ImageUri}" HorizontalAlignment="Left" Height="89"
Margin="20,20,0,0" VerticalAlignment="Top" Width="116"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="17"
Margin="24,109,0,0" TextWrapping="Wrap" Text="{Binding Author}"
VerticalAlignment="Top" Width="150" FontSize="10"/>
</Grid>
</DataTemplate>
...and no sooner do I post the question, I find the answer. the above needs to be arranged as follows:
Note that from the example in the link provided above the author used RefreshAppBarButtonStyle. This was changed to AppBarButtonStyle. I;m not sure I fully understand the xaml page yet, but at least I have a working framework to diagnose.
<Page.Resources>
<DataTemplate x:Key="TweetTemplate">
<Grid>
<Rectangle Fill="#FFDA713F" HorizontalAlignment="Left" Height="115" Margin="10,11,0,0" VerticalAlignment="Top" Width="455" RadiusX="20" RadiusY="20"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="50" Margin="176,12,0,0" TextWrapping="Wrap" x:Name="txtTweet" Text="{Binding Title}" VerticalAlignment="Top" Width="277" FontSize="12"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="50" Margin="176,72,0,0" TextWrapping="Wrap" x:Name="txtTrans" Text="{Binding translatedText}" VerticalAlignment="Top" Width="277" FontSize="12"/>
<Image Source="{Binding ImageUri}" HorizontalAlignment="Left" Height="89" Margin="20,20,0,0" VerticalAlignment="Top" Width="116"/>
<TextBlock Foreground="White" HorizontalAlignment="Left" Height="17" Margin="24,109,0,0" TextWrapping="Wrap" Text="{Binding Author}" VerticalAlignment="Top" Width="150" FontSize="10"/>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<GridView ItemTemplate="{StaticResource TweetTemplate}" SelectionMode="None" ItemsSource="{Binding tweets}"></GridView>
</Grid>
<Page.BottomAppBar>
<AppBar x:Name="bottomAppBar" Padding="10,0,10,0">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock x:Name="txtPrompt" Text="Search Term: " Height="24" FontSize="24"></TextBlock>
<TextBox x:Name="txtSearchTerm" Width="300" Height="24"></TextBox>
<Button Style="{StaticResource AppBarButtonStyle}" Click="Button_Click_1" />
</StackPanel>
</Grid>
</AppBar>
</Page.BottomAppBar>
Hope this is also of use to someone else.
Paul