Hello all,
I need to send ListView SelectedItems from view to ViewModel. now I have a code it is getting and sending single SelectedItem from view to ViewModel..
I tried few examples but I not getting required.
here is my ListView window.xaml:
<ListView x:Name="ParameterList" HorizontalAlignment="Stretch"
ItemsSource="{Binding Source={StaticResource SortedParameters}}"
SelectionMode="Multiple" SelectedItem="{Binding SelectedParameter}"
Grid.Row="1" Grid.Column="2"
Width="200">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Description}" Width="200"/>
</GridView>
</ListView.View>
</ListView>
The SelectedParameter addresses the ViewMode.cs:
private IParameter selectedParameter;
public IParameter SelectedParameter
{
get { return selectedParameter; }
set
{
selectedParameter = value;
OnPropertyChanged(nameof(SelectedParameter));
}
}
When user click the button in the Window.xmal:
<Button x:Name="plotGraph" Grid.Row="0" Content="Plot Graph" Padding="5" Margin="5"
HorizontalAlignment="Stretch" VerticalAlignment="Top"
Command="{Binding Plotgraph}"/>
Then, I need to Execute the method using those SelectedItems(Plotgraph.cs),
viewModel.GetParameterValues(viewModel.SelectedParameter.Name);
In ViewModel.cs
public Dictionary<int, double> GetParameterValues(string name)
{
return PlotParameter = Model.GetParameterValues(name);
}
Help me from this...
Thanks in advance..
What I have tried:
https://github.com/xamarin/recipes/tree/master/cross-platform/xamarin-forms/Controls/multiselect/Multiselect
http://thatcsharpguy.com/post/multiselect-listview-mvvm-en/
http://stackoverflow.com/questions/8460855/selecting-multiple-row-of-items-in-a-listview