I am wondering why my webbrowser doesn't redirect to my html page.
I have a linkbutton on my xaml page with a tap event and i'm creating my object webbrowser when i load first the page.
This is the code I am using :
private void web_Tap(object sender, GestureEventArgs e)
{
wbbrowser.Navigate(new Uri("http://mywebsite.com/index.html", UriKind.Absolute));
}
This is the Xaml i am using :
<controls:PanoramaItem Header="about me">
<!--Double line list with text wrapping-->
<StackPanel Margin="0,0,0,17" Width="432" Height="483" >
<Rectangle Height="186" Width="150" Margin="-250,0,9,10" >
<Rectangle.Fill>
<ImageBrush ImageSource="Img/id.jpg"></ImageBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text ="Name" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="age" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Text="nationality" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Text="adress" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Text="phone" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Text="email" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Text="others" TextWrapping="Wrap" Margin="12,-6,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<HyperlinkButton Name="web" Content="web version" Margin="12,-6,12,10" Tap="web_Tap"></HyperlinkButton>
</StackPanel>
</controls:PanoramaItem>
So I am actually not declaring the Phone:WebBrowser.
I just create my object at the main page loaded .
First, you are using the HyperlinkButton the wrong way. You need to add a TargetName="NAME_OF_TARGET" for it to navigate. Second, use the NavigateUri property to navigate to a page instead of handling the tap.
This has been described in the MSDN documentation article.
Related
I am working on a UWP app and I have implemented a UserControl.The user control has multiple Textboxes and the usercontrol has been implemented in a different view page. I want to make sure that whenever the View page loads, all the textboxes have Enteras the default text that goes off when the textbox is highlighted.
My UserControl has this implementation
<UserControl >
---------------------------
----------------------------
<Border Grid.Row="1" Grid.Column="2" BorderBrush="{StaticResource brush}" BorderThickness="0,3,0,0" >
<local:NumericTextBox x:Name="TaxifuelRevised" IsEnabled="{Binding FuelPlanInfo.IsTappable}" Tag="TaxiFuelActual" TextAlignment="Right" Text="{Binding FuelPlanInfo.TaxiFuelActualInPreferredUnit,ElementName=rootFuelControl,Mode=TwoWay,UpdateSourceTrigger=Explicit}"
Margin="0,0,40,0" Style="{StaticResource TransparentTextBox}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#FF0078D7"
BorderBrush="{x:Null}" Background="{x:Null}" FontSize="40" FontFamily="Helvetica" InputScope="Number"
KeyDown="TextBox_KeyDown" MaxLength="5" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" Tapped="KeyBoardInputScope_Tapped" />
</Border>
</UserControl>
The view where it has been implemented is
<Pivot x:Name="MyPivot" Grid.Row="1" ManipulationMode="None" Margin="115,10,90,20" SelectionChanged="MyPivot_SelectionChanged" HorizontalAlignment="Stretch" Width="2536" >
<PivotItem Tag="Fuel Plan" Margin="0" ManipulationMode="None">
<PivotItem.Header >
<StackPanel >
<Image Name="FuelPlanImage" Source="ms-appx:///Assets/fuel_plan_icon.png" Width="82" Height="80"></Image>
<TextBlock Margin="0,8,0,0" TextAlignment="Center" Text="Fuel Plan" FontSize="40"/>
</StackPanel>
</PivotItem.Header>
<local:FuelPlan x:Name="FuelPlanUC" HorizontalAlignment="Stretch" FuelPlanInfo="{x:Bind ViewModel.FuelPlanInfo, Mode=OneWay}"></local:FuelPlan>
</PivotItem>
Checkout the PlaceholderText property of the TextBoxControl.
I am to create a HamburgerMenu like Win10 apps. The HamburgerMenu base is the SplitView component and to distribute the children in SplitView I chose to use a RelativePanel, so I can choose which menu items will be on the top and which ones will be on the bottom, like Weather App.
However, in my app the bottom items do not have the same width as the top items.
I've tried several things, HorizontalAlignment="Stretch", binding between the top LitView and bottom ListView, but nothing changes.
The bottom ListView ignores any non-manual (non-fixed) width setting.
Below is my XAML code.
<Grid x:Name="GridToMainPage">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<RelativePanel x:Name="RelatMainPanelTop" Background="#FFFF6800">
<Button x:Name="HamburgerMenuButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="22" VerticalAlignment="Stretch" Background="#FFFF6800" Height="39.5" Width="{Binding CompactPaneLength, ElementName=MainSplitView}" Click="OnHaburgerButtonClick"/>
<TextBlock x:Name="NavigationTitle" Text="Início" RelativePanel.RightOf="HamburgerMenuButton" Margin="10,0,0,0" FontSize="30" FontWeight="Bold"/>
<TextBox x:Name="MainSearchTextBox" Width="200" PlaceholderText="Buscar" RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.LeftOf="MainSearchButtom"/>
<Button x:Name="MainSearchButtom" Content="" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True" FontFamily="Segoe MDL2 Assets" FontSize="20" Margin="0,0,10,0"/>
</RelativePanel>
<SplitView x:Name="MainSplitView" Grid.Row="1" DisplayMode="CompactOverlay" CompactPaneLength="43" OpenPaneLength="{Binding Width, ElementName=HamburgerMenuListView1}">
<SplitView.Pane>
<RelativePanel x:Name="MainSplitRelativPanel">
<ListView x:Name="HamburgerMenuListView1">
<ListViewItem x:Name="HomeSplittem">
<StackPanel x:Name="HomeStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="HomeIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="HomeTextSplitItem" FontSize="18" Text="Início" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="PersonsSplitItem">
<StackPanel x:Name="PersonsStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="PersonsIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="PersonsTextSplitItem" FontSize="18" Text="Pessoas" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="MediaSplitItem">
<StackPanel x:Name="MediaStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="MediaIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="MediaTextSplitItem" FontSize="18" Text="Mídias" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="MovementsSplitItem">
<StackPanel x:Name="MovementsStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="MovementsIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="MovementsTextSplitItem" FontSize="18" Text="Movimentações" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="CashDeskSplitItem">
<StackPanel x:Name="CashDeskStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="CashDeskIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="CashDeskTextSplitItem" FontSize="18" Text="Caixa" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="ReportsSplitItem">
<StackPanel x:Name="ReportsStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="ReportsIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="18" Text="" VerticalAlignment="Center" SelectionHighlightColor="#FFFF6800"/>
<TextBlock x:Name="ReportsTextSplitItem" FontSize="18" Text="Relatórios" Margin="12.5,0,0,0" SelectionHighlightColor="#FFFF6800"/>
</StackPanel>
</ListViewItem>
<ListViewItem x:Name="ConfigSplitItem">
<StackPanel x:Name="ConfigStackPanelViewItem" Orientation="Horizontal">
<TextBlock x:Name="ConfigIconSplitItem" FontSize="18" Text="" FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center"/>
<TextBlock x:Name="ConfiTextSplitItem" FontSize="18" Text="Configurações" Margin="12.5,0,0,0"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView x:Name="HambugerMenuListView2" RelativePanel.AlignBottomWithPanel="True" HorizontalAlignment="Stretch" Margin="0,0,0,20" Width="181">
<ListViewItem x:Name="LoginSplitItem" HorizontalAlignment="Stretch">
<StackPanel x:Name="LoginStackPanelViewItem" Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBlock x:Name="LoginIconSplitItem" FontSize="18" Text="" FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center"/>
<TextBlock x:Name="LoginTextSplitItem" FontSize="18" Text="User Name" Margin="12.5,0,0,0"/>
</StackPanel>
</ListViewItem>
</ListView>
</RelativePanel>
</SplitView.Pane>
</SplitView>
</Grid>
Actually there's a much simpler way to achieve what you want.
You kinda did it with this line of code -
OpenPaneLength="{Binding Width, ElementName=HamburgerMenuListView1}"
Since you haven't actually specified the Wdith of HamburgerMenuListView1, the Width will always be double.NaN. This is basically equivalent to this -
OpenPaneLength="Auto"
The default value of OpenPaneLength is 320, since you have set it to Auto, the width of the side panel will basically be stretched based on the max width of its children.
Your first ListView is clearly wider so the parent side panel will stretch to its width; your second ListView is shorter, and since its default horizontal alignment (inside a RelativePanel) is Left, you will see it's left-aligned as shown on your screenshot.
So, the real question is, how to stretch the second ListView to fit the whole side panel?
All you need is to add these two lines to the second ListView -
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
Personally, I would prefer to leave the OpenPaneLength unchanged 'cause by doing this, to me it looks a bit weird as there's not enough gap between the items and the edges of the side panel. Or maybe simply reduce it a little bit to achieve the best visual result.
I got the answer on MSDN.
In practice it implements in code-behind something that should work through XAML Bindings.
The reason for not working is unknown to me.
The reason for not working is unknown to me.
It is because the ActualWidth does not raise property change notifications and should be thought of as a regular CLR property and not a dependency property as stated in the documentation on MSDN here: https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.frameworkelement.actualwidth.aspx
Since the ActualWidth of the ListView in the Pane doesn't get updated you could set the Width programmatically instead of using a binding:
<RelativePanel x:Name="MainSplitRelativPanel" SizeChanged="MainSplitRelativPanel_SizeChanged">
...
</RelativePanel>
private void MainSplitRelativPanel_SizeChanged(object sender, SizeChangedEventArgs e)
{
HambugerMenuListView2.Width = HamburgerMenuListView1.ActualWidth;
}
I've got a custom set of controls:
<Border Height="55" Margin="5,14,5,0" VerticalAlignment="Top" BorderThickness="1" BorderBrush="Black">
<Grid>
<TextBlock x:Name="SubjectNo" Text="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="36" Margin="0,1,36,0" d:LayoutOverrides="HorizontalAlignment" />
<TextBlock x:Name="Subject" Text="Subject NAME more " TextWrapping="Wrap" FontSize="24" FontWeight="Bold" Margin="26,0,90,19" d:LayoutOverrides="Height, TopPosition, BottomPosition" />
<TextBlock x:Name="Teacher" Text="BIG NAME HERE" TextWrapping="Wrap" FontSize="14.667" VerticalAlignment="Bottom" Margin="26,0,0,9" HorizontalAlignment="Left" Width="106" Height="17" d:LayoutOverrides="VerticalAlignment" />
<Grid Height="15" VerticalAlignment="Bottom" Margin="133,0,0,10" d:LayoutOverrides="VerticalAlignment">
<TextBlock x:Name="BegTime" Text="12:55 AM" TextWrapping="Wrap" FontSize="13.333" d:LayoutOverrides="Height, TopPosition, BottomPosition" SelectionHighlightColor="White" Margin="8,0,-8,0" />
<TextBlock x:Name="EndTime" Text="12:55 PM" TextWrapping="Wrap" FontSize="13.333" Margin="68,0,-12,0" d:LayoutOverrides="HorizontalAlignment, Height, TopPosition, BottomPosition" />
<TextBlock x:Name="Line" Text="-" TextWrapping="Wrap" FontSize="13.333" Margin="64,0,0,0" d:LayoutOverrides="Height, TopPosition, BottomPosition" />
</Grid>
<Border Margin="281,4,10,6" BorderBrush="Black" BorderThickness="1" d:LayoutOverrides="TopPosition, BottomPosition" HorizontalAlignment="Center" Width="57">
<Grid>
<TextBlock x:Name="RoomNo" Text="1255" TextWrapping="Wrap" FontSize="24" d:LayoutOverrides="HorizontalAlignment, Width, TopPosition, BottomPosition" Margin="2,10,-2,0" />
<TextBlock x:Name="RoomWritten" Text="Room" TextWrapping="Wrap" FontSize="14.667" VerticalAlignment="Top" HorizontalAlignment="Stretch" d:LayoutOverrides="HorizontalAlignment, Width" Margin="9,0,4,0"/>
</Grid>
</Border>
<AppBarButton x:Name="appBarButton" Label="" Margin="158,0" VerticalAlignment="Bottom" Width="32" HorizontalAlignment="Stretch" Icon="Remote" Height="13" d:LayoutOverrides="VerticalAlignment"/>
</Grid>
</Border>
It looks like this
Now I want to add a button like this to make my control show additional info in the bottom, so I want it to expand from the bottom and show additional textblock, like windows 10 notification center does. Than the icon changes and when I press the button again, additional info hides. Can anybody help me?
The type of control you are looking for is called a ToggleButton. It has an IsChecked state property to facilitate the two states for your "open" and "closed". The logic and styling for what is displayed by you when IsChecked is true or false can be controlled via styles.
More information on MSDN: ToggleButton class
Ok I have been working on an app for awhile now this is my first windows phone app I have made and I have been running into a problem. The way I designed my app is my start page is a hub control and I have two textboxs and a date picker on each page and some other controls. Now what I want to do is when I press the add button on a given section then I want to take all the strings from my various controls and add it to a textfile that I will later use. My problem is when I make the event for the button I cannot access the controls because they are inside the hubs data template. I have looked a many other examples on how to get around this they just dont seem to work and I cant make sense of them. So if anyone on here has the patience to kinda step me through the process that would be wonderful. Thank you for any help.
<Page.Resources>
<DataTemplate x:Key="DataTemplate1">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="85,7,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" FontSize="21.333"/>
<TextBox x:Name="tbHours" LostFocus="tbHours_LostFocus" HorizontalAlignment="Left" Margin="0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" hrs" Width="80"/>
<TextBox x:Name="tbMinutes" LostFocus="tbMinutes_LostFocus" HorizontalAlignment="Left" Margin="95,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" min" Width="80"/>
<TextBlock HorizontalAlignment="Left" Margin="0,50,0,0" TextWrapping="Wrap" Text="Work date" VerticalAlignment="Top" FontSize="14.667"/>
<DatePicker LostFocus="DatePicker_LostFocus" HorizontalAlignment="Left" Margin="0,65,0,0" VerticalAlignment="Top" Width="127"/>
<AppBarButton x:Name="abtnAddHours" HorizontalAlignment="Left" Icon="Add" Label="" Margin="118,65,0,0" VerticalAlignment="Top" Click="abtnAddHours_Click"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="DataTemplate2">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="0,7,0,0" TextWrapping="Wrap" Text="$" VerticalAlignment="Top" FontSize="21.333"/>
<TextBox x:Name="tbExpenses" LostFocus="tbExpenses_LostFocus" HorizontalAlignment="Left" Margin="15,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" 0.00" Width="100"/>
<TextBlock HorizontalAlignment="Left" Margin="0,45,0,0" TextWrapping="Wrap" Text="Expense date" VerticalAlignment="Top" FontSize="14.667"/>
<DatePicker x:Name="dtpkrExpenses" LostFocus="dtpkrExpenses_LostFocus" HorizontalAlignment="Left" Margin="0,60,0,0" VerticalAlignment="Top" Width="115"/>
<TextBlock HorizontalAlignment="Left" Margin="0,115,0,0" TextWrapping="Wrap" Text="Expense notes" VerticalAlignment="Top" FontSize="14.667"/>
<TextBox x:Name="tbNotes" LostFocus="tbNotes_LostFocus" HorizontalAlignment="Left" Margin="0,140,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200"/>
<AppBarButton x:Name="abtnAddExpense" HorizontalAlignment="Left" Icon="Add" Label="" Margin="193,128,0,0" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="DataTemplate3">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="14.667" Text="Working hour rate" Height="20"/>
<TextBlock HorizontalAlignment="Left" Margin="0,32,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="21.333" Text="$"/>
<TextBox x:Name="tbWage" LostFocus="tbWage_LostFocus" HorizontalAlignment="Right" Margin="0,25,237,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" 0.00" Width="89"/>
<AppBarButton x:Name="abtnAddWage" HorizontalAlignment="Left" Icon="Add" Label="" Margin="92,14,0,0" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar ClosedDisplayMode="Compact">
<CommandBar.SecondaryCommands>
<AppBarButton Label="Reset"/>
</CommandBar.SecondaryCommands>
<AppBarButton x:Name="abtnSummary" Icon="List" Label="Summary" Click="abtnSummary_Click"/>
</CommandBar>
</Page.BottomAppBar>
<Grid>
<Hub x:Name="Hub" Header="Hours+" Background="{ThemeResource PhoneAccentBrush}">
<HubSection x:Name="sctnAddHours" Header="Add hours" ContentTemplate="{StaticResource DataTemplate1}"/>
<HubSection x:Name="sctnAddExpenses" Header="Add expenses" ContentTemplate="{StaticResource DataTemplate2}"/>
<HubSection x:Name="sctnWage" Header="Wage" Height="580" ContentTemplate="{StaticResource DataTemplate3}"/>
</Hub>
</Grid>
Use the Loaded event of the control you want to access and assign it to a local variable like this.
XAML
<AppBarButton x:Name="abtnAddHours" Loaded="abtnAddHours_Loaded" HorizontalAlignment="Left" Icon="Add" Label="" Margin="118,65,0,0" VerticalAlignment="Top" />
Code Behind
//local variable
private TextBlock _abtnAddHours;
//Loaded event of the TextBlock from the template
private void abtnAddHours_Loaded(object sender, RoutedEventArgs e)
{
_abtnAddHours = (TextBlock)sender;
//Add the event handler for the Click event
_abtnAddHours.Click += _abtnAddHours_Click;
}
private void _abtnAddHours_Click(object sender, RoutedEventArgs e)
{
//Put your logic here
}
I must be missing something simple here...I am writing a Windows Phone 7 app and I have customized my pivot header to be the following:
<controls:Pivot Name="InfoPivot">
<controls:Pivot.TitleTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0" VerticalAlignment="Top">
<Rectangle Fill="{Binding CategoryFill}" Height="50" Width="50" Margin="355,25,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Name="CategoryRect" />
<StackPanel Margin="-425,-14,0,0" Width="432">
<TextBlock x:Name="StationTitle" Text="{Binding StationTitle}" Margin="10,0,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<TextBlock Name="LocationTitle" Text="{Binding LocationTitle}" TextWrapping="Wrap" Margin="12,0,0,20" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</controls:Pivot.TitleTemplate>
When I navigate to this page, I pass Station and Location as parameters, and in the OnNavigatedTo() for this page I try to set the StationTitle and LocationTitle. Unfortunately, I end up getting:
Error 2 The name 'StationTitle' does not exist in the current context
How should/do we go about accessing members in the Pivot TitleTemplate? Any help will be appreciated! Thanks.
Stop using the title template and binding to acheive this. Try this instead:-
<controls:Pivot Name="InfoPivot">
<controls:Pivot.Title>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0" VerticalAlignment="Top">
<Rectangle Fill="{Binding CategoryFill}" Height="50" Width="50" Margin="355,25,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Name="CategoryRect" />
<StackPanel Margin="-425,-14,0,0" Width="432">
<TextBlock x:Name="StationTitle" Margin="10,0,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<TextBlock x:Name="LocationTitle" TextWrapping="Wrap" Margin="12,0,0,20" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
</StackPanel>
</controls:Pivot.Title>
Then in code-behind:-
if (NavigationContext.QueryString.TryGetValue("Station", out station))
{
StationTitle.Text = station;
}
if (NavigationContext.QueryString.TryGetValue("LocationTitle", out locationTitle))
{
LocationTitle.Text = locationTitle;
}
Without seeing all of your code, this may be as simple as making the Name declaration consistent on your two TextBlocks.
Note, one is Name="", the other is x:Name="".
Defining the template inline worked for me, The TitleTemplate just wouldn't work.
<phone:Pivot>
<phone:Pivot.Title>
<TextBlock Margin="0"
Text="{Binding Exercise.Name}"
Style="{StaticResource MainTitleStyle}"/>
</phone:Pivot.Title>
</phone:Pivot>