Click here to Skip to main content
15,885,366 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Custom Window WPF con Vb.Net Pin
Pablo Roberto Cuellar Ribera21-Mar-14 10:40
Pablo Roberto Cuellar Ribera21-Mar-14 10:40 
QuestionRe: Custom Window WPF con Vb.Net Pin
Kenneth Haugland23-Mar-14 10:49
mvaKenneth Haugland23-Mar-14 10:49 
AnswerRe: Custom Window WPF con Vb.Net Pin
Meshack Musundi24-Mar-14 20:04
professionalMeshack Musundi24-Mar-14 20:04 
GeneralRe: Custom Window WPF con Vb.Net Pin
Pablo Roberto Cuellar Ribera28-Mar-14 5:58
Pablo Roberto Cuellar Ribera28-Mar-14 5:58 
QuestionWPF problem with ScrollViewer Pin
Federico Barbieri20-Mar-14 23:48
Federico Barbieri20-Mar-14 23:48 
AnswerRe: WPF problem with ScrollViewer Pin
Pete O'Hanlon21-Mar-14 0:08
mvePete O'Hanlon21-Mar-14 0:08 
QuestionMoving Items Between StackPanels With Animation Pin
Saeid Mirzaee19-Mar-14 4:01
Saeid Mirzaee19-Mar-14 4:01 
QuestionStyle In Resource Dictionary Not Found Pin
Kevin Marois17-Mar-14 16:49
professionalKevin Marois17-Mar-14 16:49 
I have a style for a tab header:

<!--Center Tab Style-->
<Style x:Key="CenterTabStyle"
       TargetType="{x:Type TabItem}">

    <Setter Property="ContextMenu">
        <Setter.Value>
            <ContextMenu>
                <MenuItem Header="Close"
                                  Command="{Binding CloseTabCommand}"
                                  CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
                <MenuItem Header="Close All But This"
                                  Command="{Binding CloseAllOtherTabsCommand}"/>
            </ContextMenu>
        </Setter.Value>
    </Setter>

    <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}"
                                    CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}">

                        <TextBlock Text="x"
                                           VerticalAlignment="Center"
                                           HorizontalAlignment="Center"
                                           Margin="0,0,0,2"/>

                        <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>

    <Setter Property="Background" Value="White"/>

</Style>


If I put this at the top of my view in the UserControl.Resources it works fine. If I move it to the resource file it doesn't work.

What am I doing wrong?
If it's not broken, fix it until it is

AnswerRe: Style In Resource Dictionary Not Found Pin
Pete O'Hanlon18-Mar-14 5:45
mvePete O'Hanlon18-Mar-14 5:45 
GeneralRe: Style In Resource Dictionary Not Found Pin
Kevin Marois18-Mar-14 5:46
professionalKevin Marois18-Mar-14 5:46 
QuestionWPF Data Grid - Bind Checkbox To Command On VM Pin
Kevin Marois17-Mar-14 8:13
professionalKevin Marois17-Mar-14 8:13 
AnswerRe: Treeview Textbox Focus Pin
Wayne Gaylard17-Mar-14 5:56
professionalWayne Gaylard17-Mar-14 5:56 
QuestionAttached behaviour for Datagrid row double click Pin
Ashfaque Hussain11-Mar-14 20:35
Ashfaque Hussain11-Mar-14 20:35 
AnswerRe: Attached behaviour for Datagrid row double click Pin
Richard MacCutchan11-Mar-14 23:02
mveRichard MacCutchan11-Mar-14 23:02 
AnswerRe: Attached behaviour for Datagrid row double click Pin
Pete O'Hanlon11-Mar-14 23:06
mvePete O'Hanlon11-Mar-14 23:06 
GeneralRe: Attached behaviour for Datagrid row double click Pin
Ashfaque Hussain11-Mar-14 23:08
Ashfaque Hussain11-Mar-14 23:08 
GeneralRe: Attached behaviour for Datagrid row double click Pin
Pete O'Hanlon11-Mar-14 23:11
mvePete O'Hanlon11-Mar-14 23:11 
QuestionWPF plotting Pin
Subin Mavunkal10-Mar-14 23:50
Subin Mavunkal10-Mar-14 23:50 
QuestionRow Double Click in MVVM Pin
Ashfaque Hussain10-Mar-14 22:24
Ashfaque Hussain10-Mar-14 22:24 
QuestionWPF User Control Question Pin
Kevin Marois10-Mar-14 17:11
professionalKevin Marois10-Mar-14 17:11 
QuestionReagrding the Persistance of an radio buttion selection. Pin
pradeep surya10-Mar-14 7:36
pradeep surya10-Mar-14 7:36 
QuestionDomainServices adn [RequiresRoles()] Pin
picasso29-Mar-14 19:14
picasso29-Mar-14 19:14 
QuestionRe: DomainServices adn [RequiresRoles()] Pin
Richard MacCutchan9-Mar-14 22:35
mveRichard MacCutchan9-Mar-14 22:35 
AnswerRe: DomainServices adn [RequiresRoles()] Pin
picasso210-Mar-14 11:55
picasso210-Mar-14 11:55 
GeneralRe: DomainServices adn [RequiresRoles()] Pin
Richard MacCutchan10-Mar-14 22:16
mveRichard MacCutchan10-Mar-14 22:16 

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.