PRISM 4, MEF, Docking

2 posts, 0 answers
  1. Ubuntu
    Ubuntu avatar
    89 posts
    Member since:
    Jul 2012

    Posted 19 Nov 2011 Link to this post

    Dear all,

    I have a simple requirement which is to have two panes (in one of my pages) within the dock control.
    I end up searching for a solution because the initial one didn't work:

    Initial Solution:
    =============================================
    XAML Layout of the main page holding the other two views:
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <telerik:RadDocking x:Name="designdock" Grid.Row="1" Background="Black" BorderBrush="Black">
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer x:Name="desginspliter" Orientation="Vertical">
                    <telerik:RadPaneGroup x:Name="unpostedRegion"
                        <telerik:RadPane prism:RegionManager.RegionName="DailyUnPostedRegion"  
                          </telerik:RadPane>
           </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup >
                        <telerik:RadPane x:Name="buttompane">
                            <ContentControl prism:RegionManager.RegionName="DailyPostedRegion" />
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
        </telerik:RadDocking>
          
    </Grid>

    But that didn't make the views (UserControls) load or appear ...

    Current Solution:
    ==============================================
    XAML layout of the main page holding the other two views:

    <telerik:RadDocking x:Name="designdock" Grid.Row="1" Background="Black" BorderBrush="Black">
        <telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer x:Name="desginspliter" Orientation="Vertical">
                <telerik:RadPaneGroup x:Name="unpostedRegion"
                        prism:RegionManager.RegionName="DailyUnPostedRegion"  
                        prism:RegionManager.RegionManager="{Binding Path=RegionManager}">
          </telerik:RadPaneGroup>
                <telerik:RadPaneGroup x:Name="postedRegion"
                        prism:RegionManager.RegionName="DailyPostedRegion"  
                        prism:RegionManager.RegionManager="{Binding Path=RegionManager}">
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>

    Shell Configuration of RegionAdapter:
    protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
    {
        var mapping = base.ConfigureRegionAdapterMappings();
        mapping.RegisterMapping(typeof(RadPaneGroup), this.Container.GetExportedValue<RadPaneGroupRegionAdapter>());
        return mapping;
    }

    The two views are inheriting the RadPane and displayed from the main page using the RegionManager.RequestNavigate method.

    When I run the application I got two panes loaded.
    Problem:
    1- If I try to move them around I got the error.
    Webpage error details
      
    Message: Unhandled Error in Silverlight Application 
    Code: 4004    
    Category: ManagedRuntimeError       
    Message: System.ArgumentNullException: Value cannot be null.
    Parameter name: element
       at Telerik.Windows.ArgumentVerificationExtensions.TestNotNull(Object parameter, String parameterName)
       at Telerik.Windows.Controls.ParentOfTypeExtensions.IsAncestorOf(DependencyObject element, DependencyObject descendant)
       at Telerik.Windows.Controls.Docking.FocusHelper.HasFocus(UIElement target)
       at Telerik.Windows.Controls.RadDocking.SelectActivePane(RadPane radPane)
       at Telerik.Windows.Controls.Docking.PaneGroupBase.OnGotFocus(RoutedEventArgs e)
       at System.Windows.Controls.Control.OnGotFocus(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)     

    2- If I try to navigate within the same region of any I got an error in the Rest() method of the RegionAdaptor "error of invocation ..."

    What did I miss here ...
    Regards
  2. Ubuntu
    Ubuntu avatar
    89 posts
    Member since:
    Jul 2012

    Posted 21 Nov 2011 Link to this post

    Dear all,

    I managed to get it to work, but not as expected !!
    Whenever I try to navigate from the main view to the detailed one, I got a new pane(or group pane, I am not sure) created !!

    I have two ways to go, I need help on this
    ===============================
    1st way: Keep the current behavior
    But I need two things here:
     1- Bind the created pane header to my viewmodel property.
     2- Be aware when the pane get closed so I can check the changes to submit/cancel changes.

    2nd way: Revert to static state
    In which I have a pane and prism region inside, and be able to navigate like the old way from usercontrol to another

    Any thoughts
  3. DevCraft banner
Back to Top