Daniel Daniel - 3 months ago 14
C# Question

Undestanding XAML syntax

I have a Theme attribute that I can load like this:

<xcad:DockingManager>
<xcad:DockingManager.Theme>
<xcad:AeroTheme>
</xcad:AeroTheme>
</xcad:DockingManager.Theme>


AeroTheme is a class. How can I achieve the same result via attributes?

<xcad:DockingManager Theme="What should I write here?">

Answer

You need an instance of that theme, which you can provide as a static resource. For example if the parent control is a grid:

<Grid.Resources>
  <xcad:AeroTheme x:Key="myTheme"/>
</Grid.Resources>

<xcad:DockingManager Theme="{StaticResource myTheme}">