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


C# Grid.Measure方法代码示例

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


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

示例1: CreatePopup

        private void CreatePopup(string msg, bool isError)
        {
            _popup = new Popup
            {
                VerticalAlignment = VerticalAlignment.Top,
                RenderTransform = new TranslateTransform()
            };

            #region grid

            var grid = new Grid
            {
                Background = new SolidColorBrush(_color),
                Width = Window.Current.Bounds.Width,
                VerticalAlignment = VerticalAlignment.Top,
                ManipulationMode = ManipulationModes.TranslateY
            };

            grid.ManipulationStarted += grid_ManipulationStarted;
            grid.ManipulationDelta += grid_ManipulationDelta;
            grid.ManipulationCompleted += grid_ManipulationCompleted;
            grid.Tapped += GridOnTapped;

            #endregion

            #region stackpanel

            var panel = new Grid
            {
                Margin = new Thickness(30, PaddingPopup, 20, 20),
                VerticalAlignment = VerticalAlignment.Bottom
            };
            panel.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
            panel.ColumnDefinitions.Add(new ColumnDefinition());

            #endregion

            #region text blocks

            var title = new TextBlock
            {
                Text = isError ? "" : "",
                FontWeight = FontWeights.Bold,
                FontSize = 22,
                Foreground = new SolidColorBrush(Colors.White),
                FontFamily = new FontFamily("Segoe UI Symbol")
            };
            var subMsg = new TextBlock
            {
                Text = msg,
                FontSize = 16,
                VerticalAlignment = VerticalAlignment.Center,
                Margin = new Thickness(20, 0, 0, 0),
                Foreground = new SolidColorBrush(Colors.White),
                TextWrapping = TextWrapping.Wrap
            };
            Grid.SetColumn(subMsg, 1);

            #endregion

            panel.Children.Add(title);
            panel.Children.Add(subMsg);
            grid.Children.Add(panel);

            _popup.Child = grid;
            _popup.IsOpen = true;

            //Make the framework (re)calculate the size of the element
            grid.Measure(new Size(double.MaxValue, double.MaxValue));
        }
开发者ID:haroldma,项目名称:Audiotica,代码行数:70,代码来源:CurtainPrompt.cs

示例2: CreatePopup

        private void CreatePopup()
        {
            _popup = new Popup
            {
                RenderTransform = new TranslateTransform(),
                Opacity = 0
            };

            var grid = new Grid
            {
                Background = new SolidColorBrush(Colors.Gray),
                Width = Window.Current.Bounds.Width,
                Height = Window.Current.Bounds.Height
            };

            var panel = new StackPanel
            {
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            #region Message Text Block

            _subMsg = new TextBlock
            {
                Text = "Loading...",
                FontSize = 16,
                HorizontalAlignment = HorizontalAlignment.Center,
                Foreground = new SolidColorBrush(Colors.White),
                TextWrapping = TextWrapping.Wrap
            };

            #endregion

            #region Progress bar

            var progress = new ProgressBar {IsIndeterminate = true};

            #endregion

            panel.Children.Add(_subMsg);
            panel.Children.Add(progress);
            grid.Children.Add(panel);

            _popup.Child = grid;
            _popup.IsOpen = true;

            //Make the framework (re)calculate the size of the element
            grid.Measure(new Size(double.MaxValue, double.MaxValue));
        }
开发者ID:haroldma,项目名称:PopcornTime,代码行数:50,代码来源:UiBlocker.cs


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