我定义了一个RelativePanel,它包含左侧的组合框和组合框右侧的切换开关。但出于某种原因,当点击组合框打开它时,弹出窗口显示内容,组合框消失。 (并通过关闭弹出窗口再次显示)。因此,包含组合框标签的文本块向右移动,弹出窗口与我的切换开关重叠... 如何防止此文本块移动以防止弹出窗口与toggleswitch重叠? (导致此问题的是comboImageSources,而不是其他组合框)
<RelativePanel x:Name="topBar" Grid.Row="0" Padding="12,0,12,0">
<!-- left side -->
<TextBlock x:Name="OCRSettings_Language"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
Text="OCR Language:"
Margin="0,0,12,0"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignVerticalCenterWithPanel="True" />
<ComboBox x:Uid="comboSettingsOCRLanguage" x:Name="comboOCRLanguages"
AutomationProperties.Name="[comboSettingsOCRLanguage]"
ItemsSource="{x:Bind Settings.OCRLanguages}"
ItemTemplate="{StaticResource ComboOCRLanguageTemplate}"
RelativePanel.RightOf="OCRSettings_Language"
RelativePanel.AlignVerticalCenterWithPanel="True"
Margin="0,0,12,0"
TabIndex="8"
Loaded="comboOCRLanguages_Loaded" />
<!-- right side -->
<TextBlock x:Name="OCRSettings_ImageSource"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
Text="Image Source:"
Margin="0,0,10,0"
RelativePanel.LeftOf="comboImageSources"
RelativePanel.AlignVerticalCenterWithPanel="True" />
<ComboBox x:Uid="comboImageSources" x:Name="comboImageSources"
AutomationProperties.Name="[comboImageSources]"
ItemsSource="{x:Bind Settings.ImageSources}"
ItemTemplate="{StaticResource ComboImageSourceTemplate}"
RelativePanel.LeftOf="OCRSettings_ColumnMode"
RelativePanel.AlignVerticalCenterWithPanel="True"
Margin="0,0,20,0"
TabIndex="4"
Loaded="comboImageSources_Loaded" />
答案 0 :(得分:3)
您必须将Width
属性设置为ComboBox
一些固定值,因为当您打开其中的选项时,它会变为非常小的值。