Click here to Skip to main content
13,595,619 members

Silverlight / WPF

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


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180621.3 | Last Updated 22 Jun 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid