mirror of https://github.com/AMT-Cheif/Stylet.git
Rename View.Target -> View.ActionTarget
This commit is contained in:
parent
9a658a0b2d
commit
ac83c4967d
|
@ -29,7 +29,7 @@ namespace Stylet
|
||||||
|
|
||||||
this.UpdateGuardHandler();
|
this.UpdateGuardHandler();
|
||||||
|
|
||||||
DependencyPropertyDescriptor.FromProperty(View.TargetProperty, typeof(View)).AddValueChanged(this.subject, (o, e) => this.UpdateGuardHandler());
|
DependencyPropertyDescriptor.FromProperty(View.ActionTargetProperty, typeof(View)).AddValueChanged(this.subject, (o, e) => this.UpdateGuardHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GuardName
|
private string GuardName
|
||||||
|
@ -39,7 +39,7 @@ namespace Stylet
|
||||||
|
|
||||||
private void UpdateGuardHandler()
|
private void UpdateGuardHandler()
|
||||||
{
|
{
|
||||||
var newTarget = View.GetTarget(this.subject);
|
var newTarget = View.GetActionTarget(this.subject);
|
||||||
MethodInfo targetMethodInfo = null;
|
MethodInfo targetMethodInfo = null;
|
||||||
|
|
||||||
this.guardPropertyGetter = null;
|
this.guardPropertyGetter = null;
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Stylet
|
||||||
|
|
||||||
private void InvokeCommand(object sender, RoutedEventArgs e)
|
private void InvokeCommand(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var target = View.GetTarget(this.subject);
|
var target = View.GetActionTarget(this.subject);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
throw new Exception("Target not set");
|
throw new Exception("Target not set");
|
||||||
|
|
||||||
|
|
|
@ -13,21 +13,18 @@ namespace Stylet
|
||||||
{
|
{
|
||||||
static readonly ContentPropertyAttribute DefaultContentProperty = new ContentPropertyAttribute("Content");
|
static readonly ContentPropertyAttribute DefaultContentProperty = new ContentPropertyAttribute("Content");
|
||||||
|
|
||||||
public static object GetTarget(DependencyObject obj)
|
public static object GetActionTarget(DependencyObject obj)
|
||||||
{
|
{
|
||||||
return (object)obj.GetValue(TargetProperty);
|
return (object)obj.GetValue(ActionTargetProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetTarget(DependencyObject obj, object value)
|
public static void SetActionTarget(DependencyObject obj, object value)
|
||||||
{
|
{
|
||||||
obj.SetValue(TargetProperty, value);
|
obj.SetValue(ActionTargetProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using a DependencyProperty as the backing store for Target. This enables animation, styling, binding, etc...
|
public static readonly DependencyProperty ActionTargetProperty =
|
||||||
public static readonly DependencyProperty TargetProperty =
|
DependencyProperty.RegisterAttached("ActionTarget", typeof(object), typeof(View), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
|
||||||
DependencyProperty.RegisterAttached("Target", typeof(object), typeof(View), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static object GetModel(DependencyObject obj)
|
public static object GetModel(DependencyObject obj)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +36,6 @@ namespace Stylet
|
||||||
obj.SetValue(ModelProperty, value);
|
obj.SetValue(ModelProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using a DependencyProperty as the backing store for Model. This enables animation, styling, binding, etc...
|
|
||||||
public static readonly DependencyProperty ModelProperty =
|
public static readonly DependencyProperty ModelProperty =
|
||||||
DependencyProperty.RegisterAttached("Model", typeof(object), typeof(View), new PropertyMetadata(null, (d, e) => IoC.Get<IViewManager>().OnModelChanged(d, e) ));
|
DependencyProperty.RegisterAttached("Model", typeof(object), typeof(View), new PropertyMetadata(null, (d, e) => IoC.Get<IViewManager>().OnModelChanged(d, e) ));
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Stylet
|
||||||
|
|
||||||
public virtual void BindViewToModel(UIElement view, object viewModel)
|
public virtual void BindViewToModel(UIElement view, object viewModel)
|
||||||
{
|
{
|
||||||
View.SetTarget(view, viewModel);
|
View.SetActionTarget(view, viewModel);
|
||||||
|
|
||||||
var viewAsFrameworkElement = view as FrameworkElement;
|
var viewAsFrameworkElement = view as FrameworkElement;
|
||||||
if (viewAsFrameworkElement != null)
|
if (viewAsFrameworkElement != null)
|
||||||
|
|
Loading…
Reference in New Issue