当前位置: 首页>>代码示例>>C#>>正文


C# UIElementCollection.Add方法代码示例

本文整理汇总了C#中System.Windows.Controls.UIElementCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# UIElementCollection.Add方法的具体用法?C# UIElementCollection.Add怎么用?C# UIElementCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.UIElementCollection的用法示例。


在下文中一共展示了UIElementCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public void Draw(UIElementCollection children)
        {
            if (!isAlive)
                return;

            DateTime cur = DateTime.Now;

            foreach (var segment in segments)
            {
                PlayerUtils.Segment seg = segment.Value.GetEstimatedSegment(cur);
                if (seg.IsCircle())
                {
                    var circle = new Ellipse();
                    circle.Width = seg.radius * 2;
                    circle.Height = seg.radius * 2;
                    circle.SetValue(Canvas.LeftProperty, seg.x1 - seg.radius);
                    circle.SetValue(Canvas.TopProperty, seg.y1 - seg.radius);
                    circle.Stroke = brJoints;
                    circle.StrokeThickness = 1;
                    circle.Fill = brBones;
                    children.Add(circle);
                }
            }

            // Remove unused players after 1/2 second.
            if (DateTime.Now.Subtract(lastUpdated).TotalMilliseconds > 500)
                isAlive = false;
        }
开发者ID:grazulis,项目名称:KinectRainbowSynth,代码行数:28,代码来源:Player.cs

示例2: AddPasswordBox

 private static void AddPasswordBox(
     UIElementCollection labelCollection, UIElementCollection inputCollection,
     UIElementCollection checkBoxCollection,
     string content, object dataContext, string key, int index)
 {
     var viewModel = (INotifyPropertyChanged)dataContext;
     labelCollection.Add(new Label() { Content = content });
     var control = new PasswordBox() { DataContext = dataContext, TabIndex = index };
     var parameters = (IDictionary<string, string>)((dynamic)dataContext).Dictionary;
     control.Password = parameters[key];
     PropertyChangedEventHandler onSourceChanged = (sender, e) =>
     {
         if (e.PropertyName != key)
         {
             return;
         }
         if (control.Password == parameters[key])
         {
             return;
         }
         control.Password = parameters[key];
     };
     viewModel.PropertyChanged += onSourceChanged;
     control.PasswordChanged += (sender, e) =>
     {
         if (parameters[key] != control.Password)
         {
             parameters[key] = control.Password;
         }
     };
     control.Unloaded += (sender, e) => viewModel.PropertyChanged -= onSourceChanged;
     inputCollection.Add(new UserControl() { Content = control });
     checkBoxCollection.Add(new FrameworkElement());
 }
开发者ID:gitter-badger,项目名称:pecastarter5,代码行数:34,代码来源:ComponentFactory.cs

示例3: Draw

 public void Draw(UIElementCollection children)
 {
     foreach (SingleVortex sv in reds)
         children.Add(sv);
     foreach (SingleVortex sv in blues)
         children.Add(sv);
 }
开发者ID:verbatium,项目名称:KinectFish,代码行数:7,代码来源:Vortices.cs

示例4: Draw

 public static void Draw(UIElementCollection children)
 {
     foreach (var option in selections)
     {
         var rect = new Rectangle();
         rect.Width = option.intersection.Width;
         rect.Height = option.intersection.Height;
         rect.SetValue(Canvas.LeftProperty, option.intersection.X);
         rect.SetValue(Canvas.TopProperty, option.intersection.Y);
         rect.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
         rect.StrokeThickness = 1;
         rect.Fill = new SolidColorBrush(Color.FromArgb(100, 255, 0, 0));
         children.Add(rect);
         option.Advance();
         children.Add(option.label);
     }
 }
开发者ID:artieikon,项目名称:Kinect-game,代码行数:17,代码来源:Selection.cs

示例5: AddTextBox

 private static void AddTextBox(
     UIElementCollection labelCollection, UIElementCollection inputCollection,
     UIElementCollection checkBoxCollection,
     string labelText, object dataContext, string key, int tabIndex)
 {
     labelCollection.Add(new Label() { Content = labelText });
     var control = new TextBox() { DataContext = dataContext, TabIndex = tabIndex };
     control.SetBinding(TextBox.TextProperty, new Binding(key));
     inputCollection.Add(new UserControl() { Content = control });
     checkBoxCollection.Add(new FrameworkElement());
 }
开发者ID:gitter-badger,项目名称:pecastarter5,代码行数:11,代码来源:ComponentFactory.cs

示例6: TransitionPresenter

        public TransitionPresenter()
        {
            _children = new UIElementCollection(this, null);
              ContentPresenter currentContent = new ContentPresenter();
              _currentHost = new AdornerDecorator();
              _currentHost.Child = currentContent;
              _children.Add(_currentHost);

              ContentPresenter previousContent = new ContentPresenter();
              _previousHost = new AdornerDecorator();
              _previousHost.Child = previousContent;
        }
开发者ID:edealbag,项目名称:bot,代码行数:12,代码来源:TransitionPresenter.cs

示例7: Draw

        public static void Draw(UIElementCollection children)
        {
            if (bannerText == null)
                    return;

                Label text = bannerText.GetLabel();
                if (text == null)
                {
                    bannerText = null;
                    return;
                }
                children.Add(text);
        }
开发者ID:grazulis,项目名称:KinectRainbowSynth,代码行数:13,代码来源:BannerText.cs

示例8: Draw

        public override void Draw(UIElementCollection collection)
        {
            Heart heart;
            if (DrawedElement == null)
                heart = new Heart();
            else heart = (Heart)DrawedElement;

            UpdateProperties(heart);
            LocateShapeOnCanvas(heart);

            if (DrawedElement == null)
                collection.Add(heart);
            DrawedElement = heart;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyHeart.cs

示例9: Draw

        public override void Draw(UIElementCollection collection)
        {
            Arrow arrow;
            if (DrawedElement == null)
                arrow = new Arrow();
            else arrow = (Arrow)DrawedElement;

            UpdateProperties(arrow);
            LocateShapeOnCanvas(arrow);

            if (DrawedElement == null)
                collection.Add(arrow);
            DrawedElement = arrow;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyArrow.cs

示例10: Draw

        public override void Draw(UIElementCollection collection)
        {
            Triangle triangle;
            if (DrawedElement == null)
                triangle = new Triangle();
            else triangle = (Triangle)DrawedElement;

            UpdateProperties(triangle);
            LocateShapeOnCanvas(triangle);

            if (DrawedElement == null)
                collection.Add(triangle);
            DrawedElement = triangle;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyTriangle.cs

示例11: Draw

        public override void Draw(UIElementCollection collection)
        {
            Star star;
            if (DrawedElement == null)
                star = new Star();
            else star = (Star)DrawedElement;

            UpdateProperties(star);
            LocateShapeOnCanvas(star);

            if (DrawedElement == null)
                collection.Add(star);
            DrawedElement = star;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyStar.cs

示例12: Draw

        public override void Draw(UIElementCollection collection)
        {
            Line line;
            if (DrawedElement == null)
                line = new Line();
            else line = (Line)DrawedElement;

            UpdateProperties(line);

            if (DrawedElement == null)
                collection.Add(line);

            DrawedElement = line;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyLine.cs

示例13: Draw

        public override void Draw(UIElementCollection collection)
        {
            RectangularCallout callout;
            if (DrawedElement == null)
                callout = new RectangularCallout();
            else callout = (RectangularCallout)DrawedElement;

            UpdateProperties(callout);
            LocateShapeOnCanvas(callout);

            if (DrawedElement == null)
                collection.Add(callout);
            DrawedElement = callout;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyMessage.cs

示例14: Draw

        public override void Draw(UIElementCollection collection)
        {
            Ellipse ellipse;
            if (DrawedElement == null)
                ellipse = new Ellipse();
            else ellipse = (Ellipse)DrawedElement;

            UpdateProperties(ellipse);
            LocateShapeOnCanvas(ellipse);

            if (DrawedElement == null)
                collection.Add(ellipse);
            DrawedElement = ellipse;
        }
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyEllipse.cs

示例15: Draw

        public static void Draw(UIElementCollection children)
        {
            for (int i = 0; i < FlyingTexts.Count; i++)
            {
                FlyingText flyout = FlyingTexts[i];
                if (flyout.alpha <= 0)
                {
                    FlyingTexts.Remove(flyout);
                    i--;
                }
            }

            foreach (var flyout in FlyingTexts)
            {
                flyout.Advance();
                children.Add(flyout.label);
            }
        }
开发者ID:chaocraig,项目名称:KinectXNAFight,代码行数:18,代码来源:FlyingText.cs


注:本文中的System.Windows.Controls.UIElementCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。