Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Combobox item is not selected after load window

$
0
0

Hi,

I have a very simple combobox with items and select in the _load the first item.When running the item is not selected, after the window is resized or the mouse hovers over the combobx, the text appears....
If I remove the comboboxitem and place a label instead, it works????

Seems like a bug to me..

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525"><Grid Height="23"><Grid.ColumnDefinitions ><ColumnDefinition Width="Auto"></ColumnDefinition><ColumnDefinition Width="Auto"></ColumnDefinition></Grid.ColumnDefinitions><Label Padding="0" Content="Language" Margin="0,0,5,0" MinWidth="50" VerticalAlignment="Center" ></Label><ComboBox  Grid.Column="1" Name="ComboLanguage" MinWidth="100" MinHeight="23"  SelectionChanged="ComboLanguage_SelectionChanged" ><ComboBoxItem ><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"></ColumnDefinition><ColumnDefinition Width="Auto"></ColumnDefinition></Grid.ColumnDefinitions><Image Width="16" Height="16" Source="c:\example.png" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="2,0,5,0"></Image><Label Grid.Column="1" Content="English" VerticalAlignment="Center" HorizontalAlignment="Left"  ></Label></Grid></ComboBoxItem></ComboBox></Grid></Window>

Class MainWindow


  Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
    ComboLanguage.SelectedIndex = 0
  End Sub

  Private Sub ComboLanguage_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
    Dim b As Boolean = True
  End Sub

End Class


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>