<Grid> <ComboBox x:Name="cmb" SelectedValuePath="Name" Height="24" Width="150" Margin="126,87,228,200"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Code}" FontWeight="Bold" Foreground="Black" Width="30"/> <TextBlock Text="{Binding Name}" Foreground="Black"/> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> </Grid>
SqlConnection conn = new SqlConnection("connection string"); SqlDataAdapter da = new SqlDataAdapter("your Query", conn); DataSet ds = new DataSet(); da.Fill(ds, "tblName"); cmb.ItemsSource = ds.Tables[0].DefaultView;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)