Commit e8649d39 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 NoToggleButton 控件,用于不能触发IsChecked 的 button

parent 9bbbd8c5
......@@ -37,6 +37,28 @@ namespace FLY.ControlLibrary
} while (dobj != null);
return (T)dobj;
}
/// <summary>
/// 获取 DataContext
/// </summary>
/// <param name="dobj"></param>
/// <returns></returns>
public static object GetDataContext(DependencyObject dobj)
{
object dataContext = null;
do
{
if (dobj.GetType() == typeof(FrameworkElement))
{
dataContext = (dobj as FrameworkElement).DataContext;
if (dataContext != null)
{
break;
}
}
dobj = System.Windows.Media.VisualTreeHelper.GetParent(dobj);
} while (dobj != null);
return dataContext;
}
public static T GetParent<T>(DependencyObject dobj, string name) where T : FrameworkElement
{
do
......
......@@ -99,6 +99,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Rules\FileNameRule.cs" />
<Compile Include="NoToggleButton.cs" />
<Compile Include="WindowBigClose.cs" />
<Compile Include="UI.OSK\Window_FullPad.xaml.cs">
<DependentUpon>Window_FullPad.xaml</DependentUpon>
......@@ -151,22 +152,38 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Dictionary_MyStyle.xaml">
<Resource Include="Themes\ButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Themes\Colors.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\MaterialDesignIcons.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Themes\Dictionary_MyStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</Resource>
<Resource Include="Themes\MaterialDesignIcons.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Resource>
<Resource Include="Themes\WindowBigCloseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Page Include="Themes\OfficeTab.xaml">
<Resource Include="Themes\OfficeTab.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</Resource>
<Resource Include="Themes\TextStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Themes\NoToggleButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Resource>
<Page Include="UI.OSK\Window_FullPad.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace FLY.ControlLibrary
{
/// <summary>
/// 带IsChecked 的button, 不能通过点击 使IsChecked改变
/// </summary>
public class NoToggleButton : Button
{
/// <summary>
/// 显示的状态
/// </summary>
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register("IsChecked", typeof(bool), typeof(NoToggleButton));
/// <summary>
/// Off时的颜色
/// </summary>
public static readonly DependencyProperty OffBrushProperty = DependencyProperty.Register("OffBrush", typeof(Brush), typeof(NoToggleButton));
/// <summary>
/// On时的颜色
/// </summary>
public static readonly DependencyProperty OnBrushProperty = DependencyProperty.Register("OnBrush", typeof(Brush), typeof(NoToggleButton));
/// <summary>
/// Off时文字
/// </summary>
public static readonly DependencyProperty OffLabelProperty = DependencyProperty.Register("OffLabel", typeof(string), typeof(NoToggleButton));
/// <summary>
/// On时文字
/// </summary>
public static readonly DependencyProperty OnLabelProperty = DependencyProperty.Register("OnLabel", typeof(string), typeof(NoToggleButton));
public static bool GetIsChecked(UIElement element)
{
return (bool)element.GetValue(IsCheckedProperty);
}
public static void SetIsChecked(UIElement element, bool isClecked)
{
element.SetValue(IsCheckedProperty, isClecked);
}
public static Brush GetOffBrush(UIElement element)
{
return (Brush)element.GetValue(OffBrushProperty);
}
public static void SetOffBrush(UIElement element, Brush brush)
{
element.SetValue(OffBrushProperty, brush);
}
public static Brush GetOnBrush(UIElement element)
{
return (Brush)element.GetValue(OnBrushProperty);
}
public static void SetOnBrush(UIElement element, Brush brush)
{
element.SetValue(OnBrushProperty, brush);
}
public static string GetOnLabel(UIElement element)
{
return (string)element.GetValue(OnLabelProperty);
}
public static void SetOnLabel(UIElement element, string onLabel)
{
element.SetValue(OnLabelProperty, onLabel);
}
public static string GetOffLabel(UIElement element)
{
return (string)element.GetValue(OffLabelProperty);
}
public static void SetOffLabel(UIElement element, string offLabel)
{
element.SetValue(OffLabelProperty, offLabel);
}
public bool IsChecked
{
get
{
return (bool)GetValue(IsCheckedProperty);
}
set
{
SetValue(IsCheckedProperty, value);
}
}
public Brush OnBrush
{
get
{
return (Brush)GetValue(OnBrushProperty);
}
set
{
SetValue(OnBrushProperty, value);
}
}
public Brush OffBrush
{
get
{
return (Brush)GetValue(OffBrushProperty);
}
set
{
SetValue(OffBrushProperty, value);
}
}
public string OnLabel
{
get
{
return (string)GetValue(OnLabelProperty);
}
set
{
SetValue(OnLabelProperty, value);
}
}
public string OffLabel
{
get
{
return (string)GetValue(OffLabelProperty);
}
set
{
SetValue(OffLabelProperty, value);
}
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/MaterialDesignIcons.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--空按钮-->
<Style TargetType="Button" x:Key="ButtonStyle_empty">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}"
>
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle1">
<Setter Property="Width" Value="150"/>
<Setter Property="Height" Value="70"/>
<Setter Property="Margin" Value="6"/>
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<ContentPresenter HorizontalAlignment="Right" VerticalAlignment="Top" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle2">
<Setter Property="Margin" Value="6"/>
<Setter Property="Width" Value="185"/>
<Setter Property="Height" Value="85"/>
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="48" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="0.4" />
</Setter.Value>
</Setter>
<Setter Property="FlowDirection" Value="LeftToRight" />
</Style>
<Style TargetType="Button" x:Key="ButtonStyle3">
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="48" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}">
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="0.4" />
</Setter.Value>
</Setter>
</Style>
<!--× √ toggle 按钮-->
<Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonStyle1" >
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Canvas Height="45" Width="106">
<Path x:Name="Path_Background" Data="F1M1,1C1,1 105,1 105,1 105,1 105,44 105,44 105,44 1,44 1,44 1,44 1,1 1,1z"
Fill="#FF008BE5" Height="45" Width="106"/>
<Path x:Name="Path_block" Data="F1M1,1C1,1 23,1 23,1 23,1 23,35 23,35 23,35 1,35 1,35 1,35 1,1 1,1z"
Fill="#FFFFFFFF" Height="36" Canvas.Left="77" Canvas.Top="5" Width="24"/>
<Path x:Name="Path_On" Data="F1M9.551,15.307C9.551,15.307 13.212,23.525 13.212,23.525 13.212,23.525 19.161,6.825 28.542,1.258 28.314,5.234 27.398,8.68 29,12.921 24.881,13.982 16.415,25.91 13.669,31.742 9.78,26.175 5.203,21.934 2,20.609 2,20.609 9.551,15.307 9.551,15.307z"
Fill="#FFFFFFFF" Height="33" Canvas.Left="25" Canvas.Top="6" Width="31"/>
<Path x:Name="Path_Off" Visibility="Hidden" Data="F1M24.997,23.003C24.997,23.003 15.888,23.003 15.888,23.003 15.888,23.003 12.921,18.001 12.921,18.001 12.921,18.001 9.955,23.003 9.955,23.003 9.955,23.003 1.003,23.003 1.003,23.003 1.003,23.003 7.146,12.303 7.146,12.303 7.146,12.303 1.278,1.997 1.278,1.997 1.278,1.997 10.27,1.997 10.27,1.997 10.27,1.997 13.157,6.801 13.157,6.801 13.157,6.801 15.966,1.997 15.966,1.997 15.966,1.997 24.76,1.997 24.76,1.997 24.76,1.997 18.854,12.303 18.854,12.303 18.854,12.303 24.997,23.003 24.997,23.003z"
Fill="#FFFFFFFF" Height="25" Canvas.Left="51" Canvas.Top="10" Width="26"/>
</Canvas>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="Path_On" Property="Visibility" Value="Hidden"/>
<Setter TargetName="Path_Off" Property="Visibility" Value="Visible"/>
<Setter TargetName="Path_block" Property="Canvas.Left" Value="4"/>
<Setter TargetName="Path_Background" Property="Fill" Value="#FF3B3B3B"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--标题区,左边的后退键(蓝底白图标)-->
<Style TargetType="Button" x:Key="ButtonStyle_back" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="Margin" Value="0,24"/>
<Setter Property="Background" Value="{StaticResource Brush_theme_bar}"/>
<Setter Property="Content">
<Setter.Value>
<Path Fill="White" Data="{StaticResource Geometry_arrow-left-bold}"
SnapsToDevicePixels ="True"
Stretch="Fill"
Height="60" Width="60" HorizontalAlignment="Right" Margin="0,0,-2,0"/>
</Setter.Value>
</Setter>
</Style>
<!--标题区,左边的后退键(白底蓝图标)-->
<Style TargetType="Button" x:Key="ButtonStyle_back2" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="Margin" Value="0,24,0,24"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Content">
<Setter.Value>
<Path Fill="{StaticResource Brush_theme_bar}" Data="{StaticResource Geometry_arrow-left-bold}"
SnapsToDevicePixels ="True"
Stretch="Fill"
Height="60" Width="60" HorizontalAlignment="Right" Margin="0,0,-2,0"/>
</Setter.Value>
</Setter>
</Style>
<!--button内的阴影-->
<Style TargetType="Grid" x:Key="GridStyle_ButtonShadow">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="10" RenderingBias="Quality" Color="Black" Direction="270" ShadowDepth="2" Opacity="0.5" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="Brush_theme_bar" Color="#C0008BE5"/>
<SolidColorBrush x:Key="Background_Title" Color="#C0008BE5"/>
<SolidColorBrush x:Key="Color_theme_activity" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_theme_static" Color="#FF3B3B3B"/>
<SolidColorBrush x:Key="Color_theme_noact" Color="#FF888888"/>
<SolidColorBrush x:Key="Color_theme_background" Color="White"/>
<SolidColorBrush x:Key="Color_theme_text_activity" Color="DarkBlue"/>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:osk="clr-namespace:FLY.UI.OSK"
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/MaterialDesignIcons.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/TextStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/ButtonStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/NoToggleButtonStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="Brush_theme_bar" Color="#C0008BE5"/>
<SolidColorBrush x:Key="Background_Title" Color="#C0008BE5"/>
<SolidColorBrush x:Key="Color_theme_activity" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_theme_static" Color="#FF3B3B3B"/>
<SolidColorBrush x:Key="Color_theme_noact" Color="#FF888888"/>
<SolidColorBrush x:Key="Color_theme_background" Color="White"/>
<SolidColorBrush x:Key="Color_theme_text_activity" Color="DarkBlue"/>
<Style TargetType="TextBox" x:Key="TextBoxStyle1">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border Name="PART_Border" BorderBrush="{TemplateBinding Foreground}" Background="{TemplateBinding Background}">
<ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<i:Interaction.Behaviors>
<osk:KeyboardBehavior/>
</i:Interaction.Behaviors>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle1">
<Setter Property="Width" Value="150"/>
<Setter Property="Height" Value="70"/>
<Setter Property="Margin" Value="6"/>
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<ContentPresenter HorizontalAlignment="Right" VerticalAlignment="Top" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle_empty">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}"
>
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle2">
<Setter Property="Margin" Value="6"/>
<Setter Property="Width" Value="185"/>
<Setter Property="Height" Value="85"/>
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="48" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="false">
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="0.4" />
</Setter.Value>
</Setter>
<Setter Property="FlowDirection" Value="LeftToRight" />
</Style>
<Style TargetType="Button" x:Key="ButtonStyle3">
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="48" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="Background" Value="#FF3B3B3B" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Vertical">
<Border Background="{TemplateBinding Background}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}">
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="0.4" />
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldHeaderEditable">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF0083D7" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldHeader">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_ItemHeader">
<Setter Property="Margin" Value="0,9,0,0" />
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="30" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Right" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_FieldContent" BasedOn="{StaticResource ResourceKey=TextBoxStyle1}">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="MinWidth" Value="30" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm_interval">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_Title">
<Setter Property="Margin" Value="160,0,0,0" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="60" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonStyle1" >
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Canvas Height="45" Width="106">
<Path x:Name="Path_Background" Data="F1M1,1C1,1 105,1 105,1 105,1 105,44 105,44 105,44 1,44 1,44 1,44 1,1 1,1z"
Fill="#FF008BE5" Height="45" Width="106"/>
<Path x:Name="Path_block" Data="F1M1,1C1,1 23,1 23,1 23,1 23,35 23,35 23,35 1,35 1,35 1,35 1,1 1,1z"
Fill="#FFFFFFFF" Height="36" Canvas.Left="77" Canvas.Top="5" Width="24"/>
<Path x:Name="Path_On" Data="F1M9.551,15.307C9.551,15.307 13.212,23.525 13.212,23.525 13.212,23.525 19.161,6.825 28.542,1.258 28.314,5.234 27.398,8.68 29,12.921 24.881,13.982 16.415,25.91 13.669,31.742 9.78,26.175 5.203,21.934 2,20.609 2,20.609 9.551,15.307 9.551,15.307z"
Fill="#FFFFFFFF" Height="33" Canvas.Left="25" Canvas.Top="6" Width="31"/>
<Path x:Name="Path_Off" Visibility="Hidden" Data="F1M24.997,23.003C24.997,23.003 15.888,23.003 15.888,23.003 15.888,23.003 12.921,18.001 12.921,18.001 12.921,18.001 9.955,23.003 9.955,23.003 9.955,23.003 1.003,23.003 1.003,23.003 1.003,23.003 7.146,12.303 7.146,12.303 7.146,12.303 1.278,1.997 1.278,1.997 1.278,1.997 10.27,1.997 10.27,1.997 10.27,1.997 13.157,6.801 13.157,6.801 13.157,6.801 15.966,1.997 15.966,1.997 15.966,1.997 24.76,1.997 24.76,1.997 24.76,1.997 18.854,12.303 18.854,12.303 18.854,12.303 24.997,23.003 24.997,23.003z"
Fill="#FFFFFFFF" Height="25" Canvas.Left="51" Canvas.Top="10" Width="26"/>
</Canvas>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="Path_On" Property="Visibility" Value="Hidden"/>
<Setter TargetName="Path_Off" Property="Visibility" Value="Visible"/>
<Setter TargetName="Path_block" Property="Canvas.Left" Value="4"/>
<Setter TargetName="Path_Background" Property="Fill" Value="#FF3B3B3B"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle_back" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="Margin" Value="0,24"/>
<Setter Property="Background" Value="{StaticResource Brush_theme_bar}"/>
<Setter Property="Content">
<Setter.Value>
<Path Fill="White" Data="{StaticResource Geometry_arrow-left-bold}"
SnapsToDevicePixels ="True"
Stretch="Fill"
Height="60" Width="60" HorizontalAlignment="Right" Margin="0,0,-2,0"/>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="ButtonStyle_back2" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="Margin" Value="0,24,0,24"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Content">
<Setter.Value>
<Path Fill="{StaticResource Brush_theme_bar}" Data="{StaticResource Geometry_arrow-left-bold}"
SnapsToDevicePixels ="True"
Stretch="Fill"
Height="60" Width="60" HorizontalAlignment="Right" Margin="0,0,-2,0"/>
</Setter.Value>
</Setter>
</Style>
<!--动态区 UiModule 的背景框-->
<Style TargetType="Border" x:Key="BorderStyle_module">
<Setter Property="Background" Value="{StaticResource Color_theme_background}"/>
<Setter Property="Margin" Value="3"/>
......@@ -299,11 +23,6 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Grid" x:Key="GridStyle_ButtonShadow">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="10" RenderingBias="Quality" Color="Black" Direction="270" ShadowDepth="2" Opacity="0.5" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--toggleSwitchButton 默认样式-->
<Style TargetType="flyctrl:NoToggleButton" x:Key="NoToggleButtonStyle">
<Setter Property="Margin" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Width" Value="110"/>
<Setter Property="OffBrush" Value="{StaticResource Color_theme_static}" />
<Setter Property="OnBrush" Value="{StaticResource Color_theme_activity}" />
<Setter Property="OffLabel" Value="{Binding Content,RelativeSource={RelativeSource Mode=Self}}" />
<Setter Property="OnLabel" Value="{Binding Content,RelativeSource={RelativeSource Mode=Self}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="flyctrl:NoToggleButton">
<Border x:Name="canvas" Height="55" Width="{TemplateBinding Width}" Background="{TemplateBinding OffBrush}">
<Grid>
<Rectangle x:Name="Path_block" Height="45" Width="24" Margin="5" Fill="White" HorizontalAlignment="Left"/>
<StackPanel x:Name="SP_Text" Orientation="Horizontal" Margin="20,15" HorizontalAlignment="Right">
<TextBlock x:Name="TB_OnOff" Text="{TemplateBinding Property=OffLabel}" Foreground="White" FontSize="24" FontFamily="YouYuan"/>
</StackPanel>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Path_block" Property="HorizontalAlignment" Value="Right"/>
<Setter TargetName="SP_Text" Property="HorizontalAlignment" Value="Left"/>
<Setter TargetName="TB_OnOff" Property="Text" Value="{Binding OnLabel,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter TargetName="canvas" Property="Background" Value="{Binding OnBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<!--块移到中间-->
<Setter TargetName="Path_block" Property="HorizontalAlignment" Value="Center"/>
<Setter TargetName="TB_OnOff" Property="Opacity" Value="0.5"/>
<Setter Property="Opacity" Value="1"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.7"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="flyctrl:NoToggleButton" BasedOn="{StaticResource NoToggleButtonStyle}"/>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:osk="clr-namespace:FLY.UI.OSK;assembly=FLY.ControlLibrary"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="TextBox" x:Key="TextBoxStyle1">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border Name="PART_Border" BorderBrush="{TemplateBinding Foreground}" Background="{TemplateBinding Background}">
<ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<i:Interaction.Behaviors>
<osk:KeyboardBehavior/>
</i:Interaction.Behaviors>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldHeaderEditable">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF0083D7" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldHeader">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_ItemHeader">
<Setter Property="Margin" Value="0,9,0,0" />
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="30" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Right" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_FieldContent" BasedOn="{StaticResource ResourceKey=TextBoxStyle1}">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="MinWidth" Value="30" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm_interval">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_Title">
<Setter Property="Margin" Value="160,0,0,0" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="60" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -15,13 +15,14 @@
<ContentPresenter/>
</AdornerDecorator>
</Border>
<Button Name="button_close" Style="{StaticResource ButtonStyle_empty}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" Background="{x:Null}" BorderThickness="0" >
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" >
<Ellipse Fill="White" Height="110" Width="{Binding Height,RelativeSource={RelativeSource Mode=Self}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Path Data="{StaticResource Geometry_close-circle}" Fill="Red" Stretch="Fill" Height="100" Width="{Binding Height,RelativeSource={RelativeSource Mode=Self}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" Height="110" Width="{Binding Height,RelativeSource={RelativeSource Mode=Self}}" >
<Ellipse Fill="White" Stretch="Fill" />
<Button Name="button_close" Style="{StaticResource ButtonStyle_empty}" Margin="5" BorderThickness="0" >
<Path Data="{StaticResource Geometry_close-circle}" Fill="Red" Stretch="Fill" />
</Button>
</Grid>
</Grid>
</ControlTemplate>
<Style x:Key="WindowBigCloseStyle" TargetType="{x:Type Window}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment