Bug 324963 (MONO82294) - Controls. don't invalidate properly
Summary: Controls. don't invalidate properly
Status: RESOLVED WORKSFORME
Alias: MONO82294
Product: Moonlight
Classification: Mono
Component: engine (show other bugs)
Version: 1.0.0
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-02 21:10 UTC by Alan McGovern
Modified: 2007-11-13 13:48 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:46:42 UTC


---- Reported by alan.mcgovern@gmail.com 2007-08-02 14:10:49 MST ----

I have a class as defined at the end of the description. When this control
is removed from a canvas, it doesn't invalidate the canvas correctly. It
still appears on the canvas, but i can 'wipe' it out by dragging another
shape over it.

public class SelectionRectangle : Control
    {
		private Rectangle rect;
		
        public SelectionRectangle()
            :base()
        {
            InitializeFromXaml("<Canvas><Rectangle Name=\"Rect\" /></Canvas>");
            rect = (Rectangle)FindName("Rect");
            rect.Opacity = 0.33;
            rect.Fill = new SolidColorBrush(Colors.Blue);
            rect.Stroke = new SolidColorBrush(Colors.Green);
            rect.StrokeDashArray = new double[] {5, 5 };
            rect.StrokeThickness = 2;
            SetValue<int>(ZIndexProperty, int.MaxValue);
        }
		
		public override object GetValue (DependencyProperty property)
		{
			return rect.GetValue(property);
		}
		
		public override void SetValue<T> (DependencyProperty property, T obj)
		{
			rect.SetValue<T>(property, obj);
		}

    }


Unknown operating system unknown. Setting to default OS "Other".

Comment 1 Sebastien Pouliot 2007-11-13 13:48:26 UTC
The invalidation works correctly when adding/removing the control.

E.g.
	    public void OnKeyDown (Object sender, KeyboardEventArgs e)
	    {
		    if (sel == null)
		    {
			    sel = new SelectionRectangle();
			    sel.SetValue(Canvas.LeftProperty, 50);
			    sel.SetValue(Canvas.TopProperty, 20);
			    this.Children.Add(sel);
		    }
		    else
		    {
			    Children.Remove(sel);
			    sel = null;
		    }
	    }