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

WPF

 
GeneralRe: WPF tutorial book website pdf Pin
Pete O'Hanlon2-Jan-13 5:48
mvePete O'Hanlon2-Jan-13 5:48 
GeneralRe: WPF tutorial book website pdf Pin
Richard MacCutchan2-Jan-13 6:09
mveRichard MacCutchan2-Jan-13 6:09 
GeneralRe: WPF tutorial book website pdf Pin
Pete O'Hanlon2-Jan-13 6:10
mvePete O'Hanlon2-Jan-13 6:10 
AnswerRe: WPF tutorial book website pdf Pin
Abhinav S2-Jan-13 2:21
Abhinav S2-Jan-13 2:21 
GeneralRe: WPF tutorial book website pdf Pin
David C# Hobbyist.2-Jan-13 7:08
professionalDavid C# Hobbyist.2-Jan-13 7:08 
AnswerRe: WPF tutorial book website pdf Pin
Fernando E. Braz2-Jan-13 5:15
Fernando E. Braz2-Jan-13 5:15 
GeneralRe: WPF tutorial book website pdf Pin
David C# Hobbyist.2-Jan-13 7:07
professionalDavid C# Hobbyist.2-Jan-13 7:07 
QuestionWPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 8:59
professionalKevin Marois1-Jan-13 8:59 
Ok, so I have my tab style working. The tabs now show the text and a close button. Here's my style:

<Style TargetType="{x:Type TabItem}">
    <Setter Property="HeaderTemplate">
        <Setter.Value>
            <DataTemplate >
                <Grid HorizontalAlignment="Stretch" Height="22">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="20" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2"  ></RowDefinition>
                        <RowDefinition Height="Auto" ></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="1" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem} }, Path=Header}"
                                VerticalAlignment="Bottom" Margin="4,0,8,0"/>
                                
                    <Button Grid.Row="1" 
                            Grid.Column="1"
                            Height="16"
                            Width="16"
                            BorderBrush="{x:Null}" Background="{x:Null}" 
                            Foreground="#FF224A71" 
                            VerticalAlignment="Center" 
                            Padding="3,0"
                            Command="{Binding CloseTabCommand}">
                                    
                        <TextBlock Text="x"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Center"
                                    Margin="0,0,0,2"/>

                        <Button.ToolTip>
                            <controls:ToolTipEx Style="{StaticResource TooltipStyle}"
                                                HeaderText="Close"
                                                Icon="/FMG.UI.WPF;component/Media/Images/home_16.png"
                                                ContentAreaText="Closes this tab"/>


                        </Button.ToolTip>                                    
                        <Button.OpacityMask>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="Black" Offset="0"/>
                                <GradientStop Color="#4BFFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Button.OpacityMask>
                                    
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <!--<Controls:CloseTabbedViewAction />-->
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </Grid>
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>


You can see the button is bound to a CloseTabCommand.

When I run it, the command isn't fired. Here's the command from the VM:

private ICommand _CloseTabCommand;
public ICommand CloseTabCommand
{
    get
    {
        if (_CloseTabCommand == null)
            _CloseTabCommand = new RelayCommand(p => closeTabExecuted(), p => closeTabCanExecute());

        return _CloseTabCommand;
    }
}


What am I doing wrong?

Thanks
If it's not broken, fix it until it is

AnswerRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon1-Jan-13 9:48
mvePete O'Hanlon1-Jan-13 9:48 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 9:55
professionalKevin Marois1-Jan-13 9:55 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon1-Jan-13 9:56
mvePete O'Hanlon1-Jan-13 9:56 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 10:06
professionalKevin Marois1-Jan-13 10:06 
GeneralRe: WPF Tab Styling Question #2 Pin
Wayne Gaylard1-Jan-13 23:00
professionalWayne Gaylard1-Jan-13 23:00 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon1-Jan-13 23:08
mvePete O'Hanlon1-Jan-13 23:08 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois2-Jan-13 15:41
professionalKevin Marois2-Jan-13 15:41 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon2-Jan-13 21:05
mvePete O'Hanlon2-Jan-13 21:05 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois2-Jan-13 21:40
professionalKevin Marois2-Jan-13 21:40 
QuestionWPF TabItem Styling Question Pin
Kevin Marois30-Dec-12 11:16
professionalKevin Marois30-Dec-12 11:16 
AnswerRe: WPF TabItem Styling Question Pin
Pete O'Hanlon30-Dec-12 11:40
mvePete O'Hanlon30-Dec-12 11:40 
GeneralRe: WPF TabItem Styling Question Pin
Kevin Marois30-Dec-12 15:16
professionalKevin Marois30-Dec-12 15:16 
QuestionList Item Fore & Back Colors Pin
Kevin Marois29-Dec-12 7:52
professionalKevin Marois29-Dec-12 7:52 
QuestionMVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
Member 137073829-Dec-12 1:58
Member 137073829-Dec-12 1:58 
AnswerRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
SledgeHammer0129-Dec-12 7:22
SledgeHammer0129-Dec-12 7:22 
GeneralRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
Member 137073829-Dec-12 15:44
Member 137073829-Dec-12 15:44 
GeneralRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
SledgeHammer0129-Dec-12 16:26
SledgeHammer0129-Dec-12 16:26 

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.