how to get TabHeader on trigger

Posted by CurlyFro on Stack Overflow See other posts from Stack Overflow or by CurlyFro
Published on 2010-12-29T17:39:55Z Indexed on 2010/12/29 17:54 UTC
Read the original article Hit count: 209

Filed under:
|
|

i have a tabcontrol. i'm trying to pass the tabcontrol as a parameter to figure out the selected tab item so i can get the tab header name. Binding this doesn't seem to work. ideas?

<TabControl Background="#FFF9F9F9" Height="650">
    <i:Interaction.Triggers>
        <i:EventTrigger  EventName="SelectionChanged">
            <n:ExecuteCommandAction Command="{Binding UpdateTabCommand}" Parameter="{Binding this}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

in my viewmodel constructor i have:

_updateTabCommand = new ActionCommand< TabControl>(UpdateTab);

private method:

 public void UpdateTab(TabControl tabControl)
    {
            var tabItem = (TabItem)tabControl.SelectedItem;

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml