Customize your application by applying one of the built-in themes to your ComponentOne Silverlight control. Each of the built-in themes is based on a Silverlight Toolkit theme. For information about each of the built-in themes, see Available Themes. In this example, we add the RainierOrange theme to the C1DropDown control on a page.
To apply the theme, complete the following steps:
Copy Code
|
|
---|---|
<UserControl xmlns:my="clr-namespace:C1.Silverlight.Theming.RainierOrange;assembly=C1.Silverlight.Theming.RainierOrange" x:Class="C1Silverlight.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <my:C1ThemeRainierOrange></my:C1ThemeRainierOrange> </Grid> </UserControl> |
Copy Code
|
|
---|---|
<UserControl xmlns:c1="clr-namespace:C1.Silverlight;assembly=C1.Silverlight" xmlns:my="clr-namespace:C1.Silverlight.Theming.RainierOrange;assembly=C1.Silverlight.Theming.RainierOrange" x:Class="C1Silverlight.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <my:C1ThemeRainierOrange> <c1:C1DropDown Width="100" Height="30"></c1:C1DropDown> </my:C1ThemeRainierOrange> </Grid> </UserControl> |
Run your project and observe that the C1DropDown control now appears in the RainierOrange theme. Note that you can only set the Content property on the theme once, so to theme multiple controls using this method, add a panel within the theme, for example a Grid or StackPanel, and then add multiple controls within the panel.
You can also use the ImplicitStyleManager to theme all controls of a particular type. For more information, see Using the ImplicitStyleManager.