here is your configurations class..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dispacher
{
public class Configurations
{
public String Name { get; set; }
public string PropA { get; set; }
public string PropB { get; set; }
}
}
Here is your ViewModel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Input;
using System.Windows;
using System.Diagnostics;
using System.ComponentModel;
namespace Dispacher
{
public class DisplayViewModel
{
public ObservableCollection<configurations> SelectedPeople { get; private set; }
public List<configurations> AvailablePeople { get; private set; }
public DelegateCommand Submitcommand { get; private set; }
public string OutPut { get; set; }
public DisplayViewModel()
{
AvailablePeople = new List<configurations> {
new Configurations { Name="Basavraj", PropA = "John", PropB = "Doe" },
new Configurations {Name="Mallikarjun", PropA = "Michael", PropB = "Jones" },
new Configurations {Name="Swami", PropA = "Jane", PropB = "Smith" }, };
Submitcommand = new DelegateCommand(modifiedData);
}
private void modifiedData()
{
Predicate<configurations> pred = item => item.PropA != "John" || item.PropA != "Michael" || item.PropA != "Jane";
var modifieddata = AvailablePeople.Find(pred);
if (modifieddata != null)
OutPut = "PropA :=" + modifieddata.PropA + ",PropB :=" + modifieddata.PropB;
}
public class DelegateCommand : ICommand
{
private Action _executeMethod;
public DelegateCommand(Action executeMethod)
{
_executeMethod = executeMethod;
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
_executeMethod.Invoke();
}
}
}
}
</configurations></configurations></configurations></configurations>
here is your view
<window x:class="Dispacher.Window1" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Sample="clr-namespace:Dispacher"
Title="Window1" Height="500" Width="500">
<window.resources>
<objectdataprovider>
x:Key="Viewmodel"
ObjectType="{x:Type Sample:DisplayViewModel}"/>
</objectdataprovider></window.resources>
<grid>
<dockpanel datacontext="{StaticResource Viewmodel}">
<listbox name="list" dockpanel.dock="Left" width="130">
ItemsSource="{Binding AvailablePeople}"
DisplayMemberPath="Name"
SelectedValuePath="ListBox"/>
<textbox text="{Binding ElementName=list, Path=SelectedItem.PropA}" height="50" width="100" />
<textbox text="{Binding ElementName=list, Path=SelectedItem.PropB}" height="50" width="100" />
<button width="20" height="50">
Command="{Binding Submitcommand}"
CommandParameter="{Binding AvailablePeople, ElementName=list}"
Content=">>"/>
</button></listbox></dockpanel>
</grid>
</window>
Please mark accepted if got solution