我想绑定ContentTemplateProperty
的{{1}}:
ContentPresenter
视图模型:
<UserControl x:Class="MVVM.WPF.View.ControlViews.ParametersControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
<ContentPresenter Grid.Row="2" Grid.ColumnSpan="3"
Content="{Binding ExtraConsole.ViewModel, UpdateSourceTrigger=PropertyChanged}"
ContentTemplate="{Binding Source=ExtraConsole.DataTemplate, UpdateSourceTrigger=PropertyChanged}"/>
所有其他绑定控件更新正确,ExtraConsole类中的ExtraConsole,ViewModel和DataContext的值通知为更改但是
我更改了public class ParametersGenericViewModel : ParametersViewModel
{
public ParametersGenericViewModel()
{
DataTemplate = (DataTemplate)new ResourceDictionary { Source = new Uri(DataTemplateAddresses.Parameters, UriKind.Absolute) }[DataTemplateKeys.Parameters];
}
ParametersConsole extraConsole;
public ParametersConsole ExtraConsole
{
get { return extraConsole; }
set
{
extraConsole = value;
RaisePropertyChanged("ExtraConsole");
}
}
和ExtraConsole.DataTemplate
Notify
但Property Changed
没有发生任何变化。
有什么建议吗?