خرید بک لینک

Vote count: 0

I want to pass an object as a parameter to a Converter. Since I can't do that using a ConverterParameter, I have used a DependencyProperty instead.

Here is the code -

 public class FilteredColumnConverter : DependencyObject, IValueConverter
 {
     public DataGridFilter FilterObject
     {
         get { retu (DataGridFilter) GetValue(FilterObjProperty); }
         set { SetValue(FilterObjProperty, value); }
     }

   public static readonly DependencyProperty FilterObjProperty =
   DependencyProperty.Register( "FilterObj",
   typeof(DataGridFilter),
   typeof(FilteredColumnConverter),
   new PropertyMetadata(null));

  //With implementations for Convert and ConvertBack
}

My XAML:

  <UserControl.Resources> 
        <helpers:FilteredColumnConverter  x:Key="filteredColumnConverter" FilterObject="{Binding myFilterObj}"/>
   </UserControl.Resources>

I'm getting the following error :

A 'Binding' caot be set on the 'FilterObject' property of type 'FilteredColumnConverter'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.

What seems to be the problem? I have a FilterObject is a dependency property and I have followed the naming conventions as well.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 24 فروردين 1395 ساعت: 14:39

صفحه بندی