public CanvasPositionHandle(DesignItem adornedControlItem, AdornerPanel adornerPanel, HandleOrientation orientation)
        {
            Debug.Assert(adornedControlItem != null);
            this.adornedControlItem = adornedControlItem;
            this.adornerPanel = adornerPanel;
            this.orientation = orientation;

            Angle = (double) orientation;

            canvas = (Canvas) adornedControlItem.Parent.Component;
            adornedControl = (FrameworkElement) adornedControlItem.Component;
            Stub = new MarginStub(this);
            ShouldBeVisible = true;

            leftDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.LeftProperty,
                                                                       adornedControlItem.Component.GetType());
            leftDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            rightDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.RightProperty,
                                                                        adornedControlItem.Component.GetType());
            rightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            topDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.TopProperty,
                                                                      adornedControlItem.Component.GetType());
            topDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            bottomDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.BottomProperty,
                                                                         adornedControlItem.Component.GetType());
            bottomDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            widthDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
                                                                        adornedControlItem.Component.GetType());
            widthDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            heightDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
                                                                         adornedControlItem.Component.GetType());
            heightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
            BindAndPlaceHandle();
        }
Ejemplo n.º 2
0
        private void CaptureComponent(TextBox button)
        {
            dpdWidth = DependencyPropertyDescriptor.FromProperty(TextBox.WidthProperty, typeof(TextBox));
              dpdWidth.AddValueChanged(button, OnWidthChanged);

              dpdText = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, typeof(TextBox));
              dpdText.AddValueChanged(button, OnTextChanged);
        }
Ejemplo n.º 3
0
        public ObjectTreeViewItem(object containingObject, Type baseType, string header = null)
        {
            Header = header;
            ContainingObject = containingObject;
            BaseType = baseType;

            _isExpandendDpd = DependencyPropertyDescriptor.FromProperty(TreeViewItem.IsExpandedProperty, GetType());
            _isExpandendDpd.AddValueChanged(this, IsExpandendChangedEventHandler);
        }
		protected override void OnInitialized()
		{
			base.OnInitialized();
			extendedItemArray[0] = this.ExtendedItem;
			this.ExtendedItem.PropertyChanged += OnPropertyChanged;
			
			if (this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).IsSet) {
				renderTransformOrigin = (Point)this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).ValueOnInstance;
			}
			
			AdornerPanel.SetPlacement(renderTransformOriginThumb,
			                          new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top){XRelativeToContentWidth = renderTransformOrigin.X, YRelativeToContentHeight = renderTransformOrigin.Y});
			
			renderTransformOriginPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FrameworkElement.RenderTransformOriginProperty, typeof(FrameworkElement));
			renderTransformOriginPropertyDescriptor.AddValueChanged(this.ExtendedItem.Component, OnRenderTransformOriginPropertyChanged);
		}
Ejemplo n.º 5
0
 internal void UpdatePositionTraceState()
 {
     if (EventOptions.PositionChangeNotification)
     {
         _sxDescriptor = DependencyPropertyDescriptor.FromProperty(GraphAreaBase.XProperty, typeof(VertexControl));
         _sxDescriptor.AddValueChanged(this, source_PositionChanged);
         _syDescriptor = DependencyPropertyDescriptor.FromProperty(GraphAreaBase.YProperty, typeof(VertexControl));
         _syDescriptor.AddValueChanged(this, source_PositionChanged);
     }
     else
     {
         if (_sxDescriptor != null)
             _sxDescriptor.RemoveValueChanged(this, source_PositionChanged);
         if (_syDescriptor != null)
             _syDescriptor.RemoveValueChanged(this, source_PositionChanged);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the DatePicker class. 
        /// </summary> 
        public DatePicker() {
            FocusManager.SetIsFocusScope(this, false);
            _defaultText = string.Empty;
            _timer = new DispatcherTimer();
            _timer.Tick += RenewTodayButtonContent;

            // Binding to FirstDayOfWeek and DisplayDate wont work 
            SetCurrentValue(FirstDayOfWeekProperty, CalendarEngine.GetCurrentCultureFirstDayOfWeek());
            DisplayDate = DateTime.Today;
            _isMouseOverPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(IsMouseOverProperty, typeof(UIElement));
            if (_isMouseOverPropertyDescriptor != null)
                _isMouseOverPropertyDescriptor.AddValueChanged(this, VisualStatePropertyChangedHandler);
            _isFocusedPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(IsFocusedProperty, typeof(UIElement));
            if (_isFocusedPropertyDescriptor != null)
                _isFocusedPropertyDescriptor.AddValueChanged(this, VisualStatePropertyChangedHandler);
        }
        /// <summary>
        /// Create floating window
        /// </summary>
        /// <param name="pane">Relative pane</param>
        public FloatingWindow(DockablePane pane)
        {
            InitializeComponent();
            _isTooltipEnabled = true;

            _paneHosted = pane;
            Content = _paneHosted;
            Title = _paneHosted.PaneContent.Title;

            // add code to update window header.
            _dpDescriptor = DependencyPropertyDescriptor.FromProperty(Window.TitleProperty, typeof(Window));
            if (_dpDescriptor != null)
                _dpDescriptor.AddValueChanged(_paneHosted.PaneContent, delegate
                {
                    if (Content != null)
                        Title = ((DockablePane)Content).PaneContent.Title;
                });

            _paneHosted.PaneContent.DockManager.RegisterFloatingWnd(this);
        }
Ejemplo n.º 8
0
 private void RegisterEvent()
 {
     dpdDataContext = DependencyPropertyDescriptor.FromProperty(MaskAttach.DataContextProperty, this.GetType());
     dpdDataContext.AddValueChanged(this, DataContextChanged);
     dpdTemplate = DependencyPropertyDescriptor.FromProperty(MaskAttach.TemplateProperty, this.GetType());
     dpdTemplate.AddValueChanged(this, TemplateChanged);
     (_target as FrameworkElement).Loaded -= new RoutedEventHandler(MaskAttach_Loaded);
     (_target as FrameworkElement).Unloaded += new RoutedEventHandler(MaskAttach_Unloaded);
 }
 /// <summary>
 /// Subscribe to Datacontrol ItemsSource changes
 /// </summary>
 private void Subscribe()
 {
     _sourcePropertyDescriptor = DependencyPropertyDescriptor.FromProperty(ItemsSourceProperty, 
                                                                           typeof (ItemsControl));
     _sourcePropertyDescriptor.AddValueChanged(DataControl, SourceChanged);
 }
Ejemplo n.º 10
0
 private void HookProperty(DependencyProperty property)
 {
     _dpd = DependencyPropertyDescriptor.FromProperty(property, _instance.GetType());
     _dpd.AddValueChanged(_instance, OnPropertyValueChanged);
 }