Saturday, 15 June 2013

xamarin - Fill all the screen with a stacklayout -



xamarin - Fill all the screen with a stacklayout -

i have stacklayout coded this:

class="lang-cs prettyprint-override">stacklayout mainstacklayout = new stacklayout{ backgroundcolor = color.blue, //verticaloptions = layoutoptions.fillandexpand, //widthrequest = width, horizontaloptions = layoutoptions.fillandexpand, orientation = stackorientation.vertical };

but want stacklayout fill screen width , height, have tree buttons added this:

class="lang-cs prettyprint-override">stacklayout buttonsstacklayout = new stacklayout { backgroundcolor = color.white, //verticaloptions = layoutoptions.fill, horizontaloptions = layoutoptions.fill, orientation = stackorientation.horizontal, spacing = 0 }; mainstacklayout.children.add(buttonsstacklayout); image doctorimage = new image { widthrequest = width / 3, heightrequest = 50, backgroundcolor = color.gray, source = imagesource.fromfile ("about.png") }; buttonsstacklayout.children.add(doctorimage);

how can fill screensize?

in simple form have managed accomplish require.

i set content of screen main stack layout.

var mainstacklayout = new stacklayout { backgroundcolor = color.blue}; var buttonsstacklayout = new stacklayout { backgroundcolor = color.white, orientation = stackorientation.horizontal , spacing = 0 }; image = new image { heightrequest = 50, source = imagesource.fromfile("about.jpg") }; image twitter = new image { heightrequest = 50, source = imagesource.fromfile("twitter.jpg") }; image refresh = new image { heightrequest = 50, source = imagesource.fromfile("refresh.jpg") }; buttonsstacklayout.children.add(about); buttonsstacklayout.children.add(twitter); buttonsstacklayout.children.add(refresh); mainstacklayout.children.add(buttonsstacklayout); this.content = mainstacklayout;

xamarin xamarin.forms

No comments:

Post a Comment