Hi,
I have various controls hosted within a xamDockManager. I allow users to pick the IG themes - works fine for the ribbon and the dock manager. However, for some of the controls within the dock manager, I want to reuse some of the styles so that when the user changes the theme, things won't look out of place (e.g. if the user changes from Aero to Office Black, I don't want to have the background of a label to stick out because it doesn't follow the theme.)
I looked at some of the files in the DefaultStyles directory and tried this:
<Label x:Name="RequestTypeLabel" Grid.Row="0" Grid.Column="1" Background="{StaticResource igDock:DockManagerBrushKeys.XamDockManagerBackgroundFillKey}" >
I'm importing these namespaces at the top of the XAML:
xmlns:igThemes="http://infragistics.com/Themes" xmlns:igDock="http://infragistics.com/DockManager"
At runtime I get an error about the resource name for the Background property, so I'm obviously doing something wrong. So the short question is: "How do I use styles defined in IG themes?" A short example would be much appreciated.
Thanks,Michel
Hi Andrew,
I had to use DynamicResource (simply replaced "StaticResource" from your code above) since the theme can change on the fly, but now it seems to work fine.
Thanks!Michel
The reason you get an error is because that is a static property and therefore you need to wrap that in an x:Static (e.g. Background="{StaticResource {x:Static igDock:DockManagerBrushKeys.XamDockManagerBackgroundFillKey}}" ). BTW, using a StaticResource means that this will be a one time snapshot of the value so if you are letting users change the theme then you won't see any changes in that property. If you want it to update as the theme is changed then you should use a DynamicResource instead.