add ImagePropertyEditor
This commit is contained in:
1 parent
1e08a45a4e
commit
9b46a1c2e3
6 files changed
+84
-4
No files matched your search
@@ -32,14 +32,20 @@ namespace HandyControl.Controls
|
||||
set => SetValue(IdProperty, value);
|
||||
}
|
||||
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(ImageSource), typeof(Gravatar), new PropertyMetadata(default(ImageSource), OnSourceChanged));
|
||||
|
||||
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (Gravatar)d;
|
||||
ctl.Background = new ImageBrush((ImageSource)e.NewValue);
|
||||
var v = (ImageSource) e.NewValue;
|
||||
|
||||
ctl.Background = v != null
|
||||
? new ImageBrush(v)
|
||||
{
|
||||
Stretch = Stretch.UniformToFill
|
||||
}
|
||||
: ResourceHelper.GetResource<Brush>("SecondaryRegionBrush");
|
||||
}
|
||||
|
||||
public ImageSource Source
|
||||
|
||||
Reference in new issue
Block a user