I set myXamGrid.Theme = "Aero";
In Xaml resource files, I defined custom styles for DataRecordCellArea, etc. The styles are BasedOn IG's styles, with minor changes (few Setters).
Field labels are shown appropriately in Aero Theme. However, the custom styles are displayed as Aero only in Vista; in XP they're flat and "classic".
How to resolve?
Hello,
Can you please provide the styles that you are using so that we can look into the situation?
Thanks
The style:
<Style x:Key="MyDataRecordCellAreaStyle" TargetType="{x:Type igDP:DataRecordCellArea}"> <!--Disable highlighting active record--> <Setter Property="BackgroundActive" Value="{x:Null}" /> <Setter Property="BorderActiveBrush" Value="{x:Null}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:DataRecordCellArea}"> <ControlTemplate.Resources> <Storyboard x:Key="timelineIsSelected_off"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Selected" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="timelineHover_off"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="timelineIsActive_off"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Active" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="timelineIsActive"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Active" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="timelineIsSelected"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Selected" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="timelineHover"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <igWindows:CardPanel > <!--Indent highlight border accroding to tree level by the use of RecordToAreaMarginConverter--> <Border x:Name="Background" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{Binding Record, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RecordToAreaMarginConverter}}" /> <Border x:Name="Alternate" Opacity="1" Visibility="Collapsed" Background="{TemplateBinding BackgroundAlternate}" BorderBrush="{TemplateBinding BorderAlternateBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Margin="{Binding Record, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RecordToAreaMarginConverter}}"/> <Border x:Name="Selected" Opacity="0" Visibility="Visible" Background="{TemplateBinding BackgroundSelected}" BorderBrush="{TemplateBinding BorderSelectedBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Margin="{Binding Record, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RecordToAreaMarginConverter}}"/> <Border x:Name="Hover" Opacity="0" Visibility="Visible" Background="{TemplateBinding BackgroundHover}" BorderBrush="{TemplateBinding BorderHoverBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Margin="{Binding Record, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RecordToAreaMarginConverter}}"/> <Border x:Name="Active" Visibility="Collapsed" Background="{TemplateBinding BackgroundActive}" BorderBrush="{TemplateBinding BorderActiveBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Margin="{Binding Record, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RecordToAreaMarginConverter}}"/> <ContentPresenter x:Name="CellContent" Style="{TemplateBinding ForegroundStyle}" Content="{TemplateBinding Content}"/> </igWindows:CardPanel> <ControlTemplate.Triggers> <Trigger Property="IsActive" Value="True"> <Setter Property="Style" TargetName="CellContent" Value="{Binding Path=ForegroundActiveStyle, RelativeSource={RelativeSource TemplatedParent}}"/> <Setter Property="Visibility" TargetName="Active" Value="Visible"/> </Trigger> <Trigger Property="IsSelected" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="timelineIsSelected_BeginStoryboard"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Selected" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard x:Name="timelineIsSelected_off_BeginStoryboard"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Selected" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> <Setter Property="Style" TargetName="CellContent" Value="{Binding Path=ForegroundSelectedStyle, RelativeSource={RelativeSource TemplatedParent}}"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="timelineHover_BeginStoryboard"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard x:Name="timelineHover_off_BeginStoryboard"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> <Setter Property="Style" TargetName="CellContent" Value="{Binding Path=ForegroundHoverStyle, RelativeSource={RelativeSource TemplatedParent}}"/> </Trigger> <Trigger Property="IsAlternate" Value="True"> <Setter Property="Visibility" TargetName="Alternate" Value="Visible"/> <Setter Property="Style" TargetName="CellContent" Value="{Binding Path=ForegroundAlternateStyle, RelativeSource={RelativeSource TemplatedParent}}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
If you set the theme property of the XamDataGrid, you have to define any other styles for it in the Resources of the XamDataGrid. This is because WPF supports only one local style. Once the element finds a style by going up the element tree, it stops. This happens when using themes - the elements find their theme styles in the XamDataGrid's resouces.
You can also try to set the style based on the theme like this:
<Style TargetType="{x:Type igDP:DataRecordPresenter}" BasedOn="{x:Static Themes:DataPresenterOnyx. igDP:DataRecordPresenter}">
That solves it, thanks.
Yaakov