Exemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="ContentDialog"/> using the parameters
        /// </summary>
        /// <param name="includeCloseButton"></param>
        /// <returns></returns>
        public static ContentDialog CreateContentDialog(bool includeSecondaryButton = false)
        {
            #region Grid Definitions
            var contentPanel = new Grid();

            var columnOne = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            };

            var rowOne = new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Auto)
            };
            var rowTwo = new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Star)
            };

            contentPanel.ColumnDefinitions.Add(columnOne);
            contentPanel.RowDefinitions.Add(rowOne);
            contentPanel.RowDefinitions.Add(rowTwo);
            #endregion

            var label = new TextBlock
            {
                Name = "LabelTextBlock",
                VerticalAlignment = VerticalAlignment.Center,
                Padding           = new Thickness(0, 0, 0, 0)
            };
            Grid.SetRow(label, 0);
            Grid.SetColumn(label, 0);

            contentPanel.Children.Add(label);

            var dialog = new ContentDialog
            {
                Content = contentPanel,
                IsPrimaryButtonEnabled   = true,
                IsSecondaryButtonEnabled = includeSecondaryButton,
                Background = Application.Current.FindResource("TabBackground") as Brush
            };

            dialog.ApplyTemplate();
            return(dialog);
        }