1

我想绑定ContentTemplatePropertyContentPresenter

<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}"/>

视图模型:

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 类中的 ExtraConsole 、 ViewModel 和 DataContext 的值通知为更改,但我更改ExtraConsole.DataTemplateNotify及其Property Changed

但没有发生任何变化UI

有什么建议么?

4

0 回答 0