Horizontal StackPanel Width Using Percentages

Hi, I’m facing a very fundamental problem with the code below… My 4 buttons take up the MinWidth value regardless of my screen width, and if I remove MinWidth, it doesn’t care about the ‘Width=“25%”’. This problem seems to only affect when using percentages… Any ninjas willing to help a noob? ^^


<StackPanel Orientation="Horizontal">
        <Button MinWidth="10" Width="25%" />

    <Button Text="1" />
    <Button Text="2" />
    <Button Text="3" />
    <Button Text="4" />

The layout model we’re using doesn’t support a percentage width within a horizontal stack panel. It’ll just end up being the minimum width.

I’m currently looking at doing a significant overhaul of the layout system and adding support for this type of thing will hopefully become possible.

It you just want to have four buttons that fit the width of the screen you can use a grid:

<Grid ColumnCount="4">...</Grid>