Native Controls
Actipro Themes includes styles and templates for all native WPF controls that have been given a more modernized appearance, and mesh perfectly with Actipro's custom control products.
The native WPF control styles use the same common asset resource (brush, thickness, etc.) pool as with our other custom WPF controls. Thus, no matter which native or Actipro controls you use together, the appearance will consistently look great.
Using Native Styles and Templates
The Style
for each native control can be applied either explicitly or implicitly. In most situations, applying the styles implicitly is the best approach, as this provides consistency across your application.
Implicit Styles
The native control styles can be applied implicitly by simply setting ThemeManager.AreNativeThemesEnabled to true
. The theme manager will automatically load the necessary implicit styles into the application resources, which will therefore be used by your entire application.
ThemeManager.AreNativeThemesEnabled = true;
Note
See the Getting Started topic for a complete example of how to use this setting, as well as how to combine it with other settings.
While not recommended due to additional resources needing to be loaded at run-time, it is also possible to implicitly apply the native control styles to part of the visual tree. This sample code shows how to enable native for myControl
and its descendents only:
ThemeManager.SetAreNativeThemesEnabled(myControl, true);
Explicit Styles
The native control styles can also be applied explicitly on each individual control, using an associated ComponentResourceKey
defined in the SharedResourceKeys class.
For example, the SharedResourceKeys.ButtonBaseStyleKey can be applied a RepeatButton
like so:
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
...
<RepeatButton Content="Click Me" Style="{DynamicResource {x:Static themes:SharedResourceKeys.ButtonBaseStyleKey}}" />
For a complete list of the support native control styles, see the table in the following section.
Style Keys for Native Controls
This list shows the style resource keys that are available in SharedResourceKeys for use with native controls:
Style Resource Key | Description |
---|---|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
|
Applies to |
Embedded Style Keys for Native Controls
Several native controls, such as ToolBar
, require different styles for controls hosted or "embedded" inside it.
Menu
This list shows the embedded style resource keys that are available in SharedResourceKeys for use with Menu
controls:
Style Resource Key | Description |
---|---|
MenuEmbeddedScrollViewerStyleKey | Applies to ScrollViewer controls. |
MenuEmbeddedSeparatorStyleKey | Applies to Separator controls. |
StatusBar
This list shows the embedded style resource keys that are available in SharedResourceKeys for use with StatusBar
controls:
Style Resource Key | Description |
---|---|
StatusBarEmbeddedResizeGripStyleKey | Applies to ResizeGrip controls. |
StatusBarEmbeddedSeparatorStyleKey | Applies to Separator controls. |
StatusBarEmbeddedSliderDecreaseButtonBaseStyleKey | Applies to ButtonBase controls and its derivations, which includes Button , RepeatButton , and ToggleButton . |
StatusBarEmbeddedSliderIncreaseButtonBaseStyleKey | Applies to ButtonBase controls and its derivations, which includes Button , RepeatButton , and ToggleButton . |
StatusBarEmbeddedSliderStyleKey | Applies to Slider controls. |
ToolBar
This list shows the embedded style resource keys that are available in SharedResourceKeys for use with ToolBar
controls:
Style Resource Key | Description |
---|---|
ToolBarEmbeddedButtonBaseStyleKey | Applies to ButtonBase controls and its derivations, which includes Button , RepeatButton , and ToggleButton . |
ToolBarEmbeddedComboBoxStyleKey | Applies to ComboBox controls. |
ToolBarEmbeddedMenuStyleKey | Applies to Menu controls. |
ToolBarEmbeddedPopupButtonStyleKey | Applies to PopupButton controls. |
ToolBarEmbeddedSeparatorStyleKey | Applies to Separator controls. |
ToolBarEmbeddedTextBoxStyleKey | Applies to TextBox controls. |