My DataGrid's SelectedItem is bound to the property below.
public OrderItemViewModel SelectedItem
{
get { return _selectedItem; }
set
{
if (_selectedItem != value)
{
_selectedItem = value;
OnPropertyChanged(() => SelectedItem);
if (_selectedItem != null && _isReturnMode)
{
if (_selectedItem.OrderItemModel.ProductDetails.IsConstructed)
{
VisiblePaymentViewModel = new ViewReturnComponentsViewModel(this, value.OrderItemModel.ProductDetails);
}
else
{
VisiblePaymentViewModel = new EditReturnItemViewModel(this, value);
}
SelectedItem = null;
}
}
}
}
The DataGrid's ItemsSource is bound to
public ICollectionView VisibleOrderItems { get; set; }
The reason why I want to reset the SelectedItem in the program, is because this is a touch screen application, and when they select the item, I want it to change the View, then when when they get back to the View with the datagrid I do not want an item to be selected.
I've tried creating a separate function that just clears out the SelectedItem, and calling that when the separate View is finished, and also tried variuous binding settings.... UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, IsSynchronizedWithCurrentItem
Can't wrap my head around why this doesn't work.
The DataGrid shows the row as highlighted, but when I click on that row it sets _selectedItem (_selectedItem != value
)