locked
Rectangle radius and fill RRS feed

  • Question

  • Hi,

    the following

    var box = new Rectangle
                  {
                      RadiusX = 50,
                      RadiusY = 50,
                      Stroke = "Blue"
                      StrokeThickness = 2,
                      Fill = "Red"
                  };

    gives me a blue circle within a red rectangle rather than a red disk with a blue border.

    (note: this is pseudo code as color sactually come from a converter from xamarin.forms color).

    • Moved by Fred Bao Monday, October 19, 2015 10:40 AM
    Wednesday, October 7, 2015 5:08 PM

Answers

  • Thanks for the clear clarification, and after consulting this issue internal, we find this is actually related with xamarin development. Since you mention there is not a windows phone section, my suggestion is that you could post a uservoice to xamarin.uservoice.(due to forum policy, we cannot help to post it...)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Just Karl Friday, October 23, 2015 10:49 PM
    Thursday, October 8, 2015 10:07 AM

All replies

  • Hello francois.m,

    Welcome to the MSDN forum and I would suggest you could check this guide post to add a proper tag for the thread title to let us understand your problem clearer.

    >>gives me a blue circle within a red rectangle rather than a red disk with a blue border.

    Since you post your issue to this forum, I would think you want to want a result like in below photograph in windows runtime development(why for runtime because the rectangle class is for windows runtime only):

    If I am correctly, you could use the Ellipse class instead of the Rectangle class, it could give the wanted result when using below code:

    <StackPanel VerticalAlignment="Center">
    <Ellipse  Stroke="Blue" StrokeThickness="2" Fill="Red" Height="150" Width="150"/>
    </StackPanel>
    

    In your case, you could write it in background via code as:

    var box = new Ellipse
    
                {
    
                    Width = 150,
    
                    Height = 150,
    
                    Stroke = new SolidColorBrush(Colors.Blue),
    
                    StrokeThickness = 2,
    
                    Fill = new SolidColorBrush(Colors.Red)
    
                };
    

    >> (note: this is pseudo code as color sactually come from a converter from xamarin.forms color).

    Please note that the code is for windows runtime project and if you are developing the xamarin project, please ask questions about xamarin on the xamarin support forum.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    </stackpanel>
    • Edited by Fred Bao Thursday, October 8, 2015 6:22 AM
    • Proposed as answer by Vaikesh K P Thursday, October 22, 2015 9:51 AM
    Thursday, October 8, 2015 6:19 AM
  • Hi Fred and thanks for you reply.

    You're right, I did not expose my issue properly so let me rephrase :-)

    I develop a cross Platform app with xamarin. I'm trying to show a rounded rectangle with a background color and a border color. To do so I'm using renderers for iOS, Android and Windows. I achieve to do it on iOS and Android. My issue is solely with Windows. I didn't post on the Xamarin forum as they don't have a Windows section (Strange but you can verify lol).

    I took the example of a circle (which is a particular rounded rectangle) as I thought it would illustrate my issue better. The thing is when I fill the rounded rectangle, it doesn't respect the radius and always fill a rectangle (while the border, or stroke, is rounded).

    I hope it is clearer.

    François

    Thursday, October 8, 2015 6:58 AM
  • Thanks for the clear clarification, and after consulting this issue internal, we find this is actually related with xamarin development. Since you mention there is not a windows phone section, my suggestion is that you could post a uservoice to xamarin.uservoice.(due to forum policy, we cannot help to post it...)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Just Karl Friday, October 23, 2015 10:49 PM
    Thursday, October 8, 2015 10:07 AM