當前位置: 首頁>>代碼示例>>C#>>正文


C# Popup.UpdateLayout方法代碼示例

本文整理匯總了C#中System.Windows.Controls.Primitives.Popup.UpdateLayout方法的典型用法代碼示例。如果您正苦於以下問題:C# Popup.UpdateLayout方法的具體用法?C# Popup.UpdateLayout怎麽用?C# Popup.UpdateLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Controls.Primitives.Popup的用法示例。


在下文中一共展示了Popup.UpdateLayout方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InitializeBusyIndicator

        partial void InitializeBusyIndicator()
        {
            if (_busyIndicator != null)
            {
                return;
            }

            _grid = new Grid();
            _grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            _grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
            _grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
            _grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });

            var backgroundBorder = new Border();
            backgroundBorder.Background = new SolidColorBrush(Colors.Gray);
            backgroundBorder.Opacity = 0.5;
            backgroundBorder.SetValue(Grid.RowSpanProperty, 4);
            _grid.Children.Add(backgroundBorder);

            _statusTextBlock = new TextBlock();
            _statusTextBlock.Style = (Style)Application.Current.Resources["PhoneTextNormalStyle"];
            _statusTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
            _statusTextBlock.SetValue(Grid.RowProperty, 1);
            _grid.Children.Add(_statusTextBlock);

            _busyIndicator = ConstructBusyIndicator();
            _busyIndicator.SetValue(Grid.RowProperty, 2);
            _grid.Children.Add(_busyIndicator);

            _containerPopup = new Popup();
            _containerPopup.VerticalAlignment = VerticalAlignment.Center;
            _containerPopup.HorizontalAlignment = HorizontalAlignment.Center;
            _containerPopup.Child = _grid;

            double rootWidth = Application.Current.Host.Content.ActualWidth;
            double rootHeight = Application.Current.Host.Content.ActualHeight;

            _busyIndicator.Width = rootWidth;

            _grid.Width = rootWidth;
            _grid.Height = rootHeight;

            _containerPopup.UpdateLayout();

            return;
        }
開發者ID:justdude,項目名稱:DbExport,代碼行數:46,代碼來源:PleaseWaitService.wpsl.cs

示例2: GetImages

        private List<ExportFile> GetImages()
        {
            List<ExportFile> images = new List<ExportFile>();

              foreach(Symbol symbol in mUsedSymbols)
              {
            SymbolDisplay symDisplay = new SymbolDisplay();

            symDisplay.Symbol = symbol;
            symDisplay.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            symDisplay.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            //Need to put panel in popup and open popup, so panel ends up in control visual tree.
            //Otherwise when bitmap is rendered, panel will not include any child controls.
            Popup popUp = new System.Windows.Controls.Primitives.Popup();
            popUp.Child = symDisplay;
            popUp.IsOpen = true;
            popUp.UpdateLayout();

            WriteableBitmap bmp = new WriteableBitmap(symDisplay, null);
            ImageTools.Image img = ImageTools.ImageExtensions.ToImage(bmp);

            MemoryStream stream = new MemoryStream();

            ImageTools.ImageExtensions.WriteToStream(img, stream);

            images.Add(new ExportFile()
            {
              Title = symbol.GetHashCode().ToString(),
              Path = string.Format("files/{0}.png", symbol.GetHashCode().ToString()),
              Data = stream.ToArray()
            });

            stream.Dispose();

            popUp.IsOpen = false;
              }

              return images;
        }
開發者ID:Zekiah,項目名稱:GraphicLayerGoogleExport,代碼行數:40,代碼來源:GraphicsLayerExport.cs


注:本文中的System.Windows.Controls.Primitives.Popup.UpdateLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。