Home Forums WPF controls Xceed Toolkit Plus for WPF What activates the LayoutUpdateStrategy?

3 sujets de 1 à 3 (sur un total de 3)
  • Auteur
  • Nasheayah
    Post count: 4
    #48222 |

    Looking over the Edi and AvalonDock.MVVMTestApp examples I’m not using the LayoutItemTemplateSelector and LayoutItemContainerStyleSelector. Are these needed to activate the LayoutUpdateStrategy event?

    I’m programmatically adding LayoutAnchorable’s to the AnchorablesSource= »{Binding Tools} » using Prism to Initialize the View:

    SqlCeOptionsView doc = ServiceLocator.Current.GetInstance<ISqlCeOptionsView>(layoutType.Item1) as SqlCeOptionsView;
    LayoutAnchorable layoutAnchorable = new LayoutAnchorable
    Content = doc,
    Title = layoutProperties.Title,
    IconSource = new BitmapImage(new Uri(@layoutProperties.IconSource)),
    CanClose = layoutProperties.CanClose


    But the BeforeInsertAnchorable event is not kicking.

    Diane [Xceed]
    Post count: 1353

    Hi Nasheayah,

    Are you referring to AvalonDock.MVVMTestApp that can be found here:

    If yes, I downloaded an ran that sample (making sure to reference the latest AvalonDock dll).

    No, using LayoutItemTemplateSelector or LayoutItemContainerStyleSelector are not needed to activate the LayoutUpdateStrategy event. Just make sure, like in the sample, that an avalonDock:DockingManager.LayoutUpdateStrategy is set.

    To test this sample:
    1) I put a breakpoint in LayoutInitializer.BeforeInsertAnchorable().
    2) I modified the Tools in Workspace to be an ObservableCollection<ToolViewModel> instead of a ToolViewModel[].
    3) I added a button in MainWindow.xaml where in its Button_click event, I did:

       var workspace = this.DataContext as Workspace;
       if( workspace != null )
          ToolViewModel t = new ToolViewModel( "ABC" );
          workspace.Tools.Add( t );

    Result: The breakpoint is hit when the button is clicked (when adding an item in Tools).

    Post count: 4

    Hi Diane,

    Thanks for the reply, I think I may have found the problem, but you can tell me if I’m correct or not. After looking over my XAML,

    <Metro:HamburgerMenu x:Name="ShellHamburgerMenu" Grid.Row="2"
    					 ContentTemplate="{StaticResource HamburgerContentTemplate}"
    					 prism:RegionManager.RegionName="{x:Static uiCommon:RegionNames.LayoutMainViewRegion}">

    The Template:

    <DataTemplate x:Key="HamburgerContentTemplate" DataType="{x:Type ModelType:HambgrMenuItemTS}">
    		<Metro:SplitView x:Name="OptionSplitview"
    					IsPaneOpen="{Binding Path=SelectedItem.IsPaneOpen, RelativeSource={RelativeSource AncestorType={x:Type Metro:HamburgerMenu}}}"
    			<xcad:DockingManager Grid.Row="2" x:Name="DockingManager" AllowMixedOrientation="True"
    								AnchorablesSource="{Binding Tools}" 
    								DocumentsSource="{Binding Files}"
    				 TextBlock.Foreground="{DynamicResource MaterialDesignBody}" Background="{DynamicResource MaterialDesignBackground}" Margin="5">
    				<xcad:LayoutRoot x:Name="_LayoutRoot">
    					<xcad:LayoutPanel x:Name="_RootPanel" Orientation="Horizontal">
    						<xcad:LayoutAnchorablePane x:Name="_LayoutAnchorablePane"/>
    						<xcad:LayoutDocumentPaneGroup >
    							<xcad:LayoutDocumentPane x:Name="_LayoutDocumentGroupPane"/>
    						<xcad:LayoutAnchorablePaneGroup DockWidth="125">
    						<xcad:LayoutAnchorSide x:Name="_LayoutAnchorableSideLeft">
    							<xcad:LayoutAnchorGroup x:Name="_LayoutAnchorableGroupLeft"/>
    						<xcad:LayoutAnchorSide x:Name="_LayoutAnchorableSideRight" >
    							<xcad:LayoutAnchorGroup  x:Name="_LayoutAnchorableGroupRight"/>
    						<xcad:LayoutAnchorSide x:Name="_LayoutAnchorableSideBottom">
    							<xcad:LayoutAnchorGroup  x:Name="_LayoutAnchorableGroupBottom"/>

    I decided to take the DockingManager out of the ContentTemplate | DataTemplate, created another View, put it into a Metro:SplitView without a Template just to see what happens and it worked. So, I’m assuming the DataTemplate had some effect, because when I Step Debugged, I found my defined LayoutRoot Children where missing.

3 sujets de 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.