Hello,
I have bound a Picker SelectedIndex to a public property of the ViewModel.
But when the user wants to edit an item of the model, he opens the page. Then I have to set the picker SelectedIndex to the value of the property of the item edited.
So I need to prevent the property to be modified by the Picker.
This is how I do. Is it the good way?
private bool getPickerStarsSelectedIndex = false;
public int PickerStarsSelectedIndex
{
get
{
getPickerStarsSelectedIndex = true;
if (_currentSight.StarID > 0)
return convertStarIDtoPickerStarsSelectedIndex(_currentSight.StarID);
else
return 0;
}
set
{
if (getPickerStarsSelectedIndex)
getPickerStarsSelectedIndex = false;
else
_currentSight.StarID = convertPickerStarsSelectedIndexToStarID(value);
}
}