コード例 #1
0
ファイル: SpellCheck.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Gets spell checking culture of the specified control.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <returns>
        /// The spell checking culture.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="control"/> parameter is null.
        /// </exception>
        public static CultureInfo GetCulture(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            return (CultureInfo)control.GetValue(CultureProperty);
        }
コード例 #2
0
ファイル: BubbleScrolling.cs プロジェクト: Nimgoble/Jibbr
        /// <summary>
        /// Gets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be retrieved.
        /// </param>
        /// <returns>
        /// The IsSendingMouseWheelEventToParent, or <see langword="null"/>
        /// if no IsSendingMouseWheelEventToParent has been set.
        /// </returns>
        public static bool? GetIsSendingMouseWheelEventToParent(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("");

            return control.GetValue(ScrollProperty) as bool?;
        }
コード例 #3
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
        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
0
 /// <summary>
 /// This method retrieves the default style key of a control.
 /// </summary>
 /// <param name="control">The control to retrieve the default style key 
 /// from.</param>
 /// <returns>The default style key of the control.</returns>
 public static object GetDefaultStyleKey(Control control)
 {
     return control.GetValue(Control.DefaultStyleKeyProperty);
 }
コード例 #5
0
 public static double GetOneWayControlHeight(Control element)
 {
     return (double)element.GetValue(OneWayControlHeightProperty);
 }
コード例 #6
0
ファイル: SpellCheck.cs プロジェクト: mparsin/Elements
 private static Guid GetOperationId(Control control)
 {
     return (Guid)control.GetValue(OperationIdProperty);
 }
コード例 #7
0
 public static bool GetShiftWheelScrollsHorizontally(Control element)
 => (bool)element.GetValue(ShiftWheelScrollsHorizontallyProperty);
コード例 #8
0
 public static bool GetFocusOnFirstElement(Control control)
 {
     return (bool)control.GetValue(FocusOnFirstElementProperty);
 }
コード例 #9
0
        void selectedDevice_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            selectedDevice = (Control)sender;
            selectedDevice.CaptureMouse();
            deltaX = e.GetPosition(grdDeviceLayer).X - ((Thickness)selectedDevice.GetValue(Grid.MarginProperty)).Left;
            deltaY = e.GetPosition(grdDeviceLayer).Y - ((Thickness)selectedDevice.GetValue(Grid.MarginProperty)).Top;

            UnSelectAllDevice();

            (sender as I_IO).IsSelect = true;
            this.grdSetting.DataContext = selectedDevice.DataContext;
           // throw new NotImplementedException();
        }
コード例 #10
0
ファイル: FrameworkElementTest.cs プロジェクト: dfr0/moon
		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
0
 public static bool GetOpenShellContextMenu(Control control)
 {
     return (bool)control.GetValue(OpenShellContextMenuProperty);
 }
コード例 #12
0
 public static bool GetInterceptKeySelectionEvents(Control element)
 {
     return (bool)element.GetValue(InterceptKeySelectionEventsProperty);
 }
コード例 #13
0
 public static object GetParameter(Control target)
 {
     return target.GetValue(ParameterProperty);
 }
コード例 #14
0
 public static ICommand GetCommand(Control target)
 {
     return (ICommand)target.GetValue(CommandProperty);
 }
コード例 #15
0
ファイル: ScrollExtension.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Gets a value indicating whether the control should receive focus on Loaded event.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <returns>
        /// <c>true</c> if the control should receive focus on Loaded event; otherwise, <c>false</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="control"/> parameter is null.
        /// </exception>
        public static bool GetFocusOnLoaded(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            return (bool)control.GetValue(FocusOnLoadedProperty);
        }
コード例 #16
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;
		}
コード例 #17
0
ファイル: VSM.cs プロジェクト: thnk2wn/codestock-winphone
 public static string GetStateName(Control o)
 {
     return (string)o.GetValue(StateNameProperty);
 }
コード例 #18
0
ファイル: FrameworkElementTest.cs プロジェクト: dfr0/moon
		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");
				}
			);
		}
コード例 #19
0
ファイル: FocusBehavior.cs プロジェクト: Mikescher/Passpad
 public static bool GetWPFFocusFirst(Control control)
 {
     return (bool)control.GetValue(WPFFocusFirstProperty);
 }
コード例 #20
0
ファイル: UndoManager.cs プロジェクト: kevlut/UndoRedo
 private static void Subscribe(Control control, DependencyProperty property)
 {
     var binding = BindingOperations.GetBinding(control, property);
     if (binding != null && binding.IsBoundToDataContext())
     {
         if (!binding.IsNotifiying())
         {
             binding = binding.CreateNotifying(control.DataContext);
             BindingOperations.ClearBinding(control, property);
             BindingOperations.SetBinding(control, property, binding);
         }
         control.SourceUpdated += (o, args) =>
         {
             if (args.Property == property)
             {
                 var undoManager = GetUndoManager(control);
                 var value = control.GetValue(property);
                 undoManager._history.Update(control, value, property, UpdateReason.UserInput);
             }
         };
         control.TargetUpdated += (o, args) =>
         {
             if (args.Property == property)
             {
                 var undoManager = GetUndoManager(control);
                 var value = control.GetValue(property);
                 undoManager._history.Update(control, value, property, UpdateReason.DataUpdated);
             }
         };
     }
 }
コード例 #21
0
ファイル: Commander.cs プロジェクト: brentedwards/Movies
        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;
        }
コード例 #22
0
ファイル: ModelingDesigner.cs プロジェクト: 569550384/Rafy
 /// <summary>
 /// 获取外层的控件。
 /// 
 /// DesignerItem 返回 BlockControl。
 /// Connection 返回 Controls.Connection
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public static IModelingDesignerComponent GetComponent(Control element)
 {
     return element.GetValue(ComponentProperty) as IModelingDesignerComponent;
 }
コード例 #23
0
ファイル: Commander.cs プロジェクト: brentedwards/Movies
 /// <summary>
 /// Gets the value in EventName attached property on the provided <see cref="Control"/>.
 /// </summary>
 /// <param name="control">The DependencyObject that has the EventName.</param>
 /// <returns>The value of the property.</returns>
 public static String GetEventName(Control control)
 {
     return control.GetValue(EventNameProperty).ToString();
 }
コード例 #24
0
 public static bool GetIsControlSizeBound(Control element)
 {
     return (bool)element.GetValue(IsControlSizeBoundProperty);
 }
コード例 #25
0
 public static EnabledOpacity GetEnabledOpacity(Control element) { return (EnabledOpacity)element.GetValue(EnabledOpacityProperty); }
コード例 #26
0
 public static double GetOneWayControlWidth(Control element)
 {
     return (double)element.GetValue(OneWayControlWidthProperty);
 }
コード例 #27
0
 public static ICommand GetDoubleClickCommand(Control element)
 {
     return (ICommand)element.GetValue(DoubleClickCommandProperty);
 }
コード例 #28
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
 public static ICommand GetCommand(Control control)
 {
     return control.GetValue(CommandProperty) as ICommand;
 }
コード例 #29
0
 public static object GetDoubleClickCommandParameter(Control element)
 {
     return element.GetValue(DoubleClickCommandParameterProperty);
 }
コード例 #30
0
ファイル: Interaction.cs プロジェクト: nikhilk/silverlightfx
 /// <summary>
 /// Gets the visual state associated with the specified control.
 /// </summary>
 /// <param name="control">The control to lookup.</param>
 /// <returns>The current visual state as it was last set.</returns>
 public static string GetVisualState(Control control)
 {
     return (string)control.GetValue(VisualStateProperty);
 }
コード例 #31
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
 public static object GetCommandParameter(Control control)
 {
     return control.GetValue(CommandParameterProperty);
 }