Rename View.Target -> View.ActionTarget

This commit is contained in:
Antony Male 2014-03-03 21:32:07 +00:00
parent 9a658a0b2d
commit ac83c4967d
4 changed files with 10 additions and 14 deletions

View File

@ -29,7 +29,7 @@ namespace Stylet
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
@ -39,7 +39,7 @@ namespace Stylet
private void UpdateGuardHandler()
{
var newTarget = View.GetTarget(this.subject);
var newTarget = View.GetActionTarget(this.subject);
MethodInfo targetMethodInfo = null;
this.guardPropertyGetter = null;

View File

@ -35,7 +35,7 @@ namespace Stylet
private void InvokeCommand(object sender, RoutedEventArgs e)
{
var target = View.GetTarget(this.subject);
var target = View.GetActionTarget(this.subject);
if (target == null)
throw new Exception("Target not set");

View File

@ -13,21 +13,18 @@ namespace Stylet
{
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 TargetProperty =
DependencyProperty.RegisterAttached("Target", typeof(object), typeof(View), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
public static readonly DependencyProperty ActionTargetProperty =
DependencyProperty.RegisterAttached("ActionTarget", typeof(object), typeof(View), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
public static object GetModel(DependencyObject obj)
{
@ -39,7 +36,6 @@ namespace Stylet
obj.SetValue(ModelProperty, value);
}
// Using a DependencyProperty as the backing store for Model. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ModelProperty =
DependencyProperty.RegisterAttached("Model", typeof(object), typeof(View), new PropertyMetadata(null, (d, e) => IoC.Get<IViewManager>().OnModelChanged(d, e) ));

View File

@ -71,7 +71,7 @@ namespace Stylet
public virtual void BindViewToModel(UIElement view, object viewModel)
{
View.SetTarget(view, viewModel);
View.SetActionTarget(view, viewModel);
var viewAsFrameworkElement = view as FrameworkElement;
if (viewAsFrameworkElement != null)