在 App.xaml配置HandyControl,一個是皮膚資源,一個是主題資源
完整程式碼:
`
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
`
MainWindows.xaml 完整程式碼
`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"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="古希臘掌管水源的神" Height="300" Width="500">
<Grid >
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource ButtonSuccess}" Content="這是一個按鈕"/>
<Button Style="{StaticResource ButtonSuccess}" Content="這是一個按鈕" Margin="10,0,0,0" controls:BorderElement.CornerRadius="15"/>
<Button Style="{StaticResource ButtonSuccess}" Content="這是一個按鈕" Margin="10,0,0,0"/>
</StackPanel>
</Grid>`
執行:
這是一個入門例項
在第一次引入的時候可能會報錯,可以選擇重新生成,然後debug執行一下