Custom list giving fill in Xaml – WPF

Recently time I wanted to create UserControl with list property. What’s more I wanted to have possibility add elements in Xaml.
It is the solution snippet code:


public List<SchoolTypeEnum> Types 









public static List<SchoolTypeEnum> GetTypes(DependencyObject obj) 


    return (List<SchoolTypeEnum>)obj.GetValue(TypesProperty); 


public static void SetTypes(DependencyObject obj, List<SchoolTypeEnum> value) 


    obj.SetValue(TypesProperty, value);


// Using a DependencyProperty as the backing store for Types. This enables animation, styling, binding, etc... public static readonly 

DependencyProperty TypesProperty = 


    typeof(List<SchoolTypeEnum>), typeof(SchoolChooser), new 

    UIPropertyMetadata(new List<SchoolTypeEnum>()));



<c:SchoolChooser > 






  • Share/Bookmark

Tags: , ,

Leave a Reply