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?
I should add here that I have subclassed the Controls so the type is actually not XamDataChart or XamDataGrid ... I have just created thin wrappers to encapsulate custom functionality.
I've so far completely failed to get any Infragistics themes to apply to the controls.
Not even sure which DLLs need to be referenced as Referenceing Forest theme and setting the theme manager to use this one does nothing at all.
findjammer3 said:I should add here that I have subclassed the Controls so the type is actually not XamDataChart or XamDataGrid ... I have just created thin wrappers to encapsulate custom functionality.
That makes a big difference since WPF uses the actual type as the key when searching for implicit/local styles - so your derived class' type - and therefore any styles we provide in our themes will not be picked up by WPF. You might want to review this post about common Theme/Style issues like this or other posts with similar questions like this one.
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.
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: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.
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 ...
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.
Thanks for the demo app.
I've looked it over and it describes exactly what I tried ... it didn't work in my application.
The specific problem is that setting these properties / executing the methods aren't doing what you said they would.
I'll try and get a sample together later to illustrate the problem.
Do you have an email address I can send the sample to?
You haven't provided me with a sample or a description of what exactly is not working so it is hard to say what is going on. I can say that both approaches (setting the dynamicresource in the xaml or calling setresourcereference in code) do allow WPF to pick up the styles for the control and allow theming to continue to work. I've attached a sample showing both approaches. With regards to BasedOn, you can only use that with a StaticResource - not a DynamicResource - in which case I believe it just picks up the generic style at the time it is created.
I've managed to get it to style but copying all the Generic styles into another dictionary and globally replacing the XamDataGrid type declaration with my own Type ...
This is the only approach that seems to work for me ...