xaml页面
<ListBox Name="noteListBox"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<HyperlinkButton Name="noteLocation"
HorizontalContentAlignment="Stretch"
FontSize="42"
VerticalContentAlignment="Stretch"
Content="{Binding noteLocation}"
Click="Mylik_click"
Tag="{Binding filename}"/>
<TextBlock Name="noteCreatetime"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="10"
Text="{Binding noteCreatetime}"
/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
cs页面
//点击日记进行导航
private void Mylik_click(object sender, RoutedEventArgs e)
{
HyperlinkButton likbtn = (HyperlinkButton)sender;
string filename = likbtn.Tag.ToString();
string url = String.Format("/MyNote;component/ViewEdit.xaml?id={0}", filename);
NavigationService.Navigate(new Uri(url, UriKind.Relative));
}
这里主要是想说下点击的时候区别哪个点的
本文详细介绍了如何在XAML页面中通过CS页面实现点击日记进行导航的功能,包括使用ListBox、DataTemplate和HyperlinkButton等控件,以及在点击事件中获取并解析日记信息,最终完成页面跳转。
3558

被折叠的 条评论
为什么被折叠?



