当前位置: 首页>>代码示例>>C#>>正文


C# ContentPresenter.UpdateLayout方法代码示例

本文整理汇总了C#中System.Windows.Controls.ContentPresenter.UpdateLayout方法的典型用法代码示例。如果您正苦于以下问题:C# ContentPresenter.UpdateLayout方法的具体用法?C# ContentPresenter.UpdateLayout怎么用?C# ContentPresenter.UpdateLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ContentPresenter的用法示例。


在下文中一共展示了ContentPresenter.UpdateLayout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResetVisualState

 private static void ResetVisualState(ContentPresenter objectToPrint, PrintCapabilities printCaps)
 {
     objectToPrint.Width = double.NaN;
     objectToPrint.UpdateLayout();
     objectToPrint.LayoutTransform = new ScaleTransform(1, 1);
     Size size = new Size(printCaps.PageImageableArea.ExtentWidth,
                          printCaps.PageImageableArea.ExtentHeight);
     objectToPrint.Measure(size);
     objectToPrint.Arrange(new Rect(new Point(printCaps.PageImageableArea.OriginWidth,
                           printCaps.PageImageableArea.OriginHeight), size));
 }
开发者ID:peterson1,项目名称:ErrH,代码行数:11,代码来源:ScaledVisualPrinter.cs

示例2: ResetVisualState

        private static void ResetVisualState(ContentPresenter objectToPrint, PrintCapabilities printCaps, bool wasVirtualized)
        {
            objectToPrint.Width = double.NaN;
            objectToPrint.UpdateLayout();
            objectToPrint.LayoutTransform = new ScaleTransform(1, 1);
            Size size = new Size(printCaps.PageImageableArea.ExtentWidth,
                                 printCaps.PageImageableArea.ExtentHeight);
            objectToPrint.Measure(size);
            objectToPrint.Arrange(new Rect(new Point(printCaps.PageImageableArea.OriginWidth,
                                  printCaps.PageImageableArea.OriginHeight), size));

            if (!wasVirtualized) return;
            var dg = objectToPrint.FindChild<DataGrid>();
            dg.EnableRowVirtualization = true;
            dg.EnableColumnVirtualization = true;
            VirtualizingPanel.SetIsVirtualizing(dg, true);
        }
开发者ID:peterson1,项目名称:ErrH,代码行数:17,代码来源:ScaledVisualPrinter.cs

示例3: OnItemsChanged

        protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnItemsChanged(e);

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                case NotifyCollectionChangedAction.Reset:
                case NotifyCollectionChangedAction.Replace:
                    // fixup all items default width
                    UpdateItemWidth();
                    UpdateItemHeight();
                    break;
                case NotifyCollectionChangedAction.Remove:
                    break;
            }

            // reset headers
            UIElementCollection Headers = HeadersPanel.Children;
            Headers.Clear();
            foreach (PivotItem item in Items)
            {
                ContentPresenter ctrl = new ContentPresenter();
                ctrl.Content = item.Header;
                ctrl.ContentTemplate = this.UnselectedHeaderTemplate;
                ctrl.UpdateLayout();
                Headers.Add(ctrl);
            }

            // invalidate the control
            if (null != ScrollView)
                ScrollView.Invalidate();

            // first inserted ?
            if ((SelectedIndex < 0) && (Items.Count > 0))
                SelectedIndex = 0;

            // invalid selected item ?
            if (!Items.Contains(SelectedItem) && (Items.Count > 0))
                SelectedIndex = 0;
        }
开发者ID:eightrivers,项目名称:babelim,代码行数:41,代码来源:PivotControl.cs

示例4: _captureSnapshot

      // captures a snapshot of the given presenter to a cached bitmap 
      private Image _captureSnapshot(ContentPresenter presenter, bool hidePresenter) {
         if (hidePresenter) presenter.Visibility = Visibility.Hidden;
         var content = presenter.Content as FrameworkElement;
         if (content == null) return null;

         // force full layout and capture snapshot
         presenter.ApplyTemplate();
         presenter.UpdateLayout();
         return new Image { 
            Source = ImageServices.CaptureSnapshot(content)
         };
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:13,代码来源:TransitionPanel.cs


注:本文中的System.Windows.Controls.ContentPresenter.UpdateLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。