tags:

views:

297

answers:

1

The following sample shouldn't beep (in my opinion) but it does. Why? Does that mean the SelectedContent property is useless? Is it a bug in WPF?

<TabControl SelectionChanged="TabControl_SelectionChanged">
    <TabItem Header="Tab 1">
        <Grid/>
    </TabItem>
    <TabItem Header="Tab 2">
        <Grid/>
    </TabItem>
</TabControl>

 

void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var t = sender as TabControl;
    if (t.SelectedContent != (t.SelectedItem as TabItem).Content) Console.Beep();
}
+1  A: 
Dabblernl