xaml - Silverlight: how to set a button's width to the maximum available space? -


I am relatively inexperienced with Silverlight UI development, please forgive me if there is a clear answer to this question, but I am unable Here to find one or "outside"

I just want to set the width of a button to the maximum available space. This is "essentially" the width of its parents, although margins and so on (on both) will be playable.

I have a list of dynamically generated buttons inside the items control, which is arranged systematically, and wants all those who use the full width available in the parents. I have seen examples that bind the parents' breadth, but I was hoping for another brief solution, because the width of the parents is not ideal due to scroll bars, margins and other elements.

Any advice regarding this will be beneficial and commendable.

EDIT: In response to the request to post the XAML, I did it.

XAML I initially (with a hard-coded width):

  & lt; ScrollViewer VerticalScrollBarVisibility = "Auto" HorizontalScrollBarVisibility = "Hidden" Height = "500" margin = "0" & ​​gt; & Lt; Items Controlled Items Source = "{SomeOptions Binding}" & gt; & Lt; ItemsControl.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Stackpayel margin = "0,0,0,1" & gt; & Lt; Button content = "{bound option}" height = "auto" width = "400" horizontal content alignment = "left" /> & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate> & Lt; / ItemsControl & gt; & Lt; / ScrollViewer & gt;   

And now, (using "Statch"), thanks for the accepted answer:

   & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate> & Lt; / ItemsControl & gt; & Lt; / ScrollViewer & gt; You can set horizontal align = "stretch" on the button  

Will stretch up to the width of the parents

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -