我可以绑定MainPage.xaml中的数据,但我不能绑定其他页面。我在这个项目中有一个名为“文档”的模型。
示例:我在MainPage中绑定了FileName
<TextBlock x:Name="NameOfFile" Text="{Binding Document.FilePath}"/>
打开文件时文本显示FileName。
但FileName未显示在另一页上。
<TextBlock x:Name="NameOfFile1" Text="{Binding Document.FilePath}"/>
我想在另一页上显示FileName。我该怎么做?
1条答案
按热度按时间kcugc4gi1#
你可以试试两种方法。
第一个直接将值传递给新页面。
第二种方法是对Document使用singleton模型。
一个三个三个一个