Hi,
I have a question regarding styling of Infragistics controls. I think we can achieve styling by resource washing and also by customizing the templte from the default styles.
However i think that through resource washing we can only style the control up to some level but in case of re-templating we have full control over the look and feel and behavior of the controls.
My question is can resource washing technique is able to change the fundamental properties of the control or this only can give a new color to controls.
Also is resource washing better than customizing the controls in terms of memory usage and performance.
Can someone guide?
Thanks,
Ashish
Hi Andrew,
Thanks a lot for the quick reply.
Thank you very much for your time.
You cannot control specific areas of specific elements via resource washing itself. However our resource washing in WPF works by creating brushes whose keys match the resource keys that are referenced by our styles/templates. So you could find the template whose color you want to change and review it to see what resource keys are referenced. For example you might open the wash base light xaml you are using (e.g. LabelPresenter) from the DefaultStyles xaml (\Infragistics\NetAdvantage 2011.1\WPF\DefaultStyles\DataPresenter\DataPresenterWashBaseLight.xaml) and find the LabelPresenter template. Since it's Background is dynamically linked to the resource key {x:Static igDP:DataPresenterBrushKeys.LabelBackgroundKey}, you might just create a brush whose x:Key is that value and put that in your resources.
If you're unsure what element's template you would need to find to make the change you might use a tool like Snoop to find the element that you want to change and try changing its Background/Fill in Snoop. Once you find the element whose brush is affecting the area you want to change you would look for that element's template in the default xaml.
<ResourceDictionary> <ResourceDictionary.MergedDictionaries> <igThemes:DataPresenterWashBaseLight /> <igThemes:ResourceWasher AutoWash="True" WashColor="LightBlue" WashMode="HueSaturationReplacement"> <igThemes:ResourceWasher.SourceDictionary> <igThemes:DataPresenterWashBaseLightBrushes /> </igThemes:ResourceWasher.SourceDictionary> </igThemes:ResourceWasher> </ResourceDictionary.MergedDictionaries> <SolidColorBrush Color="Red" x:Key="{x:Static igDP:DataPresenterBrushKeys.LabelBackgroundKey}" /> </ResourceDictionary>
<igThemes:DataPresenterWashBaseLight />
<igThemes:ResourceWasher AutoWash="True" WashColor="LightBlue" WashMode="HueSaturationReplacement"> <igThemes:ResourceWasher.SourceDictionary> <igThemes:DataPresenterWashBaseLightBrushes /> </igThemes:ResourceWasher.SourceDictionary> </igThemes:ResourceWasher>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush Color="Red" x:Key="{x:Static igDP:DataPresenterBrushKeys.LabelBackgroundKey}" /> </ResourceDictionary>
If the specific area doesn't have a specific brush associated with it or you need to change it otherwise then you would use the style/template from the default styles as a starting point for your own custom template.
Thanks a lot for the help. Please see the code below:
<ResourceDictionary.MergedDictionaries>
<igThemes:DataPresenterWashBaseLight /> <igThemes:ResourceWasher AutoWash="True" WashColor="LightBlue" WashMode="HueSaturationReplacement"> <igThemes:ResourceWasher.SourceDictionary> <igThemes:DataPresenterWashBaseLightBrushes /> </igThemes:ResourceWasher.SourceDictionary> </igThemes:ResourceWasher>
The above code I am using to change the look and feel of the datapresenter. Whatever color I am passing to the WashColor, it is changing the whole look and feel based on that.
My question is if I want to have the totally different color for different parts of the datagrid like its header color should be light blue and than row color should be white. Can this kind of requirement be achieved with Resource washing or I need to go with re-templating approach.
ashishkt said: My question is can resource washing technique is able to change the fundamental properties of the control or this only can give a new color to controls.
ashishkt said:Also is resource washing better than customizing the controls in terms of memory usage and performance.