Hi,
I';m not new to WPF but I'm finding getting the theming working on your controls like wading through thick mud.
Is there a simple guide to get people started?I have the Ultimate edition for a project I'm working on and I can't even find pre-compiled theme DLLS after wading through the enormous number of directoried and dlls ...
I took the DataGrid theme XAML dictionary and popped it into my own apps styles dll and now I cannot find the DLL that contains the CultureValueConverter that is missing (I have the DataPresenter DLL referenced). Searching the online help I can only find references to this object in relation to SilverLight.
Serisouly guys, I love the controls and this is the 4th employer I've recommended them too but PLEASE, PLEASE reduce the searching and inbuilt obfuscation, it's getting just plain too hard to find stuff in the dirth of options available ...
Where do I start?
Setting this in XAML:
Style="{DynamicResource {x:Type igDP:XamDataGrid}}"
Doesn't work.
And this:
<Style TargetType="{x:Type uc:MangoDynamicDataGrid}" BasedOn="{DynamicResource {x:Type dp:XamDataGrid}}"> </Style>
Is illegal ... so I'm completely lost now. Is there any other way to apply a style to a derived type? I can't believe I'm the first or only person to subclass the XamDataGrid.
I'm not currently setting the default style key to anything at all.
So I tried!
DefaultStyleKey = typeof(XamDataGrid);
This had no effect either. I tried each method SetResourceReferenec / DefaultStyleKey in turn and each independently, neither works. This is very confusing now, shall I try doing this in XAML instead of Code? Not sure if that should or will make any difference however ... I can't think of anything else to check / try now ...
findjammer3 said:I've just tried the simple approach so far and no luck.
What specifically isn't working? Maybe you can post a sample so I can see what you are seeing and see what is happening.
findjammer3 said:So from what you have said the default style is embedded in the Infragistics.WPF4.DataPresenter.v11.2 dll and this SetResourceReference method should tell this control to use that default style.
Just to be clear, that code tells WPF that the Style property is set to a DynamicResource to the type XamDataGrid. Since Styles are keyed by the Type this would get a style for XamDataGrid and use that for your control which should work. Maybe you're doing something like setting the DefaultStyleKey of your control to your type in which case you're telling WPF that you will be providing a default style for your type and unless you're doing that there will be no generic/fallback style.
Thanks for the help so far, appreciated. I've just tried the simple approach so far and no luck.
I have this as my class declaration in code:
public class MangoDynamicDataGrid : XamDataGrid
And in the ctor for this I have placed:
this.SetResourceReference(StyleProperty, typeof(XamDataGrid));
And the grids are still completely unstyled. So from what you have said the default style is embedded in the Infragistics.WPF4.DataPresenter.v11.2 dll and this SetResourceReference method should tell this control to use that default style.
Are there any other DLLs I should be referencing in order to get this behaviour to work?
Could creating a style with my type as the target type and then setting the based on property worth trying? I'm a bit confused as to why your solution doesn't work however.
findjammer3 said: OK, What would you suggest in this scenario? Is there some plain XAML Styles for the Grid I can use an update with my Type?
OK, What would you suggest in this scenario? Is there some plain XAML Styles for the Grid I can use an update with my Type?
You could take the xaml from the DefaulStyles folder and change them but that won't help with setting the Theme property since the xaml it uses is embedded in the assemblies. As suggested in the forum post I linked to, you could call SetResourceReference in the ctor of your wrapper class passing the appropriate type of ours that you are deriving from.