本文整理汇总了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;
}
示例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());
}
示例3: Draw
public void Draw(UIElementCollection children)
{
foreach (SingleVortex sv in reds)
children.Add(sv);
foreach (SingleVortex sv in blues)
children.Add(sv);
}
示例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);
}
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}