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


C# Viewbox.SetValue方法代碼示例

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


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

示例1: CreateTitles

        private void CreateTitles()
        {
            titleGrid.Children.Clear();
            titleGrid.ColumnDefinitions.Clear();

            int length = Drinks.Length;
            for (int i = 0; i < length; i++)
            {
                titleGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                Viewbox view = new Viewbox();
                TextBlock text = new TextBlock()
                {
                    Text = Drinks[i].Name,
                    TextAlignment = TextAlignment.Center,
                    FontFamily = new FontFamily(new Uri("pack://application:/Styles/"), "Coolvetica Rg"),
                    Margin = new Thickness(5)

                };
                view.SetValue(Grid.ColumnProperty, i);
                view.Child = text;
                titleGrid.Children.Add(view);
            }
        }
開發者ID:nojaf,項目名稱:Beursfuif,代碼行數:27,代碼來源:UCStats.xaml.cs

示例2: OnBusyStateChanged

        /// <summary>
        /// OnBusyStateChanged
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnBusyStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool isBusy = (bool)e.NewValue;
            bool wasBusy = (bool)e.OldValue;

            if (isBusy == wasBusy)
            {
                return;
            }

            var hostGridObject = (GetTargetVisual(d) ?? d);
            Debug.Assert(hostGridObject != null);

            var hostGrid = hostGridObject as Grid;
            if (hostGrid == null)
            {
                throw new InvalidCastException(
                    string.Format(
                        "The object being attached to must be of type {0}. Try embedding your visual inside a {0} control, and attaching the behavior to the {0} instead.",
                        typeof(Grid).Name));
            }

            if (isBusy)
            {
                Debug.Assert(LogicalTreeHelper.FindLogicalNode(hostGrid, "BusyIndicator") == null);

                bool dimBackground = GetDimBackground(d);
                var grid = new Grid
                {
                    Name = "BusyIndicator",
                    Opacity = 0.0
                };
                if (dimBackground)
                {
                    grid.Cursor = Cursors.Wait;
                    grid.ForceCursor = true;

                    InputManager.Current.PreProcessInput += OnPreProcessInput;
                }
                grid.SetBinding(FrameworkElement.WidthProperty, new Binding("ActualWidth")
                {
                    Source = hostGrid
                });
                grid.SetBinding(FrameworkElement.HeightProperty, new Binding("ActualHeight")
                {
                    Source = hostGrid
                });
                for (int i = 1; i <= 3; ++i)
                {
                    grid.ColumnDefinitions.Add(new ColumnDefinition
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition
                    {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                }
                ProgressIndicator = new BusyIndicator() { Width = 150, Height = 120 };

                var viewbox = new Viewbox
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Stretch = Stretch.Uniform,
                    StretchDirection = StretchDirection.Both,
                    Child = ProgressIndicator
                };
                grid.SetValue(Panel.ZIndexProperty, 1000);
                grid.SetValue(Grid.RowSpanProperty, Math.Max(1, hostGrid.RowDefinitions.Count));
                grid.SetValue(Grid.ColumnSpanProperty, Math.Max(1, hostGrid.ColumnDefinitions.Count));
                if (GetAddMargins(d))
                {
                    viewbox.SetValue(Grid.RowProperty, 1);
                    viewbox.SetValue(Grid.ColumnProperty, 1);
                }
                else
                {
                    viewbox.SetValue(Grid.RowSpanProperty, 3);
                    viewbox.SetValue(Grid.ColumnSpanProperty, 3);
                }
                viewbox.SetValue(Panel.ZIndexProperty, 1);

                var dimmer = new Rectangle
                {
                    Name = "Dimmer",
                    Opacity = GetDimmerOpacity(d),
                    Fill = GetDimmerBrush(d),
                    Visibility = (dimBackground ? Visibility.Visible : Visibility.Collapsed)
                };
                dimmer.SetValue(Grid.RowSpanProperty, 3);
                dimmer.SetValue(Grid.ColumnSpanProperty, 3);
                dimmer.SetValue(Panel.ZIndexProperty, 0);
                grid.Children.Add(dimmer);

                grid.Children.Add(viewbox);
//.........這裏部分代碼省略.........
開發者ID:barbarossia,項目名稱:CWF,代碼行數:101,代碼來源:BusyIndicatorBehavior.cs

示例3: AddPlayer

        /**
         * Fuegt den Player dem Grid hinzu
         */
        private void AddPlayer()
        {
            _gsc = new GreenScreenControl.GreenScreenControl();
            _gsc.Width = _sensor.ColorStream.FrameWidth;
            _gsc.Height = _sensor.ColorStream.FrameHeight;
            _gsc.Start(_sensor, false);

            _playerBox = new Viewbox();
            _playerBox.Child = _gsc;
            _playerBox.Stretch = Stretch.Fill;
            _playerBox.SetValue(Panel.ZIndexProperty, 1);

            MiniGameGrid.Children.Add(_playerBox);

            if (_playerSkeleton.Joints[JointType.ShoulderCenter].Position.X < -0.25)
            {
                Grid.SetColumn(_playerBox, 1);
            }
            else if (_playerSkeleton.Joints[JointType.ShoulderCenter].Position.X > 0.25)
            {
                Grid.SetColumn(_playerBox, 3);
            }
            else
            {
                Grid.SetColumn(_playerBox, 2);
            }
            Grid.SetRow(_playerBox, 4);
        }
開發者ID:rechc,項目名稱:KinectMiniApps,代碼行數:31,代碼來源:MiniGameControl.xaml.cs


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