提交 76113390 编写于 作者: 小时後可胖了's avatar 小时後可胖了

优化样式

上级 84b41443
......@@ -5,3 +5,4 @@ SmartUI/bin/
SmartUI/obj/
/.vs
/SmartUI/SmartUI.1.0.0.1.nupkg
/packages
......@@ -20,6 +20,12 @@ namespace SmartUI.Assist
return;
dataGrid.AutoGeneratedColumns += DataGrid_AutoGeneratedColumns;
dataGrid.Loaded += DataGrid_Loaded;
dataGrid.SizeChanged += DataGrid_SizeChanged;
}
private static void DataGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
DataGrid_AutoGeneratedColumns(sender, null);
}
private static void DataGrid_Loaded(object sender, RoutedEventArgs e)
......
......@@ -11,7 +11,7 @@ namespace SmartUI.Controls
{
public class NoticeControl : Grid
{
static ResourceDictionary style = new ResourceDictionary() { Source = new Uri("DiningReservation.UI;component/Themes/NoticeStyle.xaml", UriKind.Relative) };
static ResourceDictionary style = new ResourceDictionary() { Source = new Uri("SmartUI;component/Themes/NoticeStyle.xaml", UriKind.Relative) };
private ObservableCollection<NoticeItemModel> Items = new ObservableCollection<NoticeItemModel>();
private ItemsControl itemsControl;
Timer timer;
......@@ -67,14 +67,14 @@ namespace SmartUI.Controls
switch (icon)
{
case NoticeType.Ok:
Icon = "/DiningReservation.UI;component/Images/u301.png";
Icon = "/SmartUI;component/Themes/Images/u301.png";
break;
case NoticeType.Error:
Icon = "/DiningReservation.UI;component/Images/u304.png";
Icon = "/SmartUI;component/Themes/Images/u304.png";
break;
case NoticeType.Info:
default:
Icon = "/DiningReservation.UI;component/Images/u196.png";
Icon = "/SmartUI;component/Themes/Images/u196.png";
break;
}
Message = message.Length > 15 ? message.Substring(0, 15) + "..." : message;
......
......@@ -11,7 +11,8 @@ namespace SmartUI.Controls
{
public class SmartWindow : Window
{
private TextBlock _title;
private Label _title;
private Border _titleControl;
public SmartWindow()
{
......@@ -21,17 +22,36 @@ namespace SmartUI.Controls
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (a, b) => { WindowState = WindowState.Normal; }));
}
public FrameworkElement TitleControl
{
get { return (FrameworkElement)GetValue(TitleControlProperty); }
set { SetValue(TitleControlProperty, value); }
}
public static readonly DependencyProperty TitleControlProperty =
DependencyProperty.Register(nameof(TitleControl), typeof(FrameworkElement), typeof(SmartWindow), new PropertyMetadata(null));
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_title = GetTemplateChild("title") as TextBlock;
if (_title != null)
base.OnApplyTemplate();
if (TitleControl != null)
{
_titleControl = (Border)GetTemplateChild("titleControl");
_titleControl.Child = TitleControl;
_titleControl.MouseLeftButtonDown += TitleMouseLeftButtonDown;
}
else
{
_title.MouseLeftButtonDown += _title_MouseLeftButtonDown;
_title = GetTemplateChild("title") as Label;
if (_title != null)
{
_title.MouseLeftButtonDown += TitleMouseLeftButtonDown;
}
}
}
private void _title_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
private void TitleMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 1)
{
......
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace SmartUI.UI.Converter
{
public class BooToVisiable : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool bovalue)
{
return bovalue ? Visibility.Visible : Visibility.Collapsed;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace SmartUI.UI.Converter
{
public class ElementCountVisiable : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return Visibility.Collapsed;
if (value is IEnumerable<object> coo)
{
if(coo.Count()<=1)return Visibility.Collapsed;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace SmartUI.UI.Converter
{
public class OutCarStatusConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == "0")
{
return "异常";
}
else
{
return "正常";
}
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}
......@@ -19,6 +19,44 @@ namespace SmartUI.UI.Converter
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
public class TimestampConverterDay : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
string tim = value.ToString();
DateTime dateTime = DateTimeHelper.ToDateTime(long.Parse(tim));
return dateTime.ToString("yyyy-MM-dd");
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
public class TimestampConverterTime : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
string tim = value.ToString();
DateTime dateTime = DateTimeHelper.ToDateTime(long.Parse(tim));
return dateTime.ToString("HH:mm:ss");
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
......
......@@ -33,12 +33,32 @@
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="CalcBinding, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CalcBinding.2.4.0\lib\net45\CalcBinding.dll</HintPath>
<Reference Include="CalcBinding, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CalcBinding.2.5.2\lib\net45\CalcBinding.dll</HintPath>
</Reference>
<Reference Include="DynamicExpresso.Core, Version=1.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicExpresso.Core.1.3.4.8\lib\net40\DynamicExpresso.Core.dll</HintPath>
<Reference Include="DynamicExpresso.Core, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicExpresso.Core.2.4.0\lib\net461\DynamicExpresso.Core.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
......@@ -67,7 +87,10 @@
<Compile Include="Controls\PackIconDataFactory.cs" />
<Compile Include="Controls\SmartWindow.cs" />
<Compile Include="Controls\WaterComboBox.cs" />
<Compile Include="Converter\BooToVisiable.cs" />
<Compile Include="Converter\DialogButtonConverter.cs" />
<Compile Include="Converter\ElementCountVisiable.cs" />
<Compile Include="Converter\OutCarStatusConverter.cs" />
<Compile Include="Converter\PassWordConverter.cs" />
<Compile Include="Converter\TimestampConverter.cs" />
<Compile Include="Enum\DialogButton.cs" />
......@@ -88,6 +111,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\TextBlockStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\RadioButtonStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -145,5 +172,13 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\Images\u196.png" />
<Resource Include="Themes\Images\u301.png" />
<Resource Include="Themes\Images\u304.png" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<package >
<metadata>
<id>$id$</id>
<version>1.0.0.2</version>
<version>1.0.0.3</version>
<title>SmartUI</title>
<authors>柯勇</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
......
......@@ -11,7 +11,6 @@
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Background" Value="{DynamicResource BgWhiteColor}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBaseColor}"/>
<Setter Property="assist:ButtonAssist.Icon" Value="None"/>
<Setter Property="Cursor" Value="Hand"/>
......@@ -64,7 +63,7 @@
<Border x:Name="border" Cursor="{TemplateBinding Cursor}" Margin="{TemplateBinding Margin}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="4"/>
<DockPanel x:Name="contont" LastChildFill="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
<smart:PackIcon x:Name="icon" Kind="{TemplateBinding assist:ButtonAssist.Icon}" Width="18" Height="18" DockPanel.Dock="Left" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Label IsHitTestVisible="True" Cursor="{TemplateBinding Cursor}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
<Label IsHitTestVisible="True" Cursor="{TemplateBinding Cursor}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" Style="{x:Null}" HorizontalAlignment="Center"/>
</DockPanel>
</Grid>
......@@ -381,15 +380,16 @@
<Setter Property="Background" Value="{DynamicResource ErrorColor}"/>
</Style>
<Style x:Key="TextButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource DefaultButtonStyle}">
<Setter Property="Foreground" Value="{DynamicResource BrandColor}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource BrandColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Label x:Name="lable" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"/>
<ContentControl Content="{TemplateBinding Content}" />
<!--<Label x:Name="lable" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"/>-->
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextEnabledColor}"/>
......@@ -399,7 +399,48 @@
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsEnabled" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Opacity" Value="0.7" TargetName="lable"/>
<Setter Property="Opacity" Value="0.7"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RadioButton" x:Key="TopMenuStyle">
<Setter Property="MinWidth" Value="80"/>
<Setter Property="Height" Value="40"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Padding" Value="20 0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border BorderThickness="0 0 0 3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
<Setter Property="Foreground" Value="{DynamicResource BrandColor}"/>
<Setter Property="Background" Value="WhiteSmoke"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource BrandColor}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True"/>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
<Setter Property="Foreground" Value="{DynamicResource BrandColor}"/>
<Setter Property="Background" Value="WhiteSmoke"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
......
......@@ -25,7 +25,7 @@
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="icon" Property="Kind" Value="CheckBox"/>
<Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
<Setter Property="BorderBrush" Value="{ DynamicResource BrandColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextColor}"/>
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="BrandColor" Color="#409EFF"/>
<SolidColorBrush x:Key="BrandColor" Color="#409EFF"/>
<SolidColorBrush x:Key="SecondaryColor" Color="#FFFFFF"/>
<SolidColorBrush x:Key="SuccessColor" Color="#67C23A"/>
<SolidColorBrush x:Key="WarningColor" Color="#E6A23C"/>
......@@ -16,6 +16,7 @@
<SolidColorBrush x:Key="BorderLightColor" Color="#E4E7ED"/>
<SolidColorBrush x:Key="BorderLighterColor" Color="#EBEEF5"/>
<SolidColorBrush x:Key="BorderExtralightColor" Color="#F2F6FC"/>
<SolidColorBrush x:Key="PrimaryBorderGaryColor" Color="#DCDFE6"/>
<SolidColorBrush x:Key="BgBlackColor" Color="#000000"/>
<SolidColorBrush x:Key="BgWhiteColor" Color="#FFFFFF"/>
......
......@@ -8,7 +8,7 @@
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Width" Value="150"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryForegroundColor}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextColor}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Padding" Value="2" />
......
......@@ -74,7 +74,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ItemsPresenter Width="{TemplateBinding Width}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</DockPanel>
</ControlTemplate>
</Setter.Value>
......@@ -159,7 +159,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<Border x:Name="Bg" Width="{Binding RelativeSource={RelativeSource Mode=Self},Path=Column.Width}" Background="Transparent" UseLayoutRounding="True">
<Border x:Name="Bg" Width="Auto" Background="Transparent" UseLayoutRounding="True">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
......
......@@ -408,7 +408,7 @@
<SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF"/>
<ControlTemplate x:Key="DropDownButtonTemplate" TargetType="{x:Type Button}">
<Grid>
<Grid Width="20" Height="20" Background="White">
<Grid Width="20" Height="20" Background="Transparent">
<Path Stretch="UniformToFill" Height="10" Width="14" Margin="0,0,0,2" VerticalAlignment="Bottom" Fill="#FFBABABA" Data="{DynamicResource pathDate1}"/>
<Path Stretch="UniformToFill" Fill="#FFBABABA" Data="{DynamicResource pathDate2}"/>
<Path Stretch="UniformToFill" Width="6" Height="10" Margin="3,6,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Fill="#FFBABABA" Data="{DynamicResource pathDate3}"/>
......@@ -418,7 +418,7 @@
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<Button x:Name="PART_Button" Grid.Column="1" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Left" Margin="3,0,3,0" Grid.Row="0" Template="{StaticResource DropDownButtonTemplate}" VerticalAlignment="Center" Width="20"/>
<smart:DrTextBox x:Name="PART_TextBox" Style="{DynamicResource DateTimePickerTextBoxStyle}" Width="{TemplateBinding Width}" Grid.Column="0" Water="{Binding WaterText,RelativeSource={RelativeSource AncestorType=smart:DateTimePicker}}" Text="{Binding SelectedDateTime,StringFormat='yyyy-MM-dd',RelativeSource={RelativeSource AncestorType={x:Type smart:DateTimePicker}}}" BorderThickness="0" Grid.Row="0" VerticalContentAlignment="Center"/>
......@@ -458,7 +458,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="smart:DrTextBox">
<TextBlock x:Name="text" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Text="{TemplateBinding Text}" Foreground="{StaticResource PrimaryForegroundColor}"
<TextBlock x:Name="text" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Text="{TemplateBinding Text}" Foreground="{DynamicResource PrimaryTextColor}"
VerticalAlignment="Center" FontSize="16" Padding="5 0"/>
<ControlTemplate.Triggers>
<Trigger Property="Text" Value="">
......
......@@ -16,5 +16,6 @@
<ResourceDictionary Source="pack://application:,,,/SmartUI;component/Themes/WindowStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/SmartUI;component/Themes/RadioButtonStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/SmartUI;component/Themes/CheckBoxStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/SmartUI;component/Themes/TextBlockStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
\ No newline at end of file
......@@ -57,4 +57,52 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SystemCloseButtonStyle" TargetType="Button">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="border" Background="Transparent" Cursor="Hand">
<control:PackIcon x:Name="icon" Kind="Close" Width="24" Height="24" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{DynamicResource TextEnabledColor}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="Red"/>
<Setter TargetName="icon" Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DialogButtonStyle" TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="60"/>
<Setter Property="Height" Value="30"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="4" BorderThickness="1" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" BorderBrush="{DynamicResource PrimaryBorderGaryColor}" Background="{TemplateBinding Background}">
<Label Content="{TemplateBinding Content}" VerticalAlignment="Center" VerticalContentAlignment="Center"
HorizontalContentAlignment="Center" Foreground="{TemplateBinding Foreground}" Cursor="Hand"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</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">
<Style x:Key="itemsControlStyle" TargetType="ItemsControl">
<Setter Property="Margin" Value="0 50"/>
<Setter Property="Margin" Value="0 30"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="ItemsPanel">
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:assist="clr-namespace:SmartUI.Assist">
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Background" Value="Transparent"/>
......@@ -120,4 +121,44 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BottomLineRadioButton" TargetType="{x:Type RadioButton}">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Padding" Value="3 2 3 2"></Setter>
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="Height" Value="auto"></Setter>
<Setter Property="MinWidth" Value="60"/>
<!--<Setter Property="Foreground" Value="White"/>-->
<Setter Property="SnapsToDevicePixels" Value="true"></Setter>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="grid" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="8"/>
</Grid.RowDefinitions>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
<!--触发器:设置选中状态符号-->
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
</Trigger>
<Trigger Property="IsEnabled" Value="False">
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</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:smart="clr-namespace:SmartUI.Controls">
<Style TargetType="TabControl">
<Style x:Key="DefaultTabControlStyle" TargetType="TabControl">
<Setter Property="Margin" Value="8"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBaseColor}"/>
<Setter Property="Template">
......@@ -35,7 +35,8 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TabItem">
<Style TargetType="TabControl" BasedOn="{StaticResource DefaultTabControlStyle}"/>
<Style x:Key="DefaultTabItemStyle" TargetType="TabItem">
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="40"/>
<Setter Property="VerticalAlignment" Value="Center"/>
......@@ -65,4 +66,5 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TabItem" BasedOn="{StaticResource DefaultTabItemStyle}"/>
</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">
<Style x:Key="DefaultTextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlockStyle}"/>
<Style x:Key="SubTitleStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Height" Value="40" />
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextColor}"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
<Style x:Key="FieldTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlockStyle}">
<Setter Property="FontSize" Value="16"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="4"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -3,10 +3,11 @@
xmlns:smart="clr-namespace:SmartUI.Controls">
<Style x:Key="DrTextBoxDefaultStyle" TargetType="{x:Type smart:DrTextBox}">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="45"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBorderGaryColor}"/>
<Setter Property="Icon" Value="{x:Null}"/>
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
......@@ -23,13 +24,13 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="smart:DrTextBox">
<Border x:Name="border" BorderBrush="{StaticResource PrimaryBorderGaryColor}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Padding="3 0">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Padding="3 0">
<DockPanel LastChildFill="True">
<smart:PackIcon x:Name="icon" VerticalAlignment="Center" Kind="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Icon,UpdateSourceTrigger=PropertyChanged}" Width="24" Height="24" Foreground="{StaticResource PrimaryBorderGaryColor}" DockPanel.Dock="Left"/>
<smart:PackIcon x:Name="icon" VerticalAlignment="Center" Kind="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Icon,UpdateSourceTrigger=PropertyChanged}" Width="24" Height="24" Foreground="{DynamicResource PrimaryBorderGaryColor}" DockPanel.Dock="Left"/>
<Grid VerticalAlignment="Center">
<TextBox x:Name="text" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Text,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Height="{TemplateBinding Height}" BorderThickness="0" VerticalAlignment="Center" VerticalContentAlignment="Center" Foreground="Black"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Margin="5 0" x:Name="water" Text="{TemplateBinding Water}" Visibility="Collapsed" IsHitTestVisible="False" Foreground="{StaticResource PrimaryBorderGaryColor}" VerticalAlignment="Center"/>
<TextBlock Margin="5 0" x:Name="water" Text="{TemplateBinding Water}" Visibility="Collapsed" IsHitTestVisible="False" Foreground="{DynamicResource PrimaryBorderGaryColor}" VerticalAlignment="Center"/>
</Grid>
</DockPanel>
</Border>
......@@ -37,21 +38,38 @@
<Trigger Property="Icon" Value="{x:Null}">
<Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsFocused" SourceName="text" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryColor}"/>
<!--<Trigger Property="IsFocused" SourceName="text" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryColor}"/>
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
</Trigger>
</Trigger>-->
<Trigger Property="IsEmpty" Value="True">
<Setter TargetName="water" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEmpty" Value="False">
<Setter TargetName="water" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Validation.HasError" Value="true">
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsFocused" SourceName="text" Value="True"/>
<Condition Property="Validation.HasError" Value="False"/>
</MultiTrigger.Conditions>
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
<Setter Property="BorderBrush" Value="{DynamicResource BrandColor}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsFocused" SourceName="text" Value="True"/>
<Condition Property="Validation.HasError" Value="True"/>
</MultiTrigger.Conditions>
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
<Setter Property="BorderBrush" Value="Red"/>
</MultiTrigger>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip" Value="{Binding RelativeSource=
{x:Static RelativeSource.Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
......
......@@ -26,10 +26,14 @@
<Button x:Name="maximize" assist:ButtonAssist.Icon="WindowMaximize" Command="SystemCommands.MaximizeWindowCommand" Style="{DynamicResource WindowButtonStyle}"/>
<Button assist:ButtonAssist.Icon="WindowClose" Command="SystemCommands.CloseWindowCommand" Style="{DynamicResource WindowButtonStyle}"/>
</StackPanel>
<DockPanel LastChildFill="True">
<Image x:Name="icon" DockPanel.Dock="Left" Source="{TemplateBinding Icon}" Width="24" Height="24" VerticalAlignment="Center"/>
<TextBlock x:Name="title" Text="{TemplateBinding Title}" VerticalAlignment="Center" Padding="5" FontSize="13" FontWeight="ExtraBlack"/>
</DockPanel>
<Grid>
<Border x:Name="titleControl" Background="Transparent" Visibility="Visible"/>
<DockPanel x:Name="titleDock" LastChildFill="True" Visibility="Collapsed">
<Image x:Name="icon" DockPanel.Dock="Left" Source="{TemplateBinding Icon}" Width="22" Height="22" VerticalAlignment="Center" Margin="5 0 0 0"/>
<Label x:Name="title" Content="{TemplateBinding Title}" VerticalAlignment="Center" Padding="5 0" FontSize="14" FontWeight="ExtraBlack"/>
</DockPanel>
</Grid>
</DockPanel>
<Rectangle Height="6" Grid.Row="1">
<Rectangle.Fill>
......@@ -41,7 +45,11 @@
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<ContentPresenter Grid.Row="2"/>
<Grid Grid.Row="2">
<AdornerDecorator>
<ContentPresenter></ContentPresenter>
</AdornerDecorator>
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
......@@ -58,12 +66,16 @@
<Setter TargetName="maximize" Property="Visibility" Value="Visible"/>
<Setter TargetName="restore" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="TitleControl" Value="{x:Null}">
<Setter TargetName="titleControl" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="titleDock" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="smart:SmartWindow" BasedOn="{StaticResource DefaultWindowStyle}"/>
<Style x:Key="WindowButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="35"/>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CalcBinding" version="2.5.2" targetFramework="net472" />
<package id="DynamicExpresso.Core" version="2.4.0" targetFramework="net472" />
</packages>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册