本文整理汇总了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));
}
示例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);
}
示例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;
}
示例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)
};
}