Reputation: 4895
How can i change the Tile of Star.xaml(Panorama Activity) Programmatically in WPF using c# Like
Panorama.title.text=abc.toString();
without using Data Binding I dont want to make it Complex using DataBinding ..
C# code for Second Activity Class
namespace Horoscope
{
public partial class Star : PhoneApplicationPage
{
public Star()
{
InitializeComponent();
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string msg = "";
if (NavigationContext.QueryString.TryGetValue("msg", out msg))
{
}
}
}
}
I want to Name the Title by msg from previous activity
Here is Star.xaml
<!--LayoutRoot contains the root grid where all other page content is placed-->
<Grid x:Name="LayoutRoot">
<controls:Panorama Title="my application">
<!--Panorama item one-->
<controls:PanoramaItem Header="item1">
<Grid/>
</controls:PanoramaItem>
<!--Panorama item two-->
<controls:PanoramaItem Header="item2">
<Grid/>
</controls:PanoramaItem>
</controls:Panorama>
</Grid>
<!--Panorama-based applications should not show an ApplicationBar-->
Upvotes: 0
Views: 952
Reputation: 2091
Give a Name to your panorama control:
<controls:Panorama x:Name="myPanoramaControl" Title="my application" >
and if you need, give a name to panorama items
<controls:PanoramaItem x:Name="firstPanoramaItem" Header="item1">
then in code behind set the properties you need:
myPanoramaControl.Title = "new title";
or
firstPanoramaItem.Header = "new header";
Hope thi help.
Upvotes: 1