I have control where I bind the images. The code in my view model looks as following:
public List<IDocument> SelectedEventPhotoList
{
get { return _selectedEventPhotoList; }
set
{
if (Equals(value, _selectedEventPhotoList))
return;
_selectedEventPhotoList = value;
RaisePropertyChanged(() => SelectedEventPhotoList);
}
}
public IDocument SelectedEventPhoto
{
get { return _selectedEventPhoto; }
set
{
if (Equals(value, _selectedEventPhoto))
return;
_selectedEventPhoto = value;
RaisePropertyChanged(() => SelectedEventPhoto);
}
}
The binding looks as following:
<ListView Grid.Row="0"
ItemsSource="{Binding SelectedEventPhotoList, Converter={StaticResource PathToFileConverter}}"
SelectedItem="{Binding SelectedEventPhoto}"
As you can see I have a list of IDocument types to bind to ItemsSource and SelectedItem is of IDocument type. But, images have Source property that is of type string and I've used PathToFileConverter value converter to convert IDocument types to strings.
The issue is in fact that after using converter, SelectedItem is null.
How can I achieve the SelectedItem keeps IDocument type, which is not null?