In the following example SelectedValue
of TabControl
is always null
. Why?
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib">
<DockPanel>
<TextBlock Text="{Binding SelectedValue, ElementName=Tabs}" DockPanel.Dock="Bottom"/>
<TabControl x:Name="Tabs" SelectedValuePath="Content.SelectedItem">
<TabItem Header="TabOne">
<ListView>
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
<s:String>ItemOne</s:String>
<s:String>ItemTwo</s:String>
</ListView>
</TabItem>
<TabItem Header="TabTwo">
<ListView>
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
<s:String>ItemOne</s:String>
<s:String>ItemTwo</s:String>
</ListView>
</TabItem>
</TabControl>
</DockPanel>
</Window>