Style mẫu
Style mẫu các button do AJS phát triển.
1 Thêm class DarkRoundCorner.xaml
Lưu mã sau dưới dạng tệp tin DarkRoundCorner.xaml
Code:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<SolidColorBrush x:Key="Color#FF89CBFA" Color="ByAJSlispvn" />
<SolidColorBrush x:Key="Color#FF89CBFA" Color="#FF89CBFA" />
<SolidColorBrush x:Key="ColorBackGround" Color="#FF3B4453" />
<SolidColorBrush x:Key="PaletteTitleBackGround" Color="#FF2E3440" />
<SolidColorBrush x:Key="ColorBlue" Color="#FF0097FB" />
<SolidColorBrush x:Key="ColorGrey" Color="#FFD9DBDD" />
<SolidColorBrush x:Key="Text" Color="White" />
<SolidColorBrush x:Key="PaletteBorder" Color="#FF222933" />
<Style x:Key="DarkRoundCorner" TargetType="{x:Type Button}">
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="grid">
<Border x:Name="border" CornerRadius="5" BorderThickness="0" Background="{DynamicResource PaletteTitleBackGround}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.FontWeight="Bold" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="2" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF606b85" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="grid" Value="0.25" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="5" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>2 Cách sử dụng
Lưu mã sau dưới dạng tệp tin
Code:
<Button x:Name="bDrawBlocks" Content="2. Vẽ block ✏️" Cursor="Hand" Foreground="Cyan"
Style="{DynamicResource DarkRoundCorner}"/>
Nhóm AutoCAD dotNET
---------------------------------------------------------------------------------------------
Mọi thông tin xin liên hệ Fanpage AutoLISP Thật là đơn giản!
Cảm ơn bạn đã theo dõi!

Không có nhận xét nào:
Đăng nhận xét