Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 public static void SetParameter(Control target, object value)
 {
     target.SetValue(ParameterProperty, value);
 }
Exemplo n.º 7
0
 /// <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);
 }
Exemplo n.º 8
0
 public static void SetCommandParameter(Control control, object parameter)
 {
     control.SetValue(CommandParameterProperty, parameter);
 }
 public static void SetTarget(Control element, UIElement value)
 {
     element.SetValue(TargetProperty, value);
 }
Exemplo n.º 10
0
 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);
 }
Exemplo n.º 13
0
		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");
				}
			);
		}
Exemplo n.º 14
0
 public static void SetComponent(Control element, IModelingDesignerComponent value)
 {
     element.SetValue(ComponentPropertyKey, value);
 }
Exemplo n.º 15
0
		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;
		}
Exemplo n.º 16
0
 public static void SetCommand(Control target, ICommand value)
 {
     target.SetValue(CommandProperty, value);
 }
Exemplo n.º 17
0
        /// <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);
        }
Exemplo n.º 18
0
 public static void SetDoubleClickCommandParameter(Control element, ICommand value)
 {
     element.SetValue(DoubleClickCommandParameterProperty, value);
 }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
		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);
 }
Exemplo n.º 22
0
 public static void SetShiftWheelScrollsHorizontally(Control element, bool value)
 => element.SetValue(ShiftWheelScrollsHorizontallyProperty, value);
 public static void SetInterceptKeySelectionEvents(Control element, bool value)
 {
     element.SetValue(InterceptKeySelectionEventsProperty, value);
 }
Exemplo n.º 24
0
 public static void SetFocusOnFirstElement(Control control, bool value)
 {
     control.SetValue(FocusOnFirstElementProperty, value);
 }
Exemplo n.º 25
0
 public static void SetStateName(Control o, string value)
 {
     o.SetValue(StateNameProperty, value);
 }
 public static void SetOneWayControlHeight(Control element, double Value)
 {
     element.SetValue(OneWayControlHeightProperty, Value);
 }
Exemplo n.º 27
0
 public static void SetWPFFocusFirst(Control control, bool value)
 {
     control.SetValue(WPFFocusFirstProperty, value);
 }
Exemplo n.º 28
0
 private static void SetOperationId(Control control, Guid value)
 {
     control.SetValue(OperationIdProperty, value);
 }
Exemplo n.º 29
0
 /// <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);
 }
Exemplo n.º 30
0
        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;
        }
Exemplo n.º 31
0
 public static void SetCommand(Control control, ICommand command)
 {
     control.SetValue(CommandProperty, command);
 }
Exemplo n.º 32
0
 /// <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);
 }
Exemplo n.º 33
0
 /// <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);
 }