I have applied update 10.1.20101.2018 and the Infragistic controls are now right aligned rather than picking up the global styles I have defined in Application.xaml. They used to be correctly left aligned as per my styles.
The TextBlock and Combo styles below work fine, and I have changed them to right align to make sure they are being picked up. However, the DateTimeEditor and MaskEditor and probably all Infragistic targets are not applying these styles.
Any ideas?
Bold styles not working.
<!-- ============================= Style TextBlock --> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Margin" Value="2,0,2,0" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Left" /> </Style> <!-- ============================= Style ComboBox --> <Style TargetType="{x:Type ComboBox}"> <Setter Property="Margin" Value="2,0,2,0" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="HorizontalAlignment" Value="Left" /> </Style> <!-- ============================= Style XamDateTimeEditor --> <Style TargetType="{x:Type igEditors:XamDateTimeEditor}"> <Setter Property="Margin" Value="2,0,2,0" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="HorizontalAlignment" Value="Left" /> </Style> <!-- ============================= Style XamMaskEditor --> <Style TargetType="{x:Type igEditors:XamMaskedEditor}"> <Setter Property="Margin" Value="2,0,2,0" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="HorizontalAlignment" Value="Left" /> </Style>
That's great - thanks. I see what is happening now.
Setting the Theme on the xamRibbon will also affect the Resources of the owning xamRibbonWindow if it is hosted within a RibbonWindowContentHost. This behavior hasn't changed as part of the hotfix but is how the control has always functioned since the look of the xamRibbonWindow must change to match the theme for the ribbon. When you set the Theme property of a control you are essentially putting a ResourceDictionary for that theme into that element's Resources which would end up being the default local style that WPF will use (assuming that the Style property is not set or a Style closer to the element in its ancestor tree is not provided). In the case of xamRibbon since it uses elements from the shared wpf assembly and the editors assembly that means it will include the resourcedictionary for the theme for those assemblies as well.
OK in the demo app you are correct, however my real application was not specifying a key so I still have the problem.
However, I seem to have identified the cause but not sure why this is creating the issue.
In my main page that hosts all my control, I have a Ribbon control and force the theme to Office2k7Black. If I remark this out the controls align correctly. So it seems the theme on the ribbon is affecting whether the style is being applied from Application.xaml.
myRibbon.Theme =
"Office2k7Black"
Hello,
Thank you for the sample project. The issue is that you have set the Key property of the style resource. This will prevent the style from being applied to all of the elements with that type but the ones that explicitly reference the style (Style="{StaticResource DateTimeEditorStyle}").
If you want the style to apply to all of the elements of that type, you should not set its Key. This is true for all of the WPF controls.
Here is a demo app that shows the problem.