本文整理汇总了C#中System.Windows.Controls.UIElementCollection类的典型用法代码示例。如果您正苦于以下问题:C# UIElementCollection类的具体用法?C# UIElementCollection怎么用?C# UIElementCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIElementCollection类属于System.Windows.Controls命名空间,在下文中一共展示了UIElementCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TreeGridViewRowPresenter
public TreeGridViewRowPresenter()
{
_childs = new UIElementCollection(this, this);
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ColumnsProperty, typeof(TreeGridViewRowPresenter));
if (dpd != null)
dpd.AddValueChanged(this, (s, e) => EnsureLines());
}
示例2: SudokuCell
public SudokuCell(UIElementCollection panel, int bsize, SudokuBoard sb)
{
this.sb = sb;
this.bsize = bsize;
this.children = new List<SudokuCell>();
this.panel = panel;
isLeaf = false;
int size = bsize * bsize;
int bss = size * size;
int[] data = new int[bss];
for (var i = 0; i < bss; i++) data[i] = i;
for (var i = 0; i < bsize; i++)
{
for (var j = 0; j < bsize; j++)
{
var t = new List<int>();
for (var k = i * bsize; k < (i + 1) * bsize; k++)
{
for (var l = j * bsize; l < (j + 1) * bsize; l++)
{
t.Add(data[k * size + l]);
}
}
var sc = new SudokuCell(this.panel, t.ToArray(), j, i, bsize, sb);
children.Add(sc);
}
}
}
示例3: 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());
}
示例4: ItemCount
public static double ItemCount(CalendarAppointmentItem currentApp, UIElementCollection children)
{
double count = 0;
foreach (UIElement child in children)
{
if (child is CalendarAppointmentItem)
{
var currentChild = child as CalendarAppointmentItem;
var cStart = currentApp.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?;
var cEnd = currentApp.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?;
var toTest = new DateRange(cStart.Value, cEnd.Value);
var aStart = currentChild.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?;
var aEnd = currentChild.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?;
var current = new DateRange(aStart.Value, aEnd.Value);
if (toTest.Overlaps(current))
{
count++;
}
}
}
return count;
}
示例5: Draw
public void Draw(UIElementCollection children)
{
foreach (SingleVortex sv in reds)
children.Add(sv);
foreach (SingleVortex sv in blues)
children.Add(sv);
}
示例6: ElementMovOrRes
public ElementMovOrRes(CommandStack commandStack, UIElementCollection selection, Rect newrect, Rect oldrect, int editingOperationCount)
: base(commandStack) {
_selection = selection;
_newrect = newrect;
_oldrect = oldrect;
_editingOperationCount = editingOperationCount;
}
示例7: 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;
}
示例8: AddAllStrokesAtOriginalIndex
private void AddAllStrokesAtOriginalIndex(UIElementCollection toBeAdded) {
foreach (UIElement elm in toBeAdded) {
//int strokeIndex = (int)elm.GetPropertyData(STROKE_INDEX_PROPERTY);
//if (strokeIndex > _commandStack.StrokeCollection.Count)
// strokeIndex = _commandStack.StrokeCollection.Count;
_commandStack.ElementCollection.Add(elm);
}
}
示例9: Viewport3DDecorator
/// <summary>
/// Creates the Viewport3DDecorator
/// </summary>
public Viewport3DDecorator()
{
// create the two lists of children
_preViewportChildren = new UIElementCollection(this, this);
_postViewportChildren = new UIElementCollection(this, this);
// no content yet
_content = null;
}
示例10: Viewport3DDecorator
/// <summary>
/// Initializes a new instance of the <see cref="Viewport3DDecorator"/> class.
/// Creates the Viewport3DDecorator
/// </summary>
protected Viewport3DDecorator()
{
// create the two lists of children
this._preViewportChildren = new UIElementCollection(this, this);
this._postViewportChildren = new UIElementCollection(this, this);
// no content yet
this._content = null;
}
示例11: ElementAddOrRem
public ElementAddOrRem(CommandStack commandStack, InkCanvasEditingMode editingMode,
UIElementCollection added, UIElementCollection removed, int editingOperationCount)
: base(commandStack) {
_editingMode = editingMode;
_added = added;
_removed = removed;
_editingOperationCount = editingOperationCount;
}
示例12: SetBlocksMouseEvent
private void SetBlocksMouseEvent( UIElementCollection collection )
{
foreach ( UIElement block in collection )
{
//block.PreviewMouseLeftButtonDown += new MouseButtonEventHandler( m_dragController.OnPreviewMouseLeftButtonDown );
block.MouseLeftButtonDown += new MouseButtonEventHandler( m_dragController.OnPreviewMouseLeftButtonDown );
block.PreviewMouseMove += new MouseEventHandler( m_dragController.OnPreviewMouseMove );
//block.MouseMove += new MouseEventHandler( m_dragController.OnMouseMove );
block.PreviewMouseLeftButtonUp += new MouseButtonEventHandler( m_dragController.OnPreviewMouseUp );
}
}
示例13: getBloodType
private BloodType getBloodType(UIElementCollection radioButtonList)
{
//convert the selected radioButton to a BloodType
BloodType b = BloodType.O;
foreach (RadioButton r in radioButtonList)
{
if ((bool)r.IsChecked)
b = (BloodType)Enum.Parse(typeof(BloodType), r.Content.ToString());
}
return b;
}
示例14: 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());
}
示例15: CalculateHeightOfColumn
/// <summary>
/// Calculates the height of column.
/// </summary>
/// <param name="i">The starting point.</param>
/// <param name="startOfColumnElementIndex">Start index of the of column element.</param>
/// <param name="endOfColumnElementIndex">End index of the of column element.</param>
/// <param name="children">The children.</param>
/// <returns></returns>
public static int CalculateHeightOfColumn(int i, int[] startOfColumnElementIndex, int[] endOfColumnElementIndex, UIElementCollection children)
{
var thisColHeight = 0;
for (var j = startOfColumnElementIndex[i]; j <= endOfColumnElementIndex[i]; j++)
{
var height = (int)children[j].DesiredSize.Height;
thisColHeight += height;
}
return thisColHeight;
}