本文整理汇总了C#中UIElement.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.SetValue方法的具体用法?C# UIElement.SetValue怎么用?C# UIElement.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddElement
public void AddElement(UIElement element, int x, int y)
{
if(element == null)
return;
element.SetValue(ColumnProperty, x);
element.SetValue(RowProperty, y);
Children.Add(element);
}
示例2: AddChildInCanvas
public void AddChildInCanvas(UIElement control)
{
if (canvas.Children.Count == 0)
{
canvas.Children.Add(control);
control.SetValue(Canvas.LeftProperty, 0d);
control.SetValue(Canvas.TopProperty, 0d);
}
}
示例3: AddChild
public static void AddChild(this Grid grid, UIElement control, int row, int column)
{
control.SetValue(Grid.RowProperty, row);
control.SetValue(Grid.ColumnProperty, column);
grid.Children.Add(control);
}
示例4: CompletionControl
public CompletionControl(UIElement view, ICompletionSession session)
{
InitializeComponent();
_view = view;
_warning.Foreground = SystemColors.HotTrackBrush;
_warning.Text = J.Tools.Resources.WarningAnalysisNotCurrent;
if (session.TextView.GetAnalyzer().InterpreterFactory.IsAnalysisCurrent()) {
_warning.Visibility = System.Windows.Visibility.Collapsed;
}
view.SetValue(Grid.RowProperty, 0);
view.SetValue(Grid.ColumnProperty, 0);
_grid.Children.Add(view);
var content = view as ContentControl;
if (content != null) {
content.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
content.Width = Width;
content.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
}
session.Dismissed += SessionDismissed;
}
示例5: SetGridColumnRow
private UIElement SetGridColumnRow(UIElement input, int row, int column)
{
input.SetValue(RowProperty, row);
input.SetValue(ColumnProperty, column);
return input;
}
示例6: SetIsTabStop
/// <summary>
/// Sets a boolean indicating whether or not the specified element is a Tab stop
/// </summary>
/// <param name="element">The <see cref="UIElement"/> to set</param>
/// <param name="isTabStop">A boolean indicating whether or not the element is a Tab stop element</param>
public static void SetIsTabStop(UIElement element, bool isTabStop)
{
IUIElement focusScopeElement;
HashSet<UIElement> focusables;
int index;
if (!element.DependencyProperties.ContainsKey(KeyboardNavigation.IsTabStopProperty))
{
KeyboardNavigation.AppendKeyboardNavigationProperties(element);
}
focusScopeElement = FocusManager.GetFocusScopeElement(element);
if (focusScopeElement == null)
{
return;
}
element.SetValue(KeyboardNavigation.IsTabStopProperty, isTabStop);
focusables = focusScopeElement.GetValue<HashSet<UIElement>>(FocusManager.FocusableElementsProperty);
if (focusables.Contains(element))
{
return;
}
if(focusables.Count > 0)
{
index = focusables.Max(elem => elem.GetValue<int>(KeyboardNavigation.TabIndexProperty));
}
else
{
index = 0;
}
element.SetValue(KeyboardNavigation.TabIndexProperty, index);
}
示例7: DialogShellViewWpf
public DialogShellViewWpf(System.Windows.UIElement hostedControl)
: this()
{
_hostedControl = hostedControl;
_hostedControl.SetValue(Grid.RowProperty, 0);
_hostedControl.SetValue(Grid.ColumnProperty, 0);
_grid.Children.Add(_hostedControl);
}
示例8: SetIsVisible
public static void SetIsVisible(UIElement control, bool? isVisible)
{
control.SetValue(IsVisibleProperty, isVisible);
if (isVisible == null)
return;
control.SetValue(UIElement.VisibilityProperty, isVisible.Value ? Visibility.Visible : Visibility.Collapsed);
}
示例9: AddUiElement
public void AddUiElement(UIElement uiElement, int row, int col, int rowSpan = 0, int colSpan = 0)
{
if (row > 0) uiElement.SetValue(RowProperty, row);
if (col > 0) uiElement.SetValue(ColumnProperty, col);
if (rowSpan > 0) uiElement.SetValue(RowSpanProperty, rowSpan);
if (colSpan > 0) uiElement.SetValue(ColumnSpanProperty, colSpan);
Children.Add(uiElement);
}
示例10: AddElement
public void AddElement(UIElement el)
{
var rowDefinition = new RowDefinition();
rowDefinition.Height = GridLength.Auto;
viewGrid.RowDefinitions.Add(rowDefinition);
el.SetValue(Grid.RowProperty, newRow++);
el.SetValue(Grid.ColumnProperty, 0);
this.viewGrid.Children.Add(el);
//this.viewStack.Children.Add(el);
}
示例11: SetDetailControl
public void SetDetailControl(object detailControl)
{
if (_detailControl != null)
_mainGrid.Children.Remove(_detailControl);
_detailControl = (UIElement)detailControl;
if (null != _detailControl)
{
_detailControl.SetValue(Grid.RowProperty, 4);
_detailControl.SetValue(Grid.ColumnProperty, 2);
_mainGrid.Children.Add(_detailControl);
}
}
示例12: SetDock
/// <summary>
/// Sets the value of the Dock attached property to a specified element.
/// </summary>
/// <param name="element">The element to which the attached property is written.</param>
/// <param name="dock">The new Dock value.</param>
public static void SetDock(UIElement element, Dock dock)
{
if (element == null)
throw new ArgumentNullException("element");
element.SetValue(DockProperty, dock);
}
示例13: StartAnimation
/// <summary>
/// Starts an animation to a particular value on the specified dependency property.
/// You can pass in an event handler to call when the animation has completed.
/// </summary>
public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
{
double fromValue = (double)animatableElement.GetValue(dependencyProperty);
DoubleAnimation animation = new DoubleAnimation();
animation.From = fromValue;
animation.To = toValue;
animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);
animation.Completed += delegate(object sender, EventArgs e)
{
//
// When the animation has completed bake final value of the animation
// into the property.
//
animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
CancelAnimation(animatableElement, dependencyProperty);
if (completedEvent != null)
{
completedEvent(sender, e);
}
};
//TODO// animation.Freeze();
//TODO// animatableElement.BeginAnimation(dependencyProperty, animation);
}
示例14: SetPosition
public static void SetPosition(UIElement element, Position position)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
element.SetValue(PositionProperty, position);
}
示例15: SetIsMemoryEfficient
/// <summary>
/// Sets the value of the IsMemoryEfficient attached property to a specified UIElement.
/// </summary>
/// <param name="element">The UIElement to which the attached property is written.</param>
/// <param name="value">The needed IsMemoryEfficient value.</param>
public static void SetIsMemoryEfficient(UIElement element, bool value)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
element.SetValue(IsMemoryEfficientProperty, value);
}