2017-02-20 58 views
1

enter image description here打開組合框移動的其他控件

我定義爲包含在左側和右側組合框的toggleswitch右的組合框一個RelativePanel。但由於某種原因,當點擊組合框打開組合框時,會彈出一個內容,組合框消失。 (並通過關閉彈出框再次變爲可見)。正因爲如此,包含組合框標籤的文本塊向右移動,彈出框與我的撥動開關重疊... 如何防止移動此文本塊以防止彈出框重疊撥動開關? (它是引起此問題,而不是其他組合框的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

如果您從組合框中刪除ItemTemplate定義,它會幫助還是改變任何東西? –

+0

沒有。 itemtemplate定義了組合框需要顯示的內容。在我的情況下,圖像源的名稱。如果我刪除它,效果是一樣的 – PrisonMike

回答

3

您必須將Width屬性的ComboBox設置爲某個固定的值,因爲它,當你打開的選項更改爲非常小的值它。

+1

我不得不設置minWidth。我討厭這樣做。如果框中的值有更大的寬度,我可能會遇到同樣的問題 – PrisonMike

+0

是的,您必須手動將其調整爲最寬的ComboBoxItem afaik .. –