静态资源样式引用到自定义控件

This commit is contained in:
wule committed 2026-06-16 03:45:05 +08:00
1 parent 167885814e
commit 3fe394c8da
18 files changed
+191 -51

No files matched your search

@@ -0,0 +1,45 @@
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 _29WxOrderWpf.UserControls
{
public class UcImageButton : Button
{
public UcImageButton()
{
this.DataContext = this;
}
public static readonly DependencyProperty ButtonImageProperty = DependencyProperty.Register(
"ButtonImage", typeof(ImageSource), typeof(UcImageButton), null);
public ImageSource ButtonImage
{
get { return (ImageSource)GetValue(ButtonImageProperty); }
set { SetValue(ButtonImageProperty, value); }
}
public static readonly DependencyProperty MouseOverButtonImageProperty = DependencyProperty.Register(
"MouseOverButtonImage", typeof(ImageSource), typeof(UcImageButton), null);
public ImageSource MouseOverButtonImage
{
get { return (ImageSource)GetValue(MouseOverButtonImageProperty); }
set { SetValue(MouseOverButtonImageProperty, value); }
}
public static readonly DependencyProperty MousePressButtonImageProperty = DependencyProperty.Register(
"MousePressButtonImage", typeof(ImageSource), typeof(UcImageButton), null);
public ImageSource MousePressButtonImage
{
get { return (ImageSource)GetValue(MousePressButtonImageProperty); }
set { SetValue(MousePressButtonImageProperty, value); }
}
}
}