ListView list = new ListView { Style = Styles.DefaultList };
listView.SetBinding (ItemsView.ItemsSourceProperty, "MenuItems");
listView.SetBinding (ItemsView.ItemTemplateProperty, "MenuItems", converter: new ItemSourceToDataConverter( ));
public class SubMenuPadding : IValueConverter
{
public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if(((ObservableCollection<MenuItem>)value).Where (item => item.changeTemplate == true ))
return new DataTemplate (typeof(SecondTemplate));
return new DataTemplate (typeof(FirstTemplate));
}
public object ConvertBack (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
}
Somethind like this.. But it don't work.
Depending a property state on model, I change the DataModel.