标签固定位置

时间:2018-10-26 19:01:31

标签: xaml button label

我在Label的两边都有两个按钮。
如果这两个Button中的任何一个被删除,我希望Label保持居中于固定位置。

有什么方法可以锁定此Label的位置?

<DockPanel LastChildFill="True">
    <DockPanel DockPanel.Dock="Top" Margin="4,8,4,8" LastChildFill="True">
        <Button Name="SearchBackButton" Style="{DynamicResourceInfoButtonStyle}" Content="{StaticResource SearchBackButton}"  
          VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,0,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Left" Click="SearchBackButton_Click" />
        <Label HorizontalAlignment="Center" FontFamily="HelveticaNeue"   FontSize="14" FontStyle="Normal" FontWeight="SemiBold" Foreground="#273238" Name="SuggestedTemplatesText" Content="{x:Static res:UIStrings.SuggestedTemplates}"/>
        <Button Name="info_icon" Style="{DynamicResource InfoButtonStyle}" Click="InfoButton_Click"  
           VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Right"/>
    </DockPanel>
</DockPanel>       <!-- Added by edit -->

这是Label和两个Button的代码。

enter image description here

0 个答案:

没有答案