我正在制作一种清单应用程序。StackPanel 中有一系列 TextBlocks,当点击调用时:
public void TextBlock1(object sender, MouseButtonEventArgs e)
{
(App.Current as App).detailTitle = "Check 1";
(App.Current as App).detailMessage = "This is item 1";
(App.Current as App).pageReferrer = "pivot1.Check1";
Uri detailPage = new Uri("/DetailPage.xaml", UriKind.Relative);
NavigationService.Navigate(detailPage);
}
然后在 detailPage.xaml 上:
public DetailPage()
{
InitializeComponent();
DetailPageTitle.Text = (App.Current as App).detailTitle;
textBlockDetail.Text = (App.Current as App).detailMessage;
}
private void doneButton_Click(object sender, EventArgs e)
{
NavigationService.GoBack();
}
现在,当 doneButton_Click 发生时,我希望将引用的 TextBlock 样式从 PhoneTextExtraLargeStyle 更改为我创建的名为 TextBlockStyleClicked 的样式。
我怎样才能做到这一点?