Hi folks,
I've been trying to fine tune the look and feel of a XamDataGrid by applying a gradient to the background and making the default cell background white rather than transparent, but of course, the custom style is ignored if you're using the Theme property to style the XamDataGrid.
I came across this blog entry by Andrew Smith which suggests using a style BasedOn the theme's style which would work nicely.
http://blogs.infragistics.com/blogs/andrew_smith/archive/2009/12/09/common-style-issues-when-using-the-theme-property.aspx
The trick is the BasedOn attribute requires the name/key of the theme style. Where do I find these names?
For example, in the last xaml snippet in the block the style is defined as:
<Style TargetType="igWindows:TabItemEx" BasedOn="{x:Static igThemes:PrimitivesOffice2k7Black.TabItemEx}"> <Setter Property="FontWeight" Value="Bold" /></Style>
How do I know to use "igThemes:PrimitivesOffice2k7Black.TabItemEx"? Where can I get these values?
CheersDavid
Hello David,
You can find all the styles/templates/brushes/resource keys in the defaul xaml files that we ship with the product. They are located in the DefaultStyles directory in the ProgramFiles\Infragistics folder.
Thanks Alex.
I was aware of the those files and had looked through them. It's probably lack of knowledge on my part but many of them don't have x:Keys they just have a TargetType. Take the style for the XamTextEditor in EditorsOffice2k7Blue_Express.xaml for example.
<Style TargetType="{x:Type igEditors:XamTextEditor}">...</Style>
How do I create another style BasedOn this style?
e.g. If I want to put a validation error message in the tooltip I'd do this for a standard TextBox..
<igEditors:XamTextEditor Text="{Binding Contact.Name, ValidatesOnDataErrors=True}" Theme="Office2k7Blue"> <igEditors:XamTextEditor.Resources> <Style TargetType="{x:Type igEditors:XamTextEditor}" BasedOn="WHAT_DO_I_PUT_HERE?"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource self}, Path=(Validation.Errors)[0].ErrorContent}"/> <Setter Property="Background" Value="#FFFFA5A5"/> </Trigger> </Style.Triggers> </Style> </igEditors:XamTextEditor.Resources> </igEditors:XamTextEditor>What do I use as the attribute value, and how do I determine this value from the style files you provide?CheersDavid