locked
C++ set margin

    Question

  • How do I set margin on an ellipse through code?

    I have the following

            auto p = ref new Windows::UI::Xaml::Shapes::Ellipse();
    	p->Height=100.0;
    	p->Width=100.0;
    	//p->Margin="36,19,0,0";
    	auto t = ref new Windows::UI::Xaml::Thickness(10.0,20.0,30.0,40.0);

    how do I assign that to p?

    Friday, March 02, 2012 5:38 PM

Answers

  • Hi MehulRastogi,
    Thickness is a value class instead of ref class. You can set the value as  following:
     Thickness t;
     t.Left = 10;
     t.Right=30;
     t.Top=10;
     t.Bottom=100;
     p->Margin=t;

    Best Regards,
    Han Xia


    Monday, March 05, 2012 8:04 AM
    Moderator