Browse Source

图标按钮

样式分支
pry 2 years ago
parent
commit
24bb5b9404
6 changed files with 299 additions and 147 deletions
  1. +31
    -0
      BPASmartClient.CustomResource/RecDictionarys/RecIcoButtonStyle.xaml
  2. +12
    -60
      BPASmartClient.CustomResource/UserControls/IcoButton.xaml
  3. +38
    -8
      BPASmartClient.CustomResource/UserControls/IcoButton.xaml.cs
  4. +1
    -0
      BPASmartClient/App.xaml
  5. +4
    -3
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  6. +213
    -76
      BPASmartClient/MainWindow.xaml

+ 31
- 0
BPASmartClient.CustomResource/RecDictionarys/RecIcoButtonStyle.xaml View File

@@ -0,0 +1,31 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate x:Key="IcoButtonTemp" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>

+ 12
- 60
BPASmartClient.CustomResource/UserControls/IcoButton.xaml View File

@@ -1,4 +1,4 @@
<UserControl
<Button
x:Class="BPASmartClient.CustomResource.UserControls.IcoButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -53,65 +53,17 @@
</Setter>
</Style>
</UserControl.Resources>-->
<UserControl.Resources>
<con:StringToIconConverter x:Key="StringToIconConverter" />
</UserControl.Resources>

<Grid>
<!--<Canvas Width="auto" Height="auto">-->
<!--<TextBlock
x:Name="tbx"
FontFamily="../Fonts/#iconfont"
Text="{Binding Path=IcoText, Mode=TwoWay, Converter={StaticResource StringToIconConverter}}" />-->

<TextBlock
x:Name="tbx"
FontSize="14"
Foreground="Red" />
<!--<Button Name="a">
<Button.Style>
<Style TargetType="Button">
-->
<!--<Setter Property="FontFamily" Value="../Fonts/#iconfont" />-->
<!--
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
-->
<!--<TextBlock FontFamily="../Fonts/#iconfont" Text="{Binding Path=IcoText, Converter={StaticResource StringToIconConverter}}" />-->
<!--
<ContentControl
Margin="10,0,5,0"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>-->
<!--</Canvas>-->
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Name="ico"
FontFamily="../Fonts/#iconfont"
Text="{Binding IcoText, RelativeSource={RelativeSource AncestorType=Button, Mode=FindAncestor}}" />
<TextBlock Name="con" Margin="10 0 0 0" Text="{Binding Context, RelativeSource={RelativeSource AncestorType=Button, Mode=FindAncestor}}" />
</StackPanel>
</Grid>
</UserControl>
</Button>

+ 38
- 8
BPASmartClient.CustomResource/UserControls/IcoButton.xaml.cs View File

@@ -18,7 +18,7 @@ namespace BPASmartClient.CustomResource.UserControls
/// <summary>
/// IcoButton.xaml 的交互逻辑
/// </summary>
public partial class IcoButton : UserControl
public partial class IcoButton : Button
{
public IcoButton()
{
@@ -32,17 +32,36 @@ namespace BPASmartClient.CustomResource.UserControls

private void Refresh()
{
tbx.Text = this.IcoText;
this.ico.Text = IcoText;
this.con.Text = Context;

this.ico.FontSize = PryFontSize;
this.con.FontSize = PryFontSize;

this.ico.Foreground = PryForeground;
this.con.Foreground = PryForeground;

}


public Brush PryForeground
{
get { return (Brush)GetValue(PryForegroundProperty); }
set { SetValue(PryForegroundProperty, value); }
}
public static readonly DependencyProperty PryForegroundProperty =
DependencyProperty.Register("PryForeground", typeof(Brush), typeof(IcoButton),
new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));

public int BorderThickness

public double PryFontSize
{
get { return (int)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
get { return (double)GetValue(PryFontSizeProperty); }
set { SetValue(PryFontSizeProperty, value); }
}
public static readonly DependencyProperty BorderThicknessProperty =
DependencyProperty.Register("BorderThickness", typeof(int), typeof(IcoButton),
new PropertyMetadata(2, new PropertyChangedCallback(OnPropertyChanged)));
public static readonly DependencyProperty PryFontSizeProperty =
DependencyProperty.Register("PryFontSize", typeof(double), typeof(IcoButton),
new PropertyMetadata(12, new PropertyChangedCallback(OnPropertyChanged)));


public string IcoText
@@ -54,5 +73,16 @@ namespace BPASmartClient.CustomResource.UserControls
DependencyProperty.Register("IcoText", typeof(string), typeof(IcoButton),
new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged)));


public string Context
{
get { return (string)GetValue(ContextProperty); }
set { SetValue(ContextProperty, value); }
}
public static readonly DependencyProperty ContextProperty =
DependencyProperty.Register("Context", typeof(string), typeof(IcoButton),
new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged)));


}
}

+ 1
- 0
BPASmartClient/App.xaml View File

@@ -12,6 +12,7 @@
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml"/>
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>-->



+ 4
- 3
BPASmartClient/Control/ShopDeviceConfigView.xaml View File

@@ -100,9 +100,10 @@
Width="100"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="新建"
Foreground="{StaticResource TextBlockForeground}"
IcoText="AA" />
Context="新建"
IcoText="&#xe626;"
PryForeground="{StaticResource TextBlockForeground}"
Template="{StaticResource IcoButtonTemp}" />

<!--<Button
Width="140"


+ 213
- 76
BPASmartClient/MainWindow.xaml View File

@@ -1,128 +1,265 @@
<Window x:Class="BPASmartClient.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
Title="MainWindow" Width="1600"
Height="900"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window
x:Class="BPASmartClient.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
Title="MainWindow"
Width="1600"
Height="900"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.DataContext>
<vm:MainViewModel></vm:MainViewModel>
<vm:MainViewModel />
</Window.DataContext>

<Border Style="{DynamicResource border主窗体背景}" x:Name="br" >
<Border x:Name="br" Style="{DynamicResource border主窗体背景}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition/>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>

<!--标题-->
<!-- 标题 -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition Width="300" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Style="{DynamicResource bordertop矩形}" Height="52" VerticalAlignment="Top"></Border>
<Border Style="{DynamicResource bordertopL}"></Border>
<Image Margin="20,0,0,0" VerticalAlignment="Center" Style="{DynamicResource imagetop_Title}" ></Image>
<Border
Grid.ColumnSpan="2"
Height="52"
VerticalAlignment="Top"
Style="{DynamicResource bordertop矩形}" />
<Border Style="{DynamicResource bordertopL}" />
<Image
Margin="20,0,0,0"
VerticalAlignment="Center"
Style="{DynamicResource imagetop_Title}" />
<Grid Grid.Column="1">
<Menu>
<MenuItem Header="功能列表">
<MenuItem Header="加盟商管理" FontSize="12" Click="MenuItem_Click" Tag="BatchingAddView"/>
<Separator/>
<MenuItem Header="业务编排" FontSize="12" Click="MenuItem_Click" Tag="BusinessOrchestrationView" />
<Separator/>
<MenuItem Header="大屏导航" FontSize="12" Click="MenuItem_Click" Tag="IOT" />
<Separator/>
<MenuItem Header="店铺设备配置" FontSize="12" Click="MenuItem_Click" Tag="ShopDeviceConfigView" />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="加盟商管理"
Tag="BatchingAddView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="业务编排"
Tag="BusinessOrchestrationView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="大屏导航"
Tag="IOT" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="店铺设备配置"
Tag="ShopDeviceConfigView" />
</MenuItem>
<MenuItem Header="状态监视" >
<MenuItem Header="日志监视" FontSize="12" Click="MenuItem_Click" Tag="LogView" />
<Separator/>
<MenuItem Header="订单监视" FontSize="12" Click="MenuItem_Click" Tag="OrderStatusView" />
<Separator/>
<MenuItem Header="设备监视" FontSize="12" Click="MenuItem_Click" Tag="DeviceMonitorView" />
<Separator/>
<MenuItem Header="告警监视" FontSize="12" Click="MenuItem_Click" Tag="LogView" />
<Separator/>
<MenuItem Header="IOT监视" FontSize="12" Click="MenuItem_Click" Tag="LogView" />
<MenuItem Header="状态监视">
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="日志监视"
Tag="LogView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="订单监视"
Tag="OrderStatusView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="设备监视"
Tag="DeviceMonitorView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="告警监视"
Tag="LogView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="IOT监视"
Tag="LogView" />
</MenuItem>
<MenuItem Header="综合查询">
<MenuItem Header="告警查询" FontSize="12" Click="MenuItem_Click" Tag="LogOrAlarmView"/>
<Separator/>
<MenuItem Header="日志查询" FontSize="12" Click="MenuItem_Click" Tag="LogOrAlarmView"/>
<Separator/>
<MenuItem Header="维护查询" FontSize="12" Click="MenuItem_Click" Tag="LogOrAlarmView"/>
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="告警查询"
Tag="LogOrAlarmView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="日志查询"
Tag="LogOrAlarmView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="维护查询"
Tag="LogOrAlarmView" />
</MenuItem>
<MenuItem Header="参数配置">
<MenuItem Header="参数设置" FontSize="12" Click="MenuItem_Click" Tag="SystemSetView"/>
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="参数设置"
Tag="SystemSetView" />
</MenuItem>
<MenuItem Header="系统帮助">
<MenuItem Header="版本更新历史" FontSize="12" Click="MenuItem_Click" Tag="VersionView"/>
<Separator/>
<MenuItem Header="帮助文档" FontSize="12" Click="MenuItem_Click" Tag="SystemParameterControl" />
<Separator/>
<MenuItem Header="退出程序" FontSize="12" Click="MenuItem_Click" Tag="Close"/>
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="版本更新历史"
Tag="VersionView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="帮助文档"
Tag="SystemParameterControl" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="退出程序"
Tag="Close" />
</MenuItem>
</Menu>
</Grid>

<StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right" Height="50" VerticalAlignment="Top">
<StackPanel
Grid.Column="4"
Height="50"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Orientation="Horizontal">
<Border Style="{DynamicResource border竖线}" />
<StackPanel Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock FontSize="12">网</TextBlock>
<TextBlock FontSize="12">络</TextBlock>
</StackPanel>
<ToggleButton Margin="5" VerticalAlignment="Center" ToolTip="网络连接状态" HorizontalAlignment="Center" Style="{DynamicResource StatusBtnStyle网络连接状态}" IsChecked="True" DataContext="{Binding GaoJingMessage}" Cursor="Hand"/>
<ToggleButton
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
DataContext="{Binding GaoJingMessage}"
IsChecked="True"
Style="{DynamicResource StatusBtnStyle网络连接状态}"
ToolTip="网络连接状态" />
<Border Style="{DynamicResource border竖线}" />
<ToggleButton VerticalAlignment="Center" ToolTip="告警消息" HorizontalAlignment="Center" Style="{DynamicResource StatusBtnStyle告警}" DataContext="{Binding GaoJingMessage}" Cursor="Hand"/>
<ToggleButton
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
DataContext="{Binding GaoJingMessage}"
Style="{DynamicResource StatusBtnStyle告警}"
ToolTip="告警消息" />
<Border Style="{DynamicResource border竖线}" />
<control:DateTimeUI Margin="10,0,10,0" VerticalAlignment="Center"></control:DateTimeUI>
<control:DateTimeUI Margin="10,0,10,0" VerticalAlignment="Center" />
<Border Style="{DynamicResource border竖线}" />
<Button x:Name="ButClose" Grid.Column="4" Margin="10,0,20,0" Style="{DynamicResource CommonBtn_返回}" VerticalAlignment="Center" ToolTip="退出程序" Cursor="Hand" Content="退出"/>
<Button
x:Name="ButClose"
Grid.Column="4"
Margin="10,0,20,0"
VerticalAlignment="Center"
Content="退出"
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}"
ToolTip="退出程序" />

</StackPanel>
</Grid>

<!--底部窗体-->
<!-- 底部窗体 -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
<RowDefinition/>
<RowDefinition Height="45" />
<RowDefinition />
</Grid.RowDefinitions>
<!--顶部装饰-->
<Border Grid.Row="0" Style="{DynamicResource border右下}" Grid.RowSpan="2" />
<Border Grid.Row="0" Style="{DynamicResource border左下}" Grid.RowSpan="2" />
<Border Grid.Row="0" Style="{DynamicResource border右上}" Grid.RowSpan="2" />
<Border Grid.Row="0" Style="{DynamicResource border左上}" Grid.RowSpan="2" />
<!-- 顶部装饰 -->
<Border
Grid.Row="0"
Grid.RowSpan="2"
Style="{DynamicResource border右下}" />
<Border
Grid.Row="0"
Grid.RowSpan="2"
Style="{DynamicResource border左下}" />
<Border
Grid.Row="0"
Grid.RowSpan="2"
Style="{DynamicResource border右上}" />
<Border
Grid.Row="0"
Grid.RowSpan="2"
Style="{DynamicResource border左上}" />
<Grid Margin="10">
<Border Style="{DynamicResource borderFromTitle}" Width="600"></Border>
<Button Grid.Row="0" Content="返回" Style="{DynamicResource CommonBtn_返回}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click" Cursor="Hand"/>
<Button Grid.Row="0" Content="测试消息弹窗" Width="100" Style="{DynamicResource CommonBtn_返回}" Margin="100,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click_1" Cursor="Hand"/>
<Border Width="600" Style="{DynamicResource borderFromTitle}" />
<Button
Grid.Row="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="Button_Click"
Content="返回"
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}" />
<Button
Grid.Row="0"
Width="100"
Margin="100,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="Button_Click_1"
Content="测试消息弹窗"
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}" />

<TextBlock x:Name="Title" HorizontalAlignment="Center" FontSize="18" Foreground="#feffff">日志监控界面</TextBlock>
<TextBlock
x:Name="Title"
HorizontalAlignment="Center"
FontSize="18"
Foreground="#feffff">
日志监控界面
</TextBlock>
</Grid>
<!--#region 底部窗体栏-->

<ContentControl Grid.Row="1" x:Name="contentRegion"/>
<ContentControl x:Name="contentRegion" Grid.Row="1" />
<!--#endregion-->
<!--<Button Grid.Row="2" Content="返回" Style="{DynamicResource CommonBtn_返回}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click"/>



Loading…
Cancel
Save