none
Error when setting fill on an object

    General discussion

  • I seem to be having an intermittent issue when setting the Fill on a rectangle or the Background on a Canvas, in the .Net code behind.  Code looks something like this:

                        Rectangle hh = new Rectangle();                      
     ---->             hh.Fill = new SolidColorBrush(Color.FromArgb(0x99, 0xbd, 0x80, 0x80));
                        hh.SetValue(Canvas.ZIndexProperty, 25);
                        hh.IsHitTestVisible = false;                    
                        this._squareContainer.Children.Add(hh);

    The exception I get is an ArgumentException, message "Value does not fall within the expected range" and no inner exception, but it only happens every once in a while when running the same code.  Anyone got any ideas?
                   

    Thursday, May 24, 2007 8:23 PM