Here is pseudo code for what I want to implement in xaml
IF vm.AvatarFilePath IS NOT NULL THEN
Image.Source = {Binding AvatarPath}
ELSE
If vm.Gender == {
You should be able to do this with a couple of MultiDataTriggers:
These are stating 'when AvatarPath
is null AND Gender
is female...'
Further Improvement
As DataTrigger
s are applied in the order in which they appear in the XAML, we can remove the need for duplication of the 'Male' settings in the example with the below:
Here we are saying:
AvatarPath
AvatarPath
is null, set the source to 'Img_Male'AvatarPath
is null AND the Gender
is female, set the source to 'Img_Female'