Hi everybody,
I'm encoutering a problem with my C# app. My example is simplified to be easier to explain...
I have two ObservableCollection of a custom class that I call MyCustomClass:
public class MyCustomClass
{
public static ObservableCollection<MyCustomClass> FullList { get; set; }
string Name { get; set;
}MyCustomClass.FullList = new ObservableCollection<MyCustomClass>; var EffectiveList = new ObservableCollection<MyCustomClass>;
In a WPF Window, I have the following ListView :
<ListView x:Name="lsvwRoles"><ListView.ItemTemplate><DataTemplate><CheckBox Content={Binding Path=Name}/></DataTemplate></ListView.ItemTemplate><ListView.ItemsPanel><ItemsPanelTemplate><WrapPanel Orientation="Vertical"/></ItemsPanelTemplate></ListView.ItemsPanel></ListView></DockPanel>
I have functions to populate these 2 collections. I would like :
- using the static property FullList as source for the list view
- the CheckBox to be checked if the item exists in the collection EffectiveList / unchecked if it does not exist in it
- MyCustomClass to be added to EffectiveList if the CheckBoxis checked from the UI
- MyCustomClass to be removed from EffectiveList if the CheckBoxis unchecked from the UI.
To resume, I would like to have all items of the collection FullList in my ListView and sync the CheckBox with EffectiveList (true if the item exists, false if it does not exists).
How could I achieve my objectives ?
Thanks in advance for all your help.
Have a nice day :)