コントロールがあり、そのコントロール内にデータ テンプレートを持つリソースがあります。
<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"
ViewModel フォルダーに vm を設定しました。mvvm を実装しています。バインディングを機能させることができず、その理由がわかりません。
私のMainViewModelクラスで私のプロパティ「ImagePath」を実際に見ることができる場合、私の相対バインディングが正しいかどうか教えてもらえますか?
public String ImagePath
{
get
{
return _imagePath;
}
set
{
if (_imagePath == value)
{
return;
}
_imagePath = value;
RaisePropertyChanged("ImagePath");
}
}
ありがとうございました。