moved from SVN to git
This commit is contained in:
42
Controls/Controls/ImageButton.cs
Normal file
42
Controls/Controls/ImageButton.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
|
||||
namespace BeWo.Controls
|
||||
{
|
||||
public class ImageButton : Button
|
||||
{
|
||||
public static readonly DependencyProperty ImageSourceProperty;
|
||||
|
||||
static ImageButton()
|
||||
{
|
||||
ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ImageButton));
|
||||
}
|
||||
|
||||
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
|
||||
{
|
||||
base.OnRender(drawingContext);
|
||||
|
||||
ImageSource test = this.ImageSource;
|
||||
|
||||
Image img = this.FindName("ButtonImage") as Image;
|
||||
if (img != null)
|
||||
{
|
||||
img.Source = test;
|
||||
}
|
||||
}
|
||||
|
||||
public ImageSource ImageSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ImageSource)GetValue(ImageSourceProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ImageSourceProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user