Example #1
0
 //</Snippet5>
 //<Snippet7>
 void DrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e)
 {
     // Reattach the visual of the DynamicRenderer to the InkPresenter
     // whenever the DrawingAttributes change.
     presenter.DetachVisuals(renderer.RootVisual);
     presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes);
 }
Example #2
0
 //<Snippet6>
 void inkDA_AttributeChanged(object sender, PropertyDataChangedEventArgs e)
 {
     if (e.PropertyGuid == DrawingAttributeIds.Color)
     {
         this.Title = "The pen color is: " + e.NewValue.ToString();
     }
 }
Example #3
0
 private void DefaultDrawingAttributes_AttributeChanged(object sender, PropertyDataChangedEventArgs e)
 {
     if (e.NewValue is Color)
     {
         CreateBrush();
     }
 }
Example #4
0
 /// <summary>
 /// Event handler for stroke's drawing attributes changes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void OnStrokeDrawingAttributesChanged(object sender, PropertyDataChangedEventArgs args)
 {
     // Only enforce rehittesting of the whole stroke when the DrawingAttribute change may affect hittesting
     if (DrawingAttributes.IsGeometricalDaGuid(args.PropertyGuid))
     {
         Invalidate();
     }
 }
Example #5
0
 private void DrawingAttributesOnAttributeChanged(object sender, PropertyDataChangedEventArgs e)
 {
     if (_drawingAttributes == null)
     {
         return;
     }
     _drawingAttributes.AddPropertyData(e.PropertyGuid, e.NewValue);
 }
Example #6
0
 //<Snippet29>
 void Strokes_PropertyDataChanged(object sender, PropertyDataChangedEventArgs e)
 {
     if ((e.PropertyGuid == dateTimeGuid) && (e.NewValue is DateTime))
     {
         MessageBox.Show("The timestamp for the strokes is " +
                         ((DateTime)e.NewValue).ToString());
     }
 }
Example #7
0
        // <Snippet18>
        protected override void OnPropertyDataChanged(PropertyDataChangedEventArgs e)
        {
            // Notify base class of event
            base.OnPropertyDataChanged(e);

            // If the current stroke color changes,
            // reset the default color for the class.
            if (e.PropertyGuid.Equals(DrawingAttributeIds.Color))
            {
                myColor = this.DrawingAttributes.Color;
            }
        }
            // Token: 0x06008D2E RID: 36142 RVA: 0x00258C58 File Offset: 0x00256E58
            internal void OnDrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e)
            {
                DrawingAttributes drawingAttributes = (DrawingAttributes)sender;

                drawingAttributes.AttributeChanged    -= this.OnDrawingAttributesChanged;
                drawingAttributes.PropertyDataChanged -= this.OnDrawingAttributesChanged;
                if (this._owner.ReadLocalValue(InkCanvas.DefaultDrawingAttributesProperty) == DependencyProperty.UnsetValue)
                {
                    this._owner.SetValue(InkCanvas.DefaultDrawingAttributesProperty, drawingAttributes);
                }
                PropertyMetadata metadata = InkCanvas.DefaultDrawingAttributesProperty.GetMetadata(this._owner.DependencyObjectType);

                metadata.ClearCachedDefaultValue(this._owner, InkCanvas.DefaultDrawingAttributesProperty);
            }
Example #9
0
        /// <summary>
        /// Function to raise events when a property has been changed.
        /// Make sure we're in the proper synchronization context before sending.
        /// Allow sending property data with the event.
        /// </summary>
        /// <param name="propertyData">The data to pass along with the property name.</param>
        /// <param name="propertyName">The name of the property that was modified.</param>
        protected void OnPropertyDataChanged <T>(T propertyData, [CallerMemberName] string propertyName = "")
        {
            PropertyDataChangedEventArgs <T> e = new PropertyDataChangedEventArgs <T>(propertyName, propertyData);

            if (SynchronizationContext.Current == originalSynchronizationContext)
            {
                // Execute the PropertyChanged event on the current thread
                RaisePropertyChanged(e);
            }
            else
            {
                // Raises the PropertyChanged event on the creator thread
                originalSynchronizationContext.Send(RaisePropertyChanged, e);
            }
        }
Example #10
0
        // <Snippet15>
        protected override void OnDrawingAttributesChanged(PropertyDataChangedEventArgs e)
        {
            // Notify base class of event
            base.OnDrawingAttributesChanged(e);

            // See if the change was a new DrawingAttribute.Color property
            Type eT = e.NewValue.GetType();

            //if (eT == typeof(Color))
            //{
            //    Color c = (Color)e.NewValue;

            //    if (c == Colors.Red)
            //    {
            //        MessageBox.Show("The stroke is now red!");
            //    }
            //}
        }
Example #11
0
            /// <summary>
            /// A handler for both AttributeChanged and PropertyDataChanged.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            internal void OnDrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e)
            {
                DrawingAttributes value = (DrawingAttributes)sender;

                // The current instance will be promoted to the local value other than the default value.
                // Then we could just remove our handlers to stop tracking.
                value.AttributeChanged    -= new PropertyDataChangedEventHandler(OnDrawingAttributesChanged);
                value.PropertyDataChanged -= new PropertyDataChangedEventHandler(OnDrawingAttributesChanged);

                //
                // We only promote the value when there is no local value set yet.
                if (_owner.ReadLocalValue(InkCanvas.DefaultDrawingAttributesProperty) == DependencyProperty.UnsetValue)
                {
                    // Promote the instance to the local value.
                    _owner.SetValue(InkCanvas.DefaultDrawingAttributesProperty, value);
                }

                // Remove this value from the DefaultValue cache so we stop
                // handing it out as the default value now that it has changed.
                PropertyMetadata metadata = InkCanvas.DefaultDrawingAttributesProperty.GetMetadata(_owner.DependencyObjectType);

                metadata.ClearCachedDefaultValue(_owner, InkCanvas.DefaultDrawingAttributesProperty);
            }
Example #12
0
 protected override void OnDrawingAttributesChanged(PropertyDataChangedEventArgs e)
 {
     base.OnDrawingAttributesChanged(e);
     InitPen();
 }
Example #13
0
        // </Snippet17>

        void MyStroke_PropertyDataChanged(object sender, PropertyDataChangedEventArgs e)
        {
        }
Example #14
0
 void myNewStroke_DrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e)
 {
 }
Example #15
0
        //</Snippet6>

        void DefaultDrawingAttributes_AttributeChanged(object sender, PropertyDataChangedEventArgs e)
        {
            this.Title = "default attribute changed";
        }
 protected override void OnPropertyDataChanged(PropertyDataChangedEventArgs e)
 {
     base.OnPropertyDataChanged(e);
 }
Example #17
0
 void DrawingAttributes_PropertyDataChanged(object sender, PropertyDataChangedEventArgs e)
 {
     this.OnInvalidated(new EventArgs());
 }