I have a control and inside this control I have a resource with tempalte data:
<DataTemplate DataType="{x:Type local:FlowModel}"> <Image Source="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type vm:MainViewModel}}, Path=MainViewModel.ImagePath}"/> </DataTemplate> xmlns:vm="clr-namespace:CortexMonitoringTool.ViewModel"
I have vm installed in my ViewModel folder, I implement mvvm. I can't get my binding to work, and I'm not sure why not.
Can someone tell me if my relative binding is true if it can really see my ImagePath property in my MainViewModel class?
public String ImagePath { get { return _imagePath; } set { if (_imagePath == value) { return; } _imagePath = value; RaisePropertyChanged("ImagePath"); } }
Thanks.
user101010101
source share