静态资源样式引用到自定义控件
This commit is contained in:
1 parent
167885814e
commit
3fe394c8da
18 files changed
+191
-51
No files matched your search
+1
-11
@@ -5,24 +5,14 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace _29WxOrderWpf.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// UcImageButton.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UcImageButton : Button
|
||||
public class UcImageButton : Button
|
||||
{
|
||||
public UcImageButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<Button x:Class="_29WxOrderWpf.UserControls.UcImageButton"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf.UserControls"
|
||||
mc:Ignorable="d" Width="30" Height="22">
|
||||
</Button>
|
||||
+24
-5
@@ -1,18 +1,36 @@
|
||||
<UserControl x:Class="_29WxOrderWpf.UserControls.WindowBoxes"
|
||||
<UserControl x:Class="_29WxOrderWpf.UserControls.UcWindowBoxes"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf.UserControls"
|
||||
mc:Ignorable="d" Width="Auto" Height="Auto"
|
||||
d:DesignHeight="50" d:DesignWidth="300" Background="Black" Loaded="WindowBoxes_Loaded">
|
||||
<Grid>
|
||||
d:DesignHeight="50" d:DesignWidth="300" Background="Transparent" Loaded="WindowBoxes_Loaded">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--<Border Background="{StaticResource imgBrushCloseHover}" Width="17" Height="17" Margin="4">
|
||||
</Border>
|
||||
<Border Grid.Column="1" Width="17" Height="17" Margin="4">
|
||||
<Image Source="{StaticResource imgCloseHover}"/>
|
||||
</Border>-->
|
||||
|
||||
<!--不使用静态资源,在用户控件嵌套时,会发生预览错误-->
|
||||
<local:UcImageButton x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
|
||||
ButtonImage="{StaticResource imgMin}" MouseOverButtonImage="{StaticResource imgMinHover}" MousePressButtonImage="{StaticResource imgMinHover}"/>
|
||||
<local:UcImageButton x:Name="btnMax" Grid.Column="1" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
|
||||
ButtonImage="{StaticResource imgMax}" MouseOverButtonImage="{StaticResource imgMaxHover}" MousePressButtonImage="{StaticResource imgMaxHover}"/>
|
||||
<local:UcImageButton x:Name="btnNormal" Grid.Column="2" Width="17" Height="17" Background="Transparent" BorderThickness="0" Visibility="Collapsed" Margin="4"
|
||||
ButtonImage="{StaticResource imgNormal}" MouseOverButtonImage="{StaticResource imgNormalHover}" MousePressButtonImage="{StaticResource imgNormalHover}"/>
|
||||
<local:UcImageButton x:Name="btnClose" Grid.Column="3" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
|
||||
ButtonImage="{StaticResource imgClose}" MouseOverButtonImage="{StaticResource imgCloseHover}" MousePressButtonImage="{StaticResource imgCloseHover}"/>
|
||||
|
||||
|
||||
<!--<local:UcImageButton x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4"
|
||||
ButtonImage="/Resources/WindowBoxes/min.png"
|
||||
MouseOverButtonImage="/Resources/WindowBoxes/min.hover.png"
|
||||
@@ -29,8 +47,9 @@
|
||||
ButtonImage="/Resources/WindowBoxes/close.png"
|
||||
MouseOverButtonImage="/Resources/WindowBoxes/close.hover.png"
|
||||
MousePressButtonImage="/Resources/WindowBoxes/close.hover.png" />-->
|
||||
|
||||
|
||||
<Button x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4">
|
||||
<!--<Button x:Name="btnMin" Grid.Column="0" Width="17" Height="17" Background="Transparent" BorderThickness="0" Margin="4">
|
||||
<Border>
|
||||
<Grid>
|
||||
<Image Source="/Resources/WindowBoxes/min.png" Stretch="Uniform"/>
|
||||
@@ -61,6 +80,6 @@
|
||||
<Image Source="/Resources/WindowBoxes/close.hover.png" Stretch="Uniform" Visibility="Hidden"></Image>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Button>
|
||||
</Button>-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
+4
-4
@@ -18,10 +18,10 @@ namespace _29WxOrderWpf.UserControls
|
||||
/// <summary>
|
||||
/// WindowBox.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WindowBoxes : UserControl
|
||||
public partial class UcWindowBoxes : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty MaxBoxVisibilityProperty =
|
||||
DependencyProperty.Register("MaxBoxVisibility", typeof(Visibility), typeof(WindowBoxes),
|
||||
DependencyProperty.Register("MaxBoxVisibility", typeof(Visibility), typeof(UcWindowBoxes),
|
||||
new PropertyMetadata(default(Visibility)));
|
||||
public Visibility MaxBoxVisibility
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace _29WxOrderWpf.UserControls
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MinBoxVisibilityProperty =
|
||||
DependencyProperty.Register("MinBoxVisibility", typeof(Visibility), typeof(WindowBoxes),
|
||||
DependencyProperty.Register("MinBoxVisibility", typeof(Visibility), typeof(UcWindowBoxes),
|
||||
new PropertyMetadata(default(Visibility)));
|
||||
public Visibility MinBoxVisibility
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace _29WxOrderWpf.UserControls
|
||||
set { SetValue(MinBoxVisibilityProperty, value); btnMin.Visibility = value; }
|
||||
}
|
||||
|
||||
public WindowBoxes()
|
||||
public UcWindowBoxes()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
Reference in new issue
Block a user