我正在尝试检索 <NavigationView.MenuItems>
<NavigationViewItem Content="Home" Tag="home">
<NavigationViewItem.Icon>
<FontIcon Glyph=""/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItemSeparator/>
<NavigationViewItemHeader x:Name="ThemesHeading" Content="Themes"/>
<NavigationViewItem Content="Themes" Tag="themes">
<NavigationViewItem.Icon>
<FontIcon Glyph=""/>
</NavigationViewItem.Icon>
</NavigationViewItem>
的第二列值:
ListView
以上将两列作为一个字符串返回,但我只想要第二列。
这是我的XAML:
void PrintText(object sender, SelectionChangedEventArgs args)
{
object item = listBox1.SelectedItem;
if (item == null) {
txtSelectedItem.Text = "No item currently selected.";
} else {
txtSelectedItem.Text = item.ToString();
}
我的 <ListView x:Name="lvSurname" ItemsSource="{Binding User}"
SelectionChanged="lvSurname_SelectionChanged">
<ListView.View>
<GridView>
GridViewColumn Header="Surname" DisplayMemberBinding="{Binding Path=Surname}" />
GridViewColumn Header="ClientID" DisplayMemberBinding="{Binding Path=ClientID}" />
</GridView>
</ListView.View>
</ListView>
课程:
User
我该怎么做?
答案 0 :(得分:0)
这是你需要的吗?
txtSelectedItem.Text = ((User)listBox1.SelectedItem).ClientID;