我是 C# 和 Windows 应用程序开发的新手,只是为了学习目的,我正在尝试构建一个 Windows 10 通用应用程序。我正在尝试使用 Hub 视图。
下面是我的文件的 Xaml 结构。
<Hub>
<HubSection1>
//SomeData here
</HubSection1>
<HubSection2>
<DataTemplate>
<Grid>
<ListView1>
<CheckBox1>
<ListView2>
//SomeData here
<CheckBox2>
<ListView3>
//SomeData here
<CheckBox3>
<ListView4>
//SomeData here
</ListView1>
</Grid>
</DataTemplate>
</HubSection2>
<HubSection3>
//SomeData here
</HubSection3>
<HubSection4>
//SomeData here
</HubSection4>
</Hub>
所以我想做的是分别使用 Checkboxes(1,2,3) 切换 ListView(2,3,4) 的可见性。但是在我的 c# 尖锐代码中,我无法访问在我的 XAML 文件中定义的变量,我在复选框侦听器方法中尝试了 FindName(),但它没有帮助。有什么方法可以获取数据或变量或绑定它们吗?