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


C# UIElement.Measure方法代码示例

本文整理汇总了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));
 }
开发者ID:highzion,项目名称:Granular,代码行数:6,代码来源:WrapPanel.cs

示例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);
            }
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:71,代码来源:DataGridRows.cs


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