is it possible to apply a converter to a data source of a control in xaml?
or perhaps there is another way to do this.
Basically i have a custom control that accepts a specific type of object. that object is tightly bound to that control. I don't want to convert to this type all over my view model. So i would like to be able to bind to regular properties such as List and have it automatically translated to my object by a converter.
I've attempted something like this.
ItemsSource="{Binding CurrentTables, Converter={x:Static cconverters:SpyFilterDataObjectConverter}}"
Well, it doesn't seem good as for me to use such kind of converters. Basically, converter performs conversion operation only once, so you will not receive any updates. I've used different approach - just create some sort of wrapper that contains an initial collection (it should implement INotifyCollectionChanged) and some wrap strategies that converts your initial object to wrapped one.
x:Static has the syntax namespace:Type.StaticMember, you should instantiate the converter and expose it as a static property.
Alternatively you can create an instance in the Application.Resources in your App.xaml, then you can reference it as a static resource throughout the application using its key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With