Click here to Skip to main content
13,796,787 members

Silverlight / WPF

 
GeneralRe: WPF tutorial book website pdf Pin
Pete O'Hanlon2-Jan-13 6:48
protectorPete O'Hanlon2-Jan-13 6:48 
GeneralRe: WPF tutorial book website pdf Pin
Richard MacCutchan2-Jan-13 7:09
protectorRichard MacCutchan2-Jan-13 7:09 
GeneralRe: WPF tutorial book website pdf Pin
Pete O'Hanlon2-Jan-13 7:10
protectorPete O'Hanlon2-Jan-13 7:10 
AnswerRe: WPF tutorial book website pdf Pin
Abhinav S2-Jan-13 3:21
memberAbhinav S2-Jan-13 3:21 
GeneralRe: WPF tutorial book website pdf Pin
David C# Hobbyist.2-Jan-13 8:08
professionalDavid C# Hobbyist.2-Jan-13 8:08 
AnswerRe: WPF tutorial book website pdf Pin
Fernando E. Braz2-Jan-13 6:15
memberFernando E. Braz2-Jan-13 6:15 
GeneralRe: WPF tutorial book website pdf Pin
David C# Hobbyist.2-Jan-13 8:07
professionalDavid C# Hobbyist.2-Jan-13 8:07 
QuestionWPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 9:59
professionalKevin Marois1-Jan-13 9: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 10:48
protectorPete O'Hanlon1-Jan-13 10:48 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 10:55
professionalKevin Marois1-Jan-13 10:55 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon1-Jan-13 10:56
protectorPete O'Hanlon1-Jan-13 10:56 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois1-Jan-13 11:06
professionalKevin Marois1-Jan-13 11:06 
GeneralRe: WPF Tab Styling Question #2 Pin
Wayne Gaylard2-Jan-13 0:00
mentorWayne Gaylard2-Jan-13 0:00 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon2-Jan-13 0:08
protectorPete O'Hanlon2-Jan-13 0:08 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois2-Jan-13 16:41
professionalKevin Marois2-Jan-13 16:41 
GeneralRe: WPF Tab Styling Question #2 Pin
Pete O'Hanlon2-Jan-13 22:05
protectorPete O'Hanlon2-Jan-13 22:05 
GeneralRe: WPF Tab Styling Question #2 Pin
Kevin Marois2-Jan-13 22:40
professionalKevin Marois2-Jan-13 22:40 
QuestionWPF TabItem Styling Question Pin
Kevin Marois30-Dec-12 12:16
professionalKevin Marois30-Dec-12 12:16 
AnswerRe: WPF TabItem Styling Question Pin
Pete O'Hanlon30-Dec-12 12:40
protectorPete O'Hanlon30-Dec-12 12:40 
GeneralRe: WPF TabItem Styling Question Pin
Kevin Marois30-Dec-12 16:16
professionalKevin Marois30-Dec-12 16:16 
QuestionList Item Fore & Back Colors Pin
Kevin Marois29-Dec-12 8:52
professionalKevin Marois29-Dec-12 8:52 
QuestionMVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
Member 137073829-Dec-12 2:58
memberMember 137073829-Dec-12 2:58 
AnswerRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
SledgeHammer0129-Dec-12 8:22
memberSledgeHammer0129-Dec-12 8:22 
GeneralRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
Member 137073829-Dec-12 16:44
memberMember 137073829-Dec-12 16:44 
GeneralRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? Pin
SledgeHammer0129-Dec-12 17:26
memberSledgeHammer0129-Dec-12 17: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.


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.181207.3 | Last Updated 10 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid