/// <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); }
/// <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); }
public static void Apply(swc.Control control, Font font) { if (control == null) { return; } if (font != null) { ((FontHandler)font.Handler).Apply(control); } else { control.SetValue(swc.Control.FontFamilyProperty, swc.Control.FontFamilyProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontStyleProperty, swc.Control.FontStyleProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontWeightProperty, swc.Control.FontWeightProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontSizeProperty, swc.Control.FontSizeProperty.DefaultMetadata.DefaultValue); } }
public static Font SetEtoFont(this swc.Control control, Font font, Action <sw.TextDecorationCollection> setDecorations = null) { if (control == null) { return(font); } if (font != null) { ((FontHandler)font.Handler).Apply(control, setDecorations); } else { control.SetValue(swc.Control.FontFamilyProperty, swc.Control.FontFamilyProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontStyleProperty, swc.Control.FontStyleProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontWeightProperty, swc.Control.FontWeightProperty.DefaultMetadata.DefaultValue); control.SetValue(swc.Control.FontSizeProperty, swc.Control.FontSizeProperty.DefaultMetadata.DefaultValue); } return(font); }
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; }
public static void SetParameter(Control target, object value) { target.SetValue(ParameterProperty, value); }
/// <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); }
public static void SetCommandParameter(Control control, object parameter) { control.SetValue(CommandParameterProperty, parameter); }
public static void SetTarget(Control element, UIElement value) { element.SetValue(TargetProperty, value); }
public static void SetEnabledOpacity(Control element, EnabledOpacity value) { element.SetValue(EnabledOpacityProperty, value); }
public static void SetIsControlSizeBound(Control element, bool Value) { element.SetValue(IsControlSizeBoundProperty, Value); }
public static void SetOneWayControlWidth(Control element, double Value) { element.SetValue(OneWayControlWidthProperty, Value); }
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"); } ); }
public static void SetComponent(Control element, IModelingDesignerComponent value) { element.SetValue(ComponentPropertyKey, value); }
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; }
public static void SetCommand(Control target, ICommand value) { target.SetValue(CommandProperty, value); }
/// <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); }
public static void SetDoubleClickCommandParameter(Control element, ICommand value) { element.SetValue(DoubleClickCommandParameterProperty, value); }
public static void SetText(Control adornedElement, string placeholderText) { if (adornedElement == null) throw new ArgumentNullException("adornedElement"); if (!(adornedElement is TextBox || adornedElement is RichTextBox || adornedElement is PasswordBox)) throw new InvalidOperationException(); adornedElement.SetValue(TextProperty, placeholderText); }
void LogicalInheritanceCore (Control c1, DependencyProperty prop1, FrameworkElement c2, DependencyProperty prop2, object value, object other) { // Check that we inherit values even if the visual tree doesn't exist, // i.e. if we use logical inheritance. 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.AreEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#5"); // Now generate a visual tree with 'c2' at the end and check that the visual // tree doesn't affect which value is inherited CreateAsyncTest (c1, () => { c1.ApplyTemplate (); }, () => { var visualParent = (FrameworkElement) VisualTreeHelper.GetChild (c1, 0); visualParent.SetValue (prop1, other); Assert.AreEqual (c2.GetValue (prop2), value, "#6"); } ); }
public static void SetOpenShellContextMenu(Control control, bool value) { control.SetValue(OpenShellContextMenuProperty, value); }
public static void SetShiftWheelScrollsHorizontally(Control element, bool value) => element.SetValue(ShiftWheelScrollsHorizontallyProperty, value);
public static void SetInterceptKeySelectionEvents(Control element, bool value) { element.SetValue(InterceptKeySelectionEventsProperty, value); }
public static void SetFocusOnFirstElement(Control control, bool value) { control.SetValue(FocusOnFirstElementProperty, value); }
public static void SetStateName(Control o, string value) { o.SetValue(StateNameProperty, value); }
public static void SetOneWayControlHeight(Control element, double Value) { element.SetValue(OneWayControlHeightProperty, Value); }
public static void SetWPFFocusFirst(Control control, bool value) { control.SetValue(WPFFocusFirstProperty, value); }
private static void SetOperationId(Control control, Guid value) { control.SetValue(OperationIdProperty, value); }
/// <summary> /// Sets the value for the EventName attached property on the provided <see cref="Control"/>. /// </summary> /// <param name="control">DependencyObject to attach the EventName to.</param> /// <param name="eventName">The name of the event to attach.</param> public static void SetEventName(Control control, String eventName) { control.SetValue(EventNameProperty, eventName); }
private static CommandBehaviorBase<Control> GetOrCreateBehavior(Control control) { var behavior = control.GetValue(EventCommandBehaviorProperty) as CommandBehaviorBase<Control>; if (behavior == null) { behavior = CreateCommandBehavior(control, control.GetValue(EventNameProperty).ToString()); control.SetValue(EventCommandBehaviorProperty, behavior); } return behavior; }
public static void SetCommand(Control control, ICommand command) { control.SetValue(CommandProperty, command); }
/// <summary> /// Sets the current visual state of the specified control. /// </summary> /// <param name="control">The control to set.</param> /// <param name="state">The name of the state that the control should be in.</param> public static void SetVisualState(Control control, string state) { control.SetValue(VisualStateProperty, state); }
/// <summary> /// Sets the value of the <see cref="HintBrushProperty"/>. /// </summary> /// <param name="control">A <see cref="Control"/>.</param> /// <param name="value">The value to set.</param> public static void SetHintBrush(Control control, Brush value) { control.SetValue(HintBrushProperty, value); }