Stretch StatusBarItem
-
I'm trying to make a StatusBar with four text items distributed evenly across the available width like this:
-----------------------------------------------------------------
| status1 | status2 | status3 | status4 |Instead I'm getting this:
-----------------------------------------------------------------
| status1 | status2 | status3 | status4 |...when I use the following code, which looks like it should do the trick:
What's wrong ? Thanks, J-L
-
I'm trying to make a StatusBar with four text items distributed evenly across the available width like this:
-----------------------------------------------------------------
| status1 | status2 | status3 | status4 |Instead I'm getting this:
-----------------------------------------------------------------
| status1 | status2 | status3 | status4 |...when I use the following code, which looks like it should do the trick:
What's wrong ? Thanks, J-L
I believe the StatusBar, by default, uses a DockPanel to handle its layout... Unless you specify otherwise, a DockPanel will left-dock all but the last item (Which will fill the remaining space). You can change the layout by changing the ItemsPanel property of the StatusBar (It's just an ItemsControl):
<StatusBar ...>
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
...
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>...items...
</StatusBar>
If the separators aren't necessary, the easiest way is to use a UniformGrid, which will divide the space equally (Just set Rows = 1 and leave Columns blank). If you want to keep the separators, you could try using a regular Grid, and define columns for everything ("Auto" for separator columns, "*" for item columns).
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
I believe the StatusBar, by default, uses a DockPanel to handle its layout... Unless you specify otherwise, a DockPanel will left-dock all but the last item (Which will fill the remaining space). You can change the layout by changing the ItemsPanel property of the StatusBar (It's just an ItemsControl):
<StatusBar ...>
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
...
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>...items...
</StatusBar>
If the separators aren't necessary, the easiest way is to use a UniformGrid, which will divide the space equally (Just set Rows = 1 and leave Columns blank). If you want to keep the separators, you could try using a regular Grid, and define columns for everything ("Auto" for separator columns, "*" for item columns).
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)It works perfectly, thanks a lot !