Search code examples
c#visual-studiowindows-store-apps

Generating a rectangle in windows store app


I'm trying to generate a rectangle dynamicaly when a button is pressed in a windows store app I've tried

Rect r = new Rect();

myGrid.Children.Add(r);

but it gives me an error
"The best overloaded method match for 'name' has some invalid arguments"

what's the problem?


Solution

  • Try

    Rectangle r = new Rectangle();
    myGrid.Children.Add(r);
    

    Check this for more info.