Im having a wierd problem with a WPF (+CaliburnMicro) listBox as defined below
<GroupBox Header="Configurations" Width="Auto" Grid.Row="1" Grid.Column="2">
<ListBox ItemsSource="{Binding SelectableConfigurations}" BorderThickness="0" Width="Auto">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Path=Name}" IsChecked="{Binding Path=IsSelected}" Margin="15,3" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
</GroupBox>
It appears that when i select an item in the list it modifies the item in the bound list but not in other places the item is referenced. IE the below code updates the item in the _selectableConfigurations list but not the original object as attached to the _sc list.
It appears that when the property was modified the original object was replaced in the list rather than simply updated. Is this the case?
private readonly List<SelectableConfiguration> _selectableConfigurations;
private ISelectableConfigurations _sc;
public ConfigurationTabViewModel(
ISelectableConfigurations configurations)
{
_sc = configurations;
_selectableConfigurations = configurations.SelectableConfigurations.ToList();
}
public List<SelectableConfiguration> SelectableConfigurations
{
get { return _selectableConfigurations; }
}
EDIT
public class SelectableConfiguration
{
public bool IsSelected { get; set; }
public string Name { get; set; }
public IRunableOrmConfiguration Configuration { get; set; }
}