My company uses some global styles for xam controls. I need to override some of those styles for a specific instance of a xamcomboeditor.
In the style below I set the background to yellow and the font size to 50. The background is set correctly but the fontsize is not. Why is that? I suspect I need to create a style for a type other than xamcomboeditor. I want to hard code the fontsize at the control level so no other style overrides it. How do I do that?
<igEditors:XamComboEditor
x:Name="transferTypeCombo"
Style="{StaticResource BaseXamComboEditor}"
ValuePath="Tag"
Width="120"
Value="{Binding NATIVE_TRANSFER_TYPE}">
<igEditors:XamComboEditor.ItemsProvider>
<igEditors:ComboBoxItemsProvider>
<igEditors:ComboBoxItemsProvider.Items>
<igEditors:ComboBoxDataItem DisplayText="PM Transfer" Value="0"></igEditors:ComboBoxDataItem>
<igEditors:ComboBoxDataItem DisplayText="Auction" Value="1"></igEditors:ComboBoxDataItem>
</igEditors:ComboBoxItemsProvider.Items>
</igEditors:ComboBoxItemsProvider>
</igEditors:XamComboEditor.ItemsProvider>
</igEditors:XamComboEditor>
Hi,
You may need to use a based on reference so that you can use your company’s style but you can target the SpecializedTextBox and TextBlock in the XamComboEditor style by adding the following to the resources of your XamComboEditor. This will take care of the text area of the xamComboEditor.
<Style TargetType="igPrim:SpecializedTextBox" >
<Setter Property="FontSize" Value="20"/>
</Style>
<Style TargetType="TextBlock">
<Style TargetType="ig:XamComboEditor" >
You might want to look at these links concerning applying styles
http://ko.infragistics.com/community/blogs/andrew_smith/archive/2009/12/09/common-style-issues-when-using-the-theme-property.aspx
http://ko.infragistics.com/community/blogs/marketing/archive/2013/03/05/styles-in-wpf.aspx
Please let me know if you also need to customize the text in the dropdown.
Edit: Marianne, thank you for your reply. I was on a mad dash out of the office last night and i wanted post this before I left. Sorry for that, here is more info about the issue:
I tried the styles you suggested and they do not work so I started pulling my app apart. My company has some common styles we all use and included in those style is a global textblock style as shown below. It appears this style is preventing other more locally defined styles from being applied to the xamcomboeditor. As you can see in the xaml below, the style defined in the resources of the xamcomboeditor is not applied when the global textblock style is also used.
My new question is: If my app contains a global (unkeyed) TextBlock style, how do I style the font size for XamComboEditor?
I found the problem to be this global TextBlock style:
<Setter Property="FontFamily" Value="Calibri"/>
<Setter Property="FontSize" Value="12"/>
This was unexpected because I suspected a global textblock style was a problem early on so I implemented the suggestion found here to work around it:
http://stackoverflow.com/questions/1303634/how-to-override-a-global-style-that-doesnt-have-an-xkey-or-alternatively-ap
The solution suggestion suggested in the link above should work but for some reason it does not. The only fix I can think of at the moment is to give the TextBlock style a key. Hope this saves someone else from having to go through this.
Following does not work:
Width="120" Height="30" >
<igEditors:XamComboEditor.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="FontSize" Value="50" />
</igEditors:XamComboEditor.Resources>