Click here to Skip to main content
15,913,709 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: VisualTreeHelper.HitTest / RectangleGeometry not working... Pin
Kenneth Haugland2-May-13 7:38
mvaKenneth Haugland2-May-13 7:38 
QuestionTab Closing Problem Pin
Kevin Marois1-May-13 20:14
professionalKevin Marois1-May-13 20:14 
I posted on this a while back, and I'v tried some things but still cannot get this to work.

The Problem
When I have multiple tabs open, and I click the Close X on a NON-ACTIVE tab, the active tab is closed.

The XAML
<UserControl.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="..\Resources.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <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 RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=DataContext.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/closetab_24.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>

                            </Button>

                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
          
    </ResourceDictionary>
</UserControl.Resources>


The problem as I see it is that the view model doesn't know which tab fired the command.

Can someone help me figure this out?

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

AnswerRe: Tab Closing Problem Pin
AlphaDeltaTheta3-May-13 4:49
AlphaDeltaTheta3-May-13 4:49 
QuestionAsynchronous Call Using MVVM Pin
jonkjon29-Apr-13 10:21
jonkjon29-Apr-13 10:21 
AnswerRe: Asynchronous Call Using MVVM Pin
SledgeHammer0129-Apr-13 10:32
SledgeHammer0129-Apr-13 10:32 
GeneralRe: Asynchronous Call Using MVVM Pin
jonkjon29-Apr-13 10:48
jonkjon29-Apr-13 10:48 
Questionwin32 window as c# wpf control Pin
mkusnjer29-Apr-13 8:58
mkusnjer29-Apr-13 8:58 
AnswerRe: win32 window as c# wpf control Pin
SledgeHammer0129-Apr-13 9:28
SledgeHammer0129-Apr-13 9:28 
GeneralRe: win32 window as c# wpf control Pin
mkusnjer30-Apr-13 5:19
mkusnjer30-Apr-13 5:19 
GeneralRe: win32 window as c# wpf control Pin
SledgeHammer0130-Apr-13 10:58
SledgeHammer0130-Apr-13 10:58 
GeneralRe: win32 window as c# wpf control Pin
mkusnjer1-May-13 8:31
mkusnjer1-May-13 8:31 
GeneralRe: win32 window as c# wpf control Pin
SledgeHammer011-May-13 10:46
SledgeHammer011-May-13 10:46 
GeneralRe: win32 window as c# wpf control Pin
mkusnjer1-May-13 12:11
mkusnjer1-May-13 12:11 
GeneralRe: win32 window as c# wpf control Pin
SledgeHammer011-May-13 12:20
SledgeHammer011-May-13 12:20 
GeneralRe: win32 window as c# wpf control Pin
mkusnjer1-May-13 12:39
mkusnjer1-May-13 12:39 
GeneralRe: win32 window as c# wpf control Pin
SledgeHammer011-May-13 13:00
SledgeHammer011-May-13 13:00 
GeneralRe: win32 window as c# wpf control Pin
mkusnjer1-May-13 13:24
mkusnjer1-May-13 13:24 
AnswerRe: win32 window as c# wpf control Pin
AlphaDeltaTheta3-May-13 4:33
AlphaDeltaTheta3-May-13 4:33 
QuestionDynamically create radiobuttons under the group header that can span to N - number of groups Pin
Rajesh Sajjanar27-Apr-13 10:29
Rajesh Sajjanar27-Apr-13 10:29 
AnswerRe: Dynamically create radiobuttons under the group header that can span to N - number of groups Pin
Kenneth Haugland27-Apr-13 12:32
mvaKenneth Haugland27-Apr-13 12:32 
AnswerRe: Dynamically create radiobuttons under the group header that can span to N - number of groups Pin
Mycroft Holmes27-Apr-13 13:06
professionalMycroft Holmes27-Apr-13 13:06 
QuestionIdeaBlade vs OData Pin
Super Lloyd25-Apr-13 18:36
Super Lloyd25-Apr-13 18:36 
QuestionWPF Login in MVVM Issue Pin
KishoreUHG21-Apr-13 23:44
KishoreUHG21-Apr-13 23:44 
AnswerRe: WPF Login in MVVM Issue Pin
Mycroft Holmes21-Apr-13 23:50
professionalMycroft Holmes21-Apr-13 23:50 
GeneralRe: WPF Login in MVVM Issue Pin
KishoreUHG21-Apr-13 23:52
KishoreUHG21-Apr-13 23:52 

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.