我正在使用 WinUI 3 和 C#。当我在 InfoBar 上设置边距时,即使 InfoBar 被隐藏,边距仍然保留。有没有办法在 InfoBar 不可见时让边距消失?或者这不可能?
<Grid Width="400">
<StackPanel>
<TextBlock>Message</TextBlock>
<InfoBar IsOpen="True" Severity="Error" Margin="0,50,0,0" Message="MessageMessageMessage"/>
<TextBlock>Message2</TextBlock>
</StackPanel>
</Grid>
Visibility
您可以像这样切换开关: