This question is locked. New answers and comments are not allowed.
I tried the obvious approach of using selecteditems as a two way binding so my viewmodel would know what from the list the user picked. Ok I have no idea why this wouldn't be implemented but apparently its not.. So on to some attempted work arounds.
First I thought if my items object contained an IsSelected or even inherited from a base class like ListPickerItem the control would pass through to my object when I made a selection. Doesn't seem to.
Next I decided to try selectedValue as a two way binding back to a collection of the same objects. No luck here either. Here is the VM code.
The goal would be this
1.Display a list of values to choose from with multi-selection.
2.through data binding return the selected list to my vm.
<telerikInput:RadListPicker SelectedValue="{Binding SelectedValues,Mode=TwoWay, UpdateSourceTrigger=Default}" SelectedValuePath="Value" DisplayMemberPath="DisplayValue" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top" Width="300" SelectionMode="Multiple" ItemsSource="{Binding PosibleTables,Mode=TwoWay}"/>
private List<ListPickerObject<int>> _posibletables;
public List<ListPickerObject<int>> PosibleTables
{
get
{
if (_posibletables == null)
{
_posibletables = new List<ListPickerObject<int>>();
for (int i = 0; i <= 30; i++)
{
_posibletables.Add(new ListPickerObject<int>() { DisplayValue = i.ToString(), Value = i });
}
}
return _posibletables;
}
set
{
_posibletables = value;
RaisePropertyChanged(() => PosibleTables);
}
}
public List<ListPickerObject<int>> SelectedValues
{
get
{
return _selectedValues;
}
set
{
_selectedValues = value; RaisePropertyChanged(() => SelectedValues);
}
}
public class ListPickerObject<T> : GalaSoft.MvvmLight.ViewModelBase
{
private bool _isSelected;
public string DisplayValue { get; set; }
public T Value { get; set; }
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
RaisePropertyChanged(() => IsSelected);
}
}
}
First I thought if my items object contained an IsSelected or even inherited from a base class like ListPickerItem the control would pass through to my object when I made a selection. Doesn't seem to.
Next I decided to try selectedValue as a two way binding back to a collection of the same objects. No luck here either. Here is the VM code.
The goal would be this
1.Display a list of values to choose from with multi-selection.
2.through data binding return the selected list to my vm.
<telerikInput:RadListPicker SelectedValue="{Binding SelectedValues,Mode=TwoWay, UpdateSourceTrigger=Default}" SelectedValuePath="Value" DisplayMemberPath="DisplayValue" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top" Width="300" SelectionMode="Multiple" ItemsSource="{Binding PosibleTables,Mode=TwoWay}"/>
private List<ListPickerObject<int>> _posibletables;
public List<ListPickerObject<int>> PosibleTables
{
get
{
if (_posibletables == null)
{
_posibletables = new List<ListPickerObject<int>>();
for (int i = 0; i <= 30; i++)
{
_posibletables.Add(new ListPickerObject<int>() { DisplayValue = i.ToString(), Value = i });
}
}
return _posibletables;
}
set
{
_posibletables = value;
RaisePropertyChanged(() => PosibleTables);
}
}
public List<ListPickerObject<int>> SelectedValues
{
get
{
return _selectedValues;
}
set
{
_selectedValues = value; RaisePropertyChanged(() => SelectedValues);
}
}
public class ListPickerObject<T> : GalaSoft.MvvmLight.ViewModelBase
{
private bool _isSelected;
public string DisplayValue { get; set; }
public T Value { get; set; }
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
RaisePropertyChanged(() => IsSelected);
}
}
}