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