Show Contents of ContentControl from Base Class

Topics: Extensibility, UI Architecture
Jan 18, 2013 at 8:21 PM
Edited Jan 18, 2013 at 8:25 PM

Edit: Please disregard this post.  I acidently had the wrong view named GenericDialogView.



I have created a GenericDialogView and ViewModel:


<Window   x:Class="InspectUs.WPF.Views.BuildingDialogView"
          Height="177" Width="320" Title="Edit Building" ShowInTaskbar="False" ResizeMode="NoResize">
    <Grid Margin="4">

            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>

        <ContentControl x:Name="DialogContentsViewModel"/>

        <StackPanel x:Name="Buttons" Grid.ColumnSpan="6" Grid.Row="1" Orientation="Horizontal" Margin="8" HorizontalAlignment="Right">
            <Button x:Name="Ok" Content="OK" Margin="0,0,4,0" Width="50" IsDefault="True"/>
            <Button x:Name="Cancel" Content="Cancel" Margin="4,0,0,0" Width="50" IsCancel="True"/>

    public abstract class GenericDialogViewModel<T> : Screen
        private T dialogContentsViewModel;

        public T DialogContentsViewModel {
            get { return dialogContentsViewModel; }
            private set
                dialogContentsViewModel = value;
                NotifyOfPropertyChange(() => DialogContentsViewModel);

        public void SetContentsViewModel(T viewModel)
            DialogContentsViewModel = viewModel;

        public abstract void Ok();

        public virtual void Cancel()



I modified the ViewLocator to show the view associated with the base class of my ViewModel and that is working.  My problem is that when I call SetContentsViewModel on the child ViewModel I am not seeing the contents shown in the view during program execution.


Does anyone have any thoughts?