button position, Design vs RunTime

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.
Nick
Posts: 83
Joined: Tue May 30, 2017 9:44 am
Contact:

button position, Design vs RunTime

Postby Nick » Tue Jan 14, 2020 10:06 am

On Design, Button is on Horizontal Center
Design1.png
Design1.png (168.57 KiB) Viewed 509 times

On RunTime Button is on Left
runtime1.png
RunTime
runtime1.png (105.98 KiB) Viewed 509 times


PS. Javascript code was create on Build action

See attachement
App.zip
(3.32 KiB) Downloaded 55 times

fangeles
Posts: 42
Joined: Wed Jan 16, 2019 12:48 am

Re: button position, Design vs RunTime

Postby fangeles » Fri Feb 07, 2020 7:17 pm

StackPanel automatically stacks child controls on the left (Orientation="Horizontal") or top (Orientation="Vertical"). I've also noticed that the designer does not display the XAML code correcty (mine's not displaying an output at all, instead errors also because of the ResourceDictionaries).

If you want to achieve the expected output using the StackPanel, set the StackPanel's width, then set the child control's horizontal alignment to center.

Example:

Code: Select all

<StackPanel Width="200">
   <Button Content="Hello" HorizontalAlignment="Center"/>
</StackPanel>


Or since setting the StackPanel's width is hassle and may not match the screen's width, you may use a Grid. (The grid automatically docks to the parent container and occupies the available space if you haven't set the width, height, horizontal and vertical alignments, and if you did not put the grid inside stackpanel or wrappanel)

Nick
Posts: 83
Joined: Tue May 30, 2017 9:44 am
Contact:

Re: button position, Design vs RunTime

Postby Nick » Sat Feb 08, 2020 4:50 pm

I know how to avoid that, but this is a BUG
PS. What you will do when you convert an app from silverlight to cshtml5 ? Modify the code also ? (change the app flow ?)


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 0 guests

 

 

cron