WdManualStyle.xaml 5.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <SolidColorBrush x:Key="Color_background" Color="#FFf1f1f1"/>

    
    <!--点击事件 被按下去的感觉-->
    <Style TargetType="Button" x:Key="Styles.Button.ResizeIcon">
        <Style.Resources>
            <Style TargetType="iconPacks:PackIconMaterial">
                <Setter Property="Width" Value="auto"/>
                <Setter Property="Height" Value="auto"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
            </Style>
        </Style.Resources>
        <Setter Property="Foreground" Value="{StaticResource Brushes.Static}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Background="Transparent">
                        <Grid x:Name="grid" Style="{StaticResource Styles.Shadow}">
                            <ContentPresenter x:Name="path" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              Width="50" Height="{Binding RelativeSource={RelativeSource Mode=Self},Path=Width}"
                                              HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!--鼠标移动 透明度变为70%-->
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                        <!--点击事件 内容变小 50变为46,阴影效果取消, 效果就是 被按下去的感觉-->
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="path" Property="Width" Value="46"/>
                            <Setter TargetName="grid" Property="Margin" Value="2"/>
                            <Setter Property="Foreground" Value="{StaticResource Brushes.Activity}"/>
                            <Setter TargetName="grid" Property="Effect" Value="{x:Null}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!--手动按钮-->
    <Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonStyle_hand" >
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Foreground" Value="{StaticResource Brushes.Static}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid x:Name="grid" HorizontalAlignment="Center">
                        <iconPacks:PackIconMaterial x:Name="path" Kind="HandRight" Width="50" Height="auto"/>
                            <TextBlock x:Name="blocka" Text="A" Foreground="Red" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="30" Margin="0,0,0,-10" Visibility="Hidden"/>
                        </Grid>

                        <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="path" Property="Width" Value="46"/>
                            <Setter TargetName="grid" Property="Margin" Value="2"/>
                            <Setter Property="Foreground" Value="{StaticResource Brushes.Activity}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="blocka" Property="Visibility" Value="Visible"/>
                            <Setter Property="Foreground" Value="{StaticResource Brushes.Activity}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--手动按钮的文字-->
    <Style TargetType="TextBlock" x:Key="TextBlockStyle_hand"  BasedOn="{StaticResource Styles.Text.FieldHeader}">
            <Setter Property="Text" Value="抓手手动"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Tag,RelativeSource={RelativeSource Mode=Self}}" Value="True">
                    <Setter Property="Text" Value="抓手自动"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
</ResourceDictionary>