Click here to Skip to main content
15,887,886 members
Home / Discussions / WPF
   

WPF

 
QuestionRoutedEvent vs AttachedEvent Pin
devvvy29-Jan-13 22:30
devvvy29-Jan-13 22:30 
AnswerRe: RoutedEvent vs AttachedEvent Pin
Pete O'Hanlon29-Jan-13 22:51
mvePete O'Hanlon29-Jan-13 22:51 
GeneralRe: RoutedEvent vs AttachedEvent Pin
devvvy29-Jan-13 23:02
devvvy29-Jan-13 23:02 
GeneralRe: RoutedEvent vs AttachedEvent Pin
Pete O'Hanlon30-Jan-13 0:45
mvePete O'Hanlon30-Jan-13 0:45 
GeneralRe: RoutedEvent vs AttachedEvent Pin
devvvy30-Jan-13 2:40
devvvy30-Jan-13 2:40 
GeneralRe: RoutedEvent vs AttachedEvent Pin
Pete O'Hanlon30-Jan-13 2:44
mvePete O'Hanlon30-Jan-13 2:44 
GeneralRe: RoutedEvent vs AttachedEvent Pin
devvvy30-Jan-13 3:08
devvvy30-Jan-13 3:08 
QuestionWPF Tab Item Close Button Pin
Kevin Marois29-Jan-13 18:03
professionalKevin Marois29-Jan-13 18:03 
I created a tab stle so that it has a close button. The button is bound to a command:
<Style TargetType="{x:Type TabItem}">
    <Setter Property="ContextMenu">
        <Setter.Value>
            <ContextMenu>
                <MenuItem Header="Close"
                            Command="{Binding CloseTabCommand}"/>
                <MenuItem Header="Close All But This" 
                            Command="{Binding CloseAllOtherTabsCommand}"/>
                <MenuItem Header="Float"
                            Command="{Binding FloatTabCommand}"/>
            </ContextMenu>
        </Setter.Value>
    </Setter>
</Style>


I tried this:
<MenuItem Header="Close"
            Command="{Binding CloseTabCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabItem}}}"/>


but I get null passed to the command.

I need to pass along a reference to the tab. Can someone show me how to get the tab in this style and pass it as a parameter?



Thank you
If it's not broken, fix it until it is


modified 30-Jan-13 0:12am.

AnswerRe: WPF Tab Item Close Button Pin
SledgeHammer0129-Jan-13 19:02
SledgeHammer0129-Jan-13 19:02 
GeneralRe: WPF Tab Item Close Button Pin
Kevin Marois2-Feb-13 15:33
professionalKevin Marois2-Feb-13 15:33 
GeneralRe: WPF Tab Item Close Button Pin
SledgeHammer012-Feb-13 18:25
SledgeHammer012-Feb-13 18:25 
QuestionCustom Control Template for beginners Pin
jeffdavis870329-Jan-13 9:12
jeffdavis870329-Jan-13 9:12 
AnswerRe: Custom Control Template for beginners Pin
SledgeHammer0129-Jan-13 11:32
SledgeHammer0129-Jan-13 11:32 
GeneralRe: Custom Control Template for beginners Pin
jeffdavis870329-Jan-13 12:10
jeffdavis870329-Jan-13 12:10 
GeneralRe: Custom Control Template for beginners Pin
SledgeHammer0129-Jan-13 12:46
SledgeHammer0129-Jan-13 12:46 
GeneralTreeview Selection Pin
vijilvs11628-Jan-13 23:03
vijilvs11628-Jan-13 23:03 
QuestionProblem With TreeViewItem Tooltip Pin
Kevin Marois26-Jan-13 15:39
professionalKevin Marois26-Jan-13 15:39 
GeneralRe: Problem With TreeViewItem Tooltip Pin
Thomas Duwe29-Jan-13 1:46
Thomas Duwe29-Jan-13 1:46 
QuestionHow to get a value from treeview. Pin
boryborawski26-Jan-13 12:06
boryborawski26-Jan-13 12:06 
QuestionConstant header and footer Pin
columbos1492725-Jan-13 23:11
columbos1492725-Jan-13 23:11 
AnswerRe: Constant header and footer Pin
Richard MacCutchan26-Jan-13 0:05
mveRichard MacCutchan26-Jan-13 0:05 
QuestionWPF.MDI Pin
columbos1492725-Jan-13 8:37
columbos1492725-Jan-13 8:37 
AnswerRe: WPF.MDI Pin
Abhishek Pant25-Jan-13 9:29
professionalAbhishek Pant25-Jan-13 9:29 
GeneralRe: WPF.MDI Pin
columbos1492725-Jan-13 22:11
columbos1492725-Jan-13 22:11 
GeneralRe: WPF.MDI Pin
Abhishek Pant25-Jan-13 22:33
professionalAbhishek Pant25-Jan-13 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.