Archive

Articles taggués ‘wpf’

Binding for non hierarchical object

If you have an object who is not in herarchical tree, like converter, you cannot bind something even you have define DependyProperty on it.

first you must prepare you converter for having DependencyProperty by override DependencyObject

then create DependencyProperties

and finally set binding in xaml

as the converter is not in herarchical tree i cannot using binding with ElementName= but i can use x:reference like this

 

Categories: Non classé Tags: , ,

Share an created object in resource

If you want to share a same object created, even this is create in hierachical tree you can by using x:Shared= »true » like this

it’s a good solution for shared parameters on objects

Categories: Non classé Tags:

Alternative for ICollectionView (for sorting update)

When you want to sort a collection in MVVM you use

but if you want to update sorting in treeview for sample you can use

and set IsLiveSorting to true

for sample see converter using in TreeView for update sorting hierarchical

and using

 

Categories: Non classé Tags: , , ,