本文整理汇总了C#中System.Windows.Controls.UIElement.Measure方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.Measure方法的具体用法?C# UIElement.Measure怎么用?C# UIElement.Measure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.UIElement
的用法示例。
在下文中一共展示了UIElement.Measure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureChild
private void MeasureChild(UIElement child, double availableMainLength, double availableCrossLength)
{
child.Measure(Orientation == Orientation.Horizontal ?
new Size(availableMainLength, availableCrossLength) :
new Size(availableCrossLength, availableMainLength));
}
示例2: InsertDisplayedElement
private void InsertDisplayedElement(int slot, UIElement element, bool wasNewlyAdded, bool updateSlotInformation)
{
// We can only support creating new rows that are adjacent to the currently visible rows
// since they need to be added to the visual tree for us to Measure them.
Debug.Assert(this.DisplayData.FirstScrollingSlot == -1 || slot >= GetPreviousVisibleSlot(this.DisplayData.FirstScrollingSlot) && slot <= GetNextVisibleSlot(this.DisplayData.LastScrollingSlot));
Debug.Assert(element != null);
if (this._rowsPresenter != null)
{
DataGridRowGroupHeader groupHeader = null;
DataGridRow row = element as DataGridRow;
if (row != null)
{
LoadRowVisualsForDisplay(row);
if (IsRowRecyclable(row))
{
if (!row.IsRecycled)
{
Debug.Assert(!this._rowsPresenter.Children.Contains(element));
_rowsPresenter.Children.Add(row);
}
}
else
{
element.Clip = null;
Debug.Assert(row.Index == RowIndexFromSlot(slot));
}
}
else
{
groupHeader = element as DataGridRowGroupHeader;
Debug.Assert(groupHeader != null); // Nothig other and Rows and RowGroups now
if (groupHeader != null)
{
groupHeader.TotalIndent = (groupHeader.Level == 0) ? 0 : this.RowGroupSublevelIndents[groupHeader.Level - 1];
if (!groupHeader.IsRecycled)
{
_rowsPresenter.Children.Add(element);
}
groupHeader.LoadVisualsForDisplay();
Style lastStyle = _rowGroupHeaderStyles.Count > 0 ? _rowGroupHeaderStyles[_rowGroupHeaderStyles.Count - 1] : null;
EnsureElementStyle(groupHeader, groupHeader.Style, groupHeader.Level < _rowGroupHeaderStyles.Count ? _rowGroupHeaderStyles[groupHeader.Level] : lastStyle);
}
}
// Measure the element and update AvailableRowRoom
element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
this.AvailableSlotElementRoom -= element.DesiredSize.Height;
if (groupHeader != null)
{
_rowGroupHeightsByLevel[groupHeader.Level] = groupHeader.DesiredSize.Height;
}
if (row != null && this.RowHeightEstimate == DataGrid.DATAGRID_defaultRowHeight && double.IsNaN(row.Height))
{
this.RowHeightEstimate = element.DesiredSize.Height;
}
}
if (wasNewlyAdded)
{
this.DisplayData.CorrectSlotsAfterInsertion(slot, element, false /*isCollapsed*/);
}
else
{
this.DisplayData.LoadScrollingSlot(slot, element, updateSlotInformation);
}
}