[SOLVED] 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: 84
Joined: Tue May 30, 2017 9:44 am
Contact:

[SOLVED] 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 12781 times

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


PS. Javascript code was create on Build action

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

fangeles
Posts: 52
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: 84
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 ?)

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

Re: button position, Design vs RunTime

Postby JS-Support @Userware » Tue Apr 21, 2020 2:10 am

Hi,

This issue has been fixed in a recent version.

In particular, I have just tested it with version "2.0.0-alpha62-082", and it works fine, as shown in the following screenshot:
button position - Design vs RunTime.png
button position - Design vs RunTime.png (94.34 KiB) Viewed 12235 times


To upgrade from v1.x to v2.x, create a backup of your project, then go to the Nuget package manager, search for CSHTML5, check "include preleases", and install the latest CSHTML5 package.

Thanks
Regards


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 32 guests

 

 

cron