當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。