本文整理汇总了C#中System.Windows.Controls.Control.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Control.SetValue方法的具体用法?C# Control.SetValue怎么用?C# Control.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Control
的用法示例。
在下文中一共展示了Control.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIsSendingMouseWheelEventToParent
/// <summary>
/// Sets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
/// </summary>
/// <param name="control">
/// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be set.
/// </param>
/// <param name="IsSendingMouseWheelEventToParent">
/// The IsSendingMouseWheelEventToParent to set, or <see langword="null"/>
/// to remove any existing IsSendingMouseWheelEventToParent from <paramref name="control"/>.
/// </param>
public static void SetIsSendingMouseWheelEventToParent(Control control, bool? sendToParent)
{
if (control == null)
throw new ArgumentNullException("");
control.SetValue(ScrollProperty, sendToParent);
}
示例2: SetCulture
/// <summary>
/// Sets the spell checking culture of the specified control.
/// </summary>
/// <param name="control">
/// The control.
/// </param>
/// <param name="value">
/// The spell checking culture.
/// </param>
/// <exception cref="ArgumentNullException">
/// The <paramref name="value"/> parameter is null.
/// </exception>
public static void SetCulture(Control control, CultureInfo value)
{
if (control == null)
throw new ArgumentNullException("control");
control.SetValue(CultureProperty, value);
}
示例3: GetOrCreateBehavior
private static DoubleClickCommandBehavior GetOrCreateBehavior(Control control)
{
var behavior = control.GetValue(DoubleClickCommandBehaviorProperty) as DoubleClickCommandBehavior;
if (behavior == null)
{
behavior = new DoubleClickCommandBehavior(control);
control.SetValue(DoubleClickCommandBehaviorProperty, behavior);
}
return behavior;
}
示例4: SetCommandParameter
public static void SetCommandParameter(Control control, object parameter)
{
control.SetValue(CommandParameterProperty, parameter);
}
示例5: SetOpenShellContextMenu
public static void SetOpenShellContextMenu(Control control, bool value)
{
control.SetValue(OpenShellContextMenuProperty, value);
}
示例6: SetEnabledOpacity
public static void SetEnabledOpacity(Control element, EnabledOpacity value) { element.SetValue(EnabledOpacityProperty, value); }
示例7: SetHint
/// <summary>
/// Sets the value of the <see cref="HintProperty"/>.
/// </summary>
/// <param name="control">A <see cref="Control"/>.</param>
/// <param name="value">The value to set.</param>
public static void SetHint(Control control, object value)
{
control.SetValue(HintProperty, value);
}
示例8: SetOneWayControlHeight
public static void SetOneWayControlHeight(Control element, double Value)
{
element.SetValue(OneWayControlHeightProperty, Value);
}
示例9: SetOperationId
private static void SetOperationId(Control control, Guid value)
{
control.SetValue(OperationIdProperty, value);
}
示例10: VisualInheritanceCore
void VisualInheritanceCore (Control c1, DependencyProperty prop1, FrameworkElement c2, DependencyProperty prop2, object value, object other)
{
Assert.AreSame (c1, c2.Parent, "#parented");
Assert.AreNotEqual (value, c1.GetValue (prop1), "#1");
Assert.AreNotEqual (value, c2.GetValue (prop2), "#2");
Assert.IsNull (VisualTreeHelper.GetParent (c2), "#c2 no parent");
Assert.AreEqual (0, VisualTreeHelper.GetChildrenCount (c1), "#c1 no children");
c1.SetValue (prop1, value);
Assert.IsNotNull (c1.GetValue (prop1), "#3");
Assert.IsNotNull (c2.GetValue (prop2), "#4");
Assert.AreNotEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#5");
// Once we connect c2 to c1 via the template visual tree, it will inherit the value
CreateAsyncTest (c1,
() => {
c1.ApplyTemplate ();
}, () => {
Assert.AreEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#6");
// And if we change the value inside the template, it affects c2
var visualParent = (FrameworkElement) VisualTreeHelper.GetChild (c1, 0);
visualParent.SetValue (prop1, other);
Assert.AreEqual (c2.GetValue (prop2), other, "#7");
}
);
}
示例11: SetFocusOnFirstElement
public static void SetFocusOnFirstElement(Control control, bool value)
{
control.SetValue(FocusOnFirstElementProperty, value);
}
示例12: SetParameter
public static void SetParameter(Control target, object value)
{
target.SetValue(ParameterProperty, value);
}
示例13: EnsureInstance
private static AutoComplete EnsureInstance( Control ctrl )
{
var ac = ( AutoComplete )ctrl.GetValue( AutoComplete.AutoCompleteInstance );
if( ac == null )
{
ac = new AutoComplete( ctrl );
//ac.SetControl( ctrl );
ctrl.SetValue( AutoCompleteInstancePropertyKey, ac );
}
return ac;
}
示例14: SetCommand
public static void SetCommand(Control target, ICommand value)
{
target.SetValue(CommandProperty, value);
}
示例15: SetFocusOnLoaded
/// <summary>
/// Sets a value indicating whether the control should receive focus on Loaded event.
/// </summary>
/// <param name="control">
/// The control.
/// </param>
/// <param name="value">
/// <c>true</c> if the control should receive focus on Loaded event; otherwise, <c>false</c>.
/// </param>
/// <exception cref="ArgumentNullException">
/// The <paramref name="control"/> parameter is null.
/// </exception>
public static void SetFocusOnLoaded(Control control, bool value)
{
if (control == null)
throw new ArgumentNullException("control");
control.SetValue(FocusOnLoadedProperty, value);
}