Get ProgressBar to fill StatusBarItem

前端 未结 1 777
难免孤独
难免孤独 2021-02-19 03:16

I have a StatusBar that I\'d like to house a TextBlock docked to the left and a ProgressBar filling the remaining width. In all my other e

相关标签:
1条回答
  • 2021-02-19 03:43

    You just need one extra attribute: HorizontalContentAlignment="Stretch" on the StatusBarItem. Thus:

    <StatusBar DockPanel.Dock="Bottom" Height="25">
      <StatusBarItem DockPanel.Dock="Left">
        <TextBlock x:Name="lblStatus" Margin="5,0,0,0"/>
      </StatusBarItem>
      <StatusBarItem HorizontalContentAlignment="Stretch">  <!-- Note extra attribute -->
        <ProgressBar x:Name="pgbStatus" />
      </StatusBarItem>
    </StatusBar>
    
    0 讨论(0)
提交回复
热议问题