public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorable, ILayoutContainer destination) { LayoutAnchorablePane pane = destination as LayoutAnchorablePane; if (destination != null && destination.FindParent <LayoutFloatingWindow>() != null) { return(false); } LayoutAnchorablePane files = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "pnFiles"); if (files != null) { files.Children.Add(anchorable); return(true); } return(false); }
/// <summary> /// Method inits collection. /// </summary> private void _InitDataGridCollection() { try { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); _collectionSource.Source = _GetSortedCollection(); ((INotifyCollectionChanged)XceedGrid.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(ZonesPage_CollectionChanged); _isDataGridCollectionInited = true; XceedGrid.SelectedItems.Clear(); } catch (Exception ex) { Logger.Info(ex); } }
/// <summary> /// Method inits collection. /// </summary> private void _InitCollection() { try { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); IList <Barrier> sortedBarriersCollection = _GetSortedCollection(); _collectionSource.Source = sortedBarriersCollection; ((INotifyCollectionChanged)XceedGrid.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(_BarriersPageCollectionChanged); _isDataGridCollectionInited = true; } catch (Exception ex) { Logger.Info(ex); } }
protected override Size ArrangeOverride(Size finalSize) { if (LayoutRoot != null) { Size desiredSize = LayoutRoot.DesiredSize; Size scaleSize = CalculateScaleSize(finalSize, desiredSize); _layoutRootScale.ScaleX = scaleSize.Width; _layoutRootScale.ScaleY = scaleSize.Height; var originalPosition = new Rect(0, 0, desiredSize.Width, desiredSize.Height); LayoutRoot.Arrange(originalPosition); finalSize.Width = scaleSize.Width * desiredSize.Width; finalSize.Height = scaleSize.Height * desiredSize.Height; } return(finalSize); }
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { if (destinationContainer != null && destinationContainer.FindParent <LayoutFloatingWindow>() != null) { return(false); } var toolsPane = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "ToolsPane"); if (toolsPane != null) { toolsPane.Children.Add(anchorableToShow); return(true); } return(false); }
void IModalService.GoBackward(bool dialogReturnValue) { DoubleAnimation da = new DoubleAnimation(1, TimeSpan.FromMilliseconds(400).Duration()); LayoutRoot.BeginAnimation(Grid.OpacityProperty, da); LayoutRoot.IsHitTestVisible = true; // modalGrid.Children.RemoveAt(modalGrid.Children.Count - 1); //UIElement element = modalGrid.Children[modalGrid.Children.Count - 1]; //element.IsEnabled = true; BackNavigationEventHandler handler = _backFunctions.Pop(); if (handler != null) { handler(dialogReturnValue); } }
private static LayoutAnchorablePane CreateAnchorablePane(LayoutRoot layout, Orientation orientation, string paneName, InsertPosition position) { var parent = layout.Descendents().OfType <LayoutPanel>().First(d => d.Orientation == orientation); var toolsPane = new LayoutAnchorablePane { Name = paneName }; if (position == InsertPosition.Start) { parent.InsertChildAt(0, toolsPane); } else { parent.Children.Add(toolsPane); } return(toolsPane); }
/// <summary> /// Loads grid layout. /// </summary> private void _InitDataGridLayout() { if (_collectionSource == null) { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); } GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.ZonesGridStructure); structureInitializer.BuildGridStructure(_collectionSource, XceedGrid); // Load grid layout. GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.ZonesSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(XceedGrid); _isDataGridLayoutLoaded = true; }
public override void DisableBindings() { var root = Model.Root; if (root != null) { LayoutRoot layoutRoot = root as LayoutRoot; if (layoutRoot != null) { layoutRoot.Updated -= OnRootUpdated; } } BindingOperations.ClearBinding(_model, VisibilityProperty); _model.PropertyChanged -= _model_PropertyChanged; base.DisableBindings(); }
internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model, bool isContentImmutable) : base(model, isContentImmutable) { _model = model; HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); CloseWindowCommand = new RelayCommand((p) => OnExecuteCloseWindowCommand(p), (p) => CanExecuteCloseWindowCommand(p)); Activated += LayoutAnchorableFloatingWindowControl_Activated; UpdateThemeResources(); MinWidth = _model.RootPanel.CalculatedDockMinWidth(); MinHeight = _model.RootPanel.CalculatedDockMinHeight(); LayoutRoot root = _model.Root as LayoutRoot; if (root != null) { root.Updated += OnRootUpdated; } }
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { //AD wants to add the anchorable into destinationContainer //just for test provide a new anchorablepane //if the pane is floating let the manager go ahead if (destinationContainer != null && destinationContainer.FindParent <LayoutFloatingWindow>() != null) { return(false); } if (anchorableToShow.Content is IAnchorableWindow) { string paneToSearch = ""; switch ((anchorableToShow.Content as IAnchorableWindow).AnchorableDefaultPlacementEnum) { case PlacementEnum.Top: break; case PlacementEnum.Left: paneToSearch = "LeftAnchorablePane"; break; case PlacementEnum.Right: break; case PlacementEnum.Bottom: paneToSearch = "BottomAnchorablePane"; break; default: throw new ArgumentOutOfRangeException(); } var anchorablePaneToAddChild = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == paneToSearch); if (anchorablePaneToAddChild != null) { anchorablePaneToAddChild.Children.Add(anchorableToShow); return(true); } } return(false); }
private void updateScore(Object sender, RoutedEventArgs e) { TextBox usernameInput = (TextBox)LayoutRoot.FindName("Username"); String newUsername = api.LatestHighscore.username; if (usernameInput.Text != "Enter your username!") { newUsername = usernameInput.Text; } api.LatestHighscore.username = newUsername; Action cb = () => { NavigationService.Navigate(new Uri("/HighscorePage.xaml", UriKind.Relative)); NavigationService.RemoveBackEntry(); }; api.updateScore(newUsername, cb); }
/// <summary> /// /// </summary> /// <param name="layout"></param> /// <param name="anchorableToShow">配置されようとしている LayoutAnchorable</param> /// <param name="destinationContainer"></param> /// <returns></returns> public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { LayoutAnchorablePane destPane = destinationContainer as LayoutAnchorablePane; if (destinationContainer != null && destinationContainer.FindParent <LayoutFloatingWindow>() != null) { return(false); } var viewModel = anchorableToShow.Content; if (viewModel == null) { return(false); } var propInfo = viewModel.GetType().GetProperty("ContentId", BindingFlags.Public | BindingFlags.Instance); if (propInfo == null) { return(false); } var contentId = (string)propInfo.GetValue(viewModel); var target = Items.Find((t) => t.ContentId == contentId); if (target == null) { return(false); } // 選択した名前の領域を取得し、そこにドッキングウィンドウを追加する var pane = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == target.TargetLayoutName); if (pane != null) { pane.Children.Add(anchorableToShow); return(true); } return(false); }
public void SetViewModel(MessageBoxViewModel viewModel) { if (viewModel != null) { LayoutRoot.SetBinding(FrameworkElement.DataContextProperty, new Binding() { Source = ViewModel }); switch (viewModel.Buttons) { case MessageBoxWindowButtons.OK: btnOK.Visibility = System.Windows.Visibility.Visible; btnYes.Visibility = System.Windows.Visibility.Collapsed; btnNo.Visibility = System.Windows.Visibility.Collapsed; btnCancel.Visibility = System.Windows.Visibility.Collapsed; break; case MessageBoxWindowButtons.OKCancel: btnOK.Visibility = System.Windows.Visibility.Visible; btnYes.Visibility = System.Windows.Visibility.Collapsed; btnNo.Visibility = System.Windows.Visibility.Collapsed; btnCancel.Visibility = System.Windows.Visibility.Visible; break; case MessageBoxWindowButtons.YesNo: btnOK.Visibility = System.Windows.Visibility.Collapsed; btnYes.Visibility = System.Windows.Visibility.Visible; btnNo.Visibility = System.Windows.Visibility.Visible; btnCancel.Visibility = System.Windows.Visibility.Collapsed; break; case MessageBoxWindowButtons.YesNoCancel: btnOK.Visibility = System.Windows.Visibility.Collapsed; btnYes.Visibility = System.Windows.Visibility.Visible; btnNo.Visibility = System.Windows.Visibility.Visible; btnCancel.Visibility = System.Windows.Visibility.Visible; break; default: break; } } }
public void Run() { var app = new ThemedApp { ShutdownMode = ShutdownMode.OnMainWindowClose }; app.Startup += (s, e) => { Window window; try { if (layoutSetting.XamlString.Value.IsNullOrEmpty()) { LayoutFallback(); } else { layout = (LayoutRoot)XamlReader.Parse(layoutSetting.XamlString.Value); } } catch { LayoutFallback(); } window = new MainWindow { MainContent = layout.MainWindow.LoadContent() }; InitWindow(window); Application.Current.MainWindow = window; window.Show(); void LayoutFallback() { layout = (LayoutRoot)Application.LoadComponent(new Uri("/Sakuno.ING.Shell.Desktop;component/Layout/Default.xaml", UriKind.Relative)); } }; app.Run(); }
private static LayoutAnchorGroup FindAnchorableGroup(LayoutRoot layout, PaneLocation location) { try { LayoutAnchorSide panelGroupParent; switch (location) { case PaneLocation.Left: panelGroupParent = layout.LeftSide; break; case PaneLocation.Right: panelGroupParent = layout.RightSide; break; case PaneLocation.Bottom: panelGroupParent = layout.BottomSide; break; default: throw new ArgumentOutOfRangeException("location:" + location); } if (panelGroupParent.Children.Count == 0) { var layoutAnchorGroup = new LayoutAnchorGroup(); panelGroupParent.Children.Add(layoutAnchorGroup); return(layoutAnchorGroup); } return(panelGroupParent.Children[0]); } catch (Exception exp) { Logger.Error(exp); } return(null); }
public void Run() { InitWindow(); UIElement main; try { string layoutString = layoutSetting.XamlString.Value; layoutFactory = () => (LayoutRoot)XamlReader.Load(layoutString); var layout = layoutFactory(); main = new MainView { MainContent = layout.MainWindow.LoadContent() }; viewIds = layout.SubWindows.Select(x => x.Id).Append("Settings").ToArray(); } catch { layoutFactory = () => { var l = new LayoutRoot(); Application.LoadComponent(l, new Uri("ms-appx:///Layout/Default.xaml")); return(l); }; var layout = layoutFactory(); main = new MainView { MainContent = layout.MainWindow.LoadContent() }; viewIds = layout.SubWindows.Select(x => x.Id).Append("Settings").ToArray(); } new UISettings().ColorValuesChanged += async(sender, _) => { foreach (var view in CoreApplication.Views) { await view.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => ApplicationView.GetForCurrentView().TitleBar.ButtonForegroundColor = sender.GetColorValue(UIColorType.Foreground)); } }; Window.Current.Content = main; gameProvider.Enabled = true; }
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { //AD wants to add the anchorable into destinationContainer, just for test provide a new anchorable pane //if the pane is floating let the manager go ahead //var destPane = destinationContainer as LayoutAnchorablePane; if (destinationContainer != null && destinationContainer.FindParent <LayoutFloatingWindow>() != null) { return(false); } var toolViewModel = anchorableToShow.Content as IToolViewModel; if (toolViewModel != null) { var preferredLocation = toolViewModel.PreferredLocation; string paneName = preferredLocation.ToString(); var toolsPane = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(d => d.Name == paneName); if (toolsPane == null) { switch (preferredLocation) { case ToolPaneLocation.Left: toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.Start); break; case ToolPaneLocation.Right: toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.End); break; case ToolPaneLocation.Bottom: toolsPane = CreateAnchorablePane(layout, Orientation.Vertical, paneName, InsertPosition.End); break; default: throw new ArgumentOutOfRangeException(); } } toolsPane.Children.Add(anchorableToShow); return(true); } return(false); }
private static LayoutAnchorablePane CreateAnchorablePane(LayoutRoot layout, Orientation orientation, string paneName, InsertPosition position) { var parent = layout.Descendents().OfType <LayoutPanel>().First(d => d.Orientation == orientation); //if (parent == null) //{ // switch (orientation) // { // case Orientation.Horizontal: // var hpl = new LayoutPanel() { Orientation = Orientation.Horizontal }; // System.Diagnostics.Debug.Assert(layout.RootPanel.Orientation == Orientation.Vertical); // layout.RootPanel.InsertChildAt(0, hpl); // break; // case Orientation.Vertical: // //var hp = layout.Descendents().OfType<LayoutPanel>().FirstOrDefault(d => d.Orientation == Orientation.Horizontal); // //if (hp == null) // //{ // var hp = new LayoutPanel() { Orientation = Orientation.Horizontal }; // hp.InsertChildAt(0, new LayoutDocumentPaneGroup(new LayoutDocumentPane())); // //} // layout.RootPanel = new LayoutPanel(hp) { Orientation = Orientation.Vertical }; // parent = layout.RootPanel; // break; // default: // break; // } //} var toolsPane = new LayoutAnchorablePane { Name = paneName }; if (position == InsertPosition.Start) { parent.InsertChildAt(0, toolsPane); } else { parent.Children.Add(toolsPane); } return(toolsPane); }
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { LayoutAnchorablePane pane = null; if (anchorableToShow.Content is DebugLogViewModel) { pane = layout.Descendents().OfType <LayoutAnchorablePane>() .FirstOrDefault(d => d.Name == "bottom"); } if (pane != null) { //anchorableToShow.CanHide = false; anchorableToShow.CanClose = false; pane.Children.Add(anchorableToShow); return(true); } return(false); }
/// <summary> /// In order to ripple the value up we claculate the time /// to on for each block /// </summary> private void SetTimerDelay() { for (int i = 0; i < NumberOfLeds; i++) { this.SetLedColours(i); double time = ((double)NumberOfLeds - i) / (double)NumberOfLeds; int endMs = (int)(100 * time); int startMs = (int)(100 * (time - (1 / (double)NumberOfLeds))); SplineColorKeyFrame start = LayoutRoot.FindName("_startColour" + i) as SplineColorKeyFrame; SplineColorKeyFrame end = LayoutRoot.FindName("_endColour" + i) as SplineColorKeyFrame; if (end != null && start != null) { start.SetValue(SplineColorKeyFrame.KeyTimeProperty, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, startMs))); end.SetValue(SplineColorKeyFrame.KeyTimeProperty, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, endMs))); } } }
/// <summary> /// Method inits collection of projects. /// </summary> private void _InitProjectsCollection() { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource("projectSource"); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.ProjectsGridStructure); structureInitializer.BuildGridStructure(_collectionSource, XceedGrid); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellEditor = (CellEditor)LayoutRoot.FindResource("ProjectsRadioButtonEditor"); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellContentTemplate = (DataTemplate)LayoutRoot.FindResource("RadioButtonTemplate"); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellEditorDisplayConditions = CellEditorDisplayConditions.Always; XceedGrid.Columns[NAME_COLUMN_CAPTION].CellValidationRules.Add(new ProjectNameValidationRule()); _BuildProjectsWrapperCollection(); _UpdateProjectsCheckboxes(); _collectionSource.Source = _projectsDataCollection; _isInited = true; }
//Sua cau sai public void FixWrongSentences() { SentenceCorrectionControl item; for (int i = 0; i < qclItems.Count; ++i) { item = qclItems[i]; //Neu tra loi sai if (item.IsCorrectSelection() == false) { clWrong = Colors.Red; item.Fix(); item.Background = new SolidColorBrush(clWrong); item.Foreground = new SolidColorBrush(clWrong); item.UpdateLayout(); } } LayoutRoot.UpdateLayout(); }
/// <summary> /// Obtiene uno de los elementos laterales del gestor de ventanas /// </summary> private LayoutAnchorSide GetAnchorSide(LayoutRoot layoutRoot, SystemControllerEnums.DockPosition position) { switch (position) { case SystemControllerEnums.DockPosition.Right: return(layoutRoot.RightSide); case SystemControllerEnums.DockPosition.Left: return(layoutRoot.LeftSide); case SystemControllerEnums.DockPosition.Top: return(layoutRoot.TopSide); case SystemControllerEnums.DockPosition.Bottomm: return(layoutRoot.BottomSide); default: throw new NotImplementedException("Posición desconocida"); } }
/// <summary> /// Update your text colors to that of the TextColor dependancy property /// </summary> protected override void UpdateTextColor() { _delegate.ValueTextColor = ValueTextColor; for (int i = 0; i < 10; i++) { TextBlock tb = LayoutRoot.FindName("_tl" + i) as TextBlock; if (tb != null) { tb.Foreground = new SolidColorBrush(FaceTextColor); } tb = LayoutRoot.FindName("_tr" + i) as TextBlock; if (tb != null) { tb.Foreground = new SolidColorBrush(FaceTextColor); } } }
private void Button1_Click(System.Object sender, System.Windows.RoutedEventArgs e) { Button1.IsEnabled = false; RadioButton radio = default(RadioButton); int rating = 0; for (int n = 0; n <= 10; n++) { radio = (RadioButton)LayoutRoot.FindName("rd" + n); if ((bool)radio.IsChecked) { rating = n; break; // TODO: might not be correct. Was : Exit For } } sqlCli.rateCompleted += rating_Result; sqlCli.rateAsync(M.username, M.opponent, rating); }
private void Link6_Click(object sender, RoutedEventArgs e) { if (floatChatReal == null) { initializeFloatChat(); } else if (M.sock.isConnected == false) { lstOnlineUsers.Items.Clear(); startConnections(); } else { floatChatReal.Position = new Point(200, 200); } LayoutRoot.Add(floatChatReal); floatChatReal.Show(); imgBubble.Visibility = System.Windows.Visibility.Collapsed; }
private LayoutAnchorSide GetAnchorSide(RDocumentData.ToolsDockPosition pos, LayoutRoot root) { switch (pos) { case RDocumentData.ToolsDockPosition.Top: return(root.TopSide); case RDocumentData.ToolsDockPosition.Bottom: return(root.BottomSide); case RDocumentData.ToolsDockPosition.Left: return(root.LeftSide); case RDocumentData.ToolsDockPosition.Right: return(root.RightSide); default: return(null); } }
/// <summary> /// Method is called when a completely new layout item is /// to be inserted into the current avalondock layout. /// </summary> /// <param name="layout"></param> /// <param name="anchorableToShow"></param> /// <param name="destinationContainer"></param> /// <returns></returns> public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { if (anchorableToShow.Content is IToolWindow) { IToolWindow tool = anchorableToShow.Content as IToolWindow; var preferredLocation = tool.PreferredLocation; LayoutAnchorGroup layoutGroup = null; switch (preferredLocation) { case PaneLocation.Left: layoutGroup = FindAnchorableGroup(layout, preferredLocation); break; case PaneLocation.Right: layoutGroup = FindAnchorableGroup(layout, preferredLocation); break; case PaneLocation.Bottom: layoutGroup = FindAnchorableGroup(layout, preferredLocation); break; default: throw new ArgumentOutOfRangeException(); } if (layoutGroup != null) { ////group.InsertChildAt(0, anchorableToShow); layoutGroup.Children.Add(anchorableToShow); } return(true); } return(false); }
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) { // Left Side Anchorables var leftSide = layout.RightSide.Descendents().OfType <LayoutAnchorGroup>().FirstOrDefault(); //var leftSide = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(x => x.Name == "leftPane"); if (leftSide != null && (anchorableToShow.Content is CommandsListViewModel || anchorableToShow.Content is WorkflowListViewModel)) { anchorableToShow.AutoHideWidth = 200; leftSide.InsertChildAt(0, anchorableToShow); return(true); } // Right Side Anchorables var rightSide = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(x => x.Name == "rightPane"); //var rightSide = layout.RightSide.Descendents().OfType<LayoutAnchorGroup>().FirstOrDefault(); if (rightSide != null && (anchorableToShow.Content is PropertiesViewModel)) { anchorableToShow.AutoHideWidth = 200; rightSide.InsertChildAt(0, anchorableToShow); return(true); } // Bottom Anchorables var sub = layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(p => p.Name == "bottomPane"); if (sub != null && (anchorableToShow.Content is LogViewModel || anchorableToShow.Content is ErrorListViewModel)) { sub.InsertChildAt(0, anchorableToShow); return(true); } if (destinationContainer is LayoutAnchorablePane pane) { pane.InsertChildAt(0, anchorableToShow); return(true); } return(false); }
protected virtual void FixupLayout(LayoutRoot layout) { //fix container panes foreach (var lcToAttach in layout.Descendents().OfType<ILayoutPreviousContainer>().Where(lc => lc.PreviousContainerId != null)) { var paneContainerToAttach = layout.Descendents().OfType<ILayoutPaneSerializable>().FirstOrDefault(lps => lps.Id == lcToAttach.PreviousContainerId); if (paneContainerToAttach == null) throw new ArgumentException(string.Format("Unable to find a pane with id ='{0}'", lcToAttach.PreviousContainerId)); lcToAttach.PreviousContainer = paneContainerToAttach as ILayoutContainer; } //now fix the content of the layoutcontents foreach (var lcToFix in layout.Descendents().OfType<LayoutAnchorable>().Where(lc => lc.Content == null).ToArray()) { LayoutAnchorable previousAchorable = null; if (lcToFix.ContentId != null) { //try find the content in replaced layout previousAchorable = _previousAnchorables.FirstOrDefault(a => a.ContentId == lcToFix.ContentId); } if (LayoutSerializationCallback != null) { var args = new LayoutSerializationCallbackEventArgs(lcToFix, previousAchorable != null ? previousAchorable.Content : null); LayoutSerializationCallback(this, args); if (args.Content != null) lcToFix.Content = args.Content; else if (args.Model.Content != null) lcToFix.Hide(false); } else if (previousAchorable == null) lcToFix.Hide(false); else { lcToFix.Content = previousAchorable.Content; lcToFix.IconSource = previousAchorable.IconSource; } } foreach (var lcToFix in layout.Descendents().OfType<LayoutDocument>().Where(lc => lc.Content == null).ToArray()) { LayoutDocument previousDocument = null; if (lcToFix.ContentId != null) { //try find the content in replaced layout previousDocument = _previousDocuments.FirstOrDefault(a => a.ContentId == lcToFix.ContentId); } if (LayoutSerializationCallback != null) { var args = new LayoutSerializationCallbackEventArgs(lcToFix, previousDocument != null ? previousDocument.Content : null); LayoutSerializationCallback(this, args); if (args.Content != null) lcToFix.Content = args.Content; else if (args.Model.Content != null) lcToFix.Close(); } else if (previousDocument == null) lcToFix.Close(); else lcToFix.Content = previousDocument.Content; } layout.CollectGarbage(); }