Desktop mode: HorizontalAlignment="Center" broken in browsers?

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

Desktop mode: HorizontalAlignment="Center" broken in browsers?

Postby cnayan » Sat Oct 15, 2016 8:19 am

Hi just downloaded the beta 10 version and created the default calculator sample app.

In browsers that I tried, Edge and Chrome, the default app is located in top-left corner, even though the default XAML code states that the canvas has to be aligned horizontally to center.

Code: Select all

<Canvas Height="415" Width="320" Background="#FF161616" HorizontalAlignment="Center">

So, I feel this is a bug: the "HorizontalAlignment" property is not being evaluated correctly.

Strangely, if I add this VerticalAlignment="Top" to canvas element, the canvas is now located perfectly at top center of the page, as expected.

Something about vertical alignment is forcing correct evaluation of horizontal. :D

Please check and comment.

Regards,
Cnayan

JS-Support
Site Admin
Posts: 789
Joined: Tue Apr 08, 2014 3:42 pm

Re: Desktop mode: HorizontalAlignment="Center" broken in browsers?

Postby JS-Support » Sat Oct 15, 2016 11:42 am

Hi Cnayan,

Welcome to the forums.

In the Microsoft XAML standard, the horizontal and vertical alignments are ignored in a Canvas. Items in a Canvas can only be positioned based on their Left/Top position. You need to use a Grid instead.

What is not normal is that setting vertical alignment affects horizontal alignment. it shouldn't. We are going to investigate this point.

Thanks.
Regards,
JS-Support

cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

Re: Desktop mode: HorizontalAlignment="Center" broken in browsers?

Postby cnayan » Sat Oct 15, 2016 7:29 pm

Hi team,

I'm afraid you have misunderstood the use of the property "HorizontalAlignment". You are confusing it with "HorizontalContentAlignment", probably.

When HorizontalAlignment="Center" is set to canvas, the canvas itself must align to center of the space, in its parent control. This property affects the control itself.

What you explained above is true for HorizontalContentAlignment="Center", where the child of the control must get centered. This property is set at parent for child.

And I understand that the canvas ignores the alignment of its children using HorizontalContentAlignment="Center", not the one I mentioned.

References:
https://msdn.microsoft.com/en-us/librar ... t(v=vs.110).aspx
https://msdn.microsoft.com/en-us/librar ... t(v=vs.110).aspx

So, there is a bug, clearly.

Its great to interact with you!

Regards,
cnayan

JS-Support
Site Admin
Posts: 789
Joined: Tue Apr 08, 2014 3:42 pm

Re: Desktop mode: HorizontalAlignment="Center" broken in browsers?

Postby JS-Support » Mon Oct 17, 2016 9:45 am

Oh, sorry, you are right. I thought you were referring to the alignment of the children of the Canvas. My mistake.

We are going to investigate this bug. I'll keep you updated asap.

Thanks a lot.
Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest

 

 

cron