添加项目文件。
This commit is contained in:
59
SamplePreSystem.UI/Styles/BaseButtonStyle.xaml
Normal file
59
SamplePreSystem.UI/Styles/BaseButtonStyle.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
|
||||
|
||||
<!--<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#106EBE"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
-->
|
||||
<!--<Setter Property="FontSize" Value="16"/>-->
|
||||
<!--<Setter Property="FontFamily" Value="Assets/font/#iconfont"/>-->
|
||||
<!--
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background }">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightBlue"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>-->
|
||||
|
||||
|
||||
<!-- ===================== MaterialDesign 图标+文字按钮 ===================== -->
|
||||
<Style
|
||||
x:Key="IconTextButtonStyle"
|
||||
BasedOn="{StaticResource MaterialDesignRaisedButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="120" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<!-- 关键:用 DataTemplate不破坏按钮样式 -->
|
||||
<DataTemplate>
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<materialDesign:PackIcon
|
||||
Width="20"
|
||||
Height="20"
|
||||
Kind="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Tag}" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user