Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Override theme styles?

Sort Posts: Previous Next
  •  07-17-2008, 3:54 AM Post no. 13587

    Override theme styles?

    Hello,

    I've applied the WMP11 style to my grid and have added a number of styles. For example, a different mouse over brush and alternating row brushes

     <Style TargetType="{x:Type DataGrid:DataRow}">
       
        <Setter Property="Background" Value="{DynamicResource DefaultRowBackgroundBrush}" />
        <Setter Property="Foreground" Value="White"/>
        <Style.Triggers>
          <DataTrigger Binding="{Binding Path=(DataGrid:DataGridVirtualizingPanel.ItemIndex), Converter={StaticResource rowIndexConverter}, RelativeSource={RelativeSource Self}}"
            Value="True">
            <Setter Property="Background" Value="{DynamicResource AlternateRowBackgroundBrush}" />
          </DataTrigger>
          <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="{DynamicResource MouseOverRowBackgroundBrush}" />
          </Trigger>
        </Style.Triggers>
      </Style>

     What I'd like to do now is customise the way the ColumnHeaders are rendered by taking away the curved rectangle when it is moused over. I have found the parts of the theme where this effect is created:

     

    <ControlTemplate x:Key="tableViewColumnManagerCellTemplate" TargetType="{x:Type ColumnManagerCell}">

    ...

    <Grid Name="mgrCellmainGrid" Height="33" Margin="0,4,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="4*" />
                </Grid.RowDefinitions>
                <Border Name="mgrCellborderBack" BorderThickness="1" CornerRadius="5,5,0,0" RowSpan="2" />
                <Border Name="mgrCellborderBackHotBlue" BorderThickness="1" CornerRadius="5,5,0,0" Opacity="0" RowSpan="2" Background="{StaticResource rowSelectorBackgroundBrush}" />
                <Border Name="mgrCellborderTopGradient" CornerRadius="5,5,0,0" Margin="1" Row="0" />
                <Border Name="mgrCellborder3" BorderBrush="#FFFFFF" BorderThickness="1" CornerRadius="5,5,0,0" Opacity="0" Margin="3,3,3,1" RowSpan="2" />
                <Border Name="mgrCellborder2" BorderBrush="#000000" BorderThickness="1" CornerRadius="5,5,0,0" Opacity="0" Margin="2,2,2,0" RowSpan="2" />
                <Border Name="mgrCellborder1" BorderBrush="#FFFFFF" BorderThickness="1" CornerRadius="5,5,0,0" Opacity="0" Margin="1,1,1,0" RowSpan="2" />

    ...

    What I can't figure out is how to target the elements in there, say, to make them invisible or to recreate my own. Is it possible to target named controls rather than just a type?

    e.g.

    <Style TargetType="{x:Type Grid x:Name mgrCellBorder1}" >

      <Setter Property="Visibility" Value="Collapsed />

    </Style>

     

    How do you "get inside" a ControlTemplate definition like that for ColumnManagerCell to change its appearance?

    Filed under: ,
  •  07-22-2008, 12:19 AM Post no. 13662 in reply to 13587

    Re: Override theme styles?

    Following on from this post, and also using the WMP11 Theme, I'm looking to disable the highlight effect on mouseover.

    I thought that overriding it in this way might do the trick but it doesnt seem to have any effect. Any suggestions on hos that can be disabled?

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.