KevinJoeBadger
asked on
Combo Box won't display data from database correctly
combo-issue.docx
See attached screen dump
Although I have attached this combo to a table ok and I can select any account in the drop down the combo itself refuses to display the selected item?
However I resize it makes no difference.
Any Ideas?
This is XAML for combo box
<ComboBox AllowDrop="False" DataContext="{Binding}" Height="23" IsEnabled="True" IsSynchronizedWithCurrentI tem="True" ItemTemplate="{StaticResou rce AccountTemplate}" ItemsSource="{Binding}" Margin="0,13,14,0" Name="AccountsList" VerticalAlignment="Top" SelectionChanged="Accounts List_Selec tionChange d" HorizontalAlignment="Right " Width="576">
This is data template
<Window x:Class="VirginOneAccount. AccountInf o"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Account Information" Height="410" Width="874" Loaded="Window_Loaded" Closed="Window_Closed" Name="AccountsForm" WindowStartupLocation="Cen terScreen" Initialized="AccountsForm_ Initialize d">
<Window.Resources>
<DataTemplate x:Key="AccountTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=AccountName}"/>
</StackPanel>
</DataTemplate>
As you can imgaine I am fairly new to c#
See attached screen dump
Although I have attached this combo to a table ok and I can select any account in the drop down the combo itself refuses to display the selected item?
However I resize it makes no difference.
Any Ideas?
This is XAML for combo box
<ComboBox AllowDrop="False" DataContext="{Binding}" Height="23" IsEnabled="True" IsSynchronizedWithCurrentI
This is data template
<Window x:Class="VirginOneAccount.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Account Information" Height="410" Width="874" Loaded="Window_Loaded" Closed="Window_Closed" Name="AccountsForm" WindowStartupLocation="Cen
<Window.Resources>
<DataTemplate x:Key="AccountTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=AccountName}"/>
</StackPanel>
</DataTemplate>
As you can imgaine I am fairly new to c#
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
no, noting overrides the combo box style.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No Joy
As far as I can see the two combos on this form are declared similarly
When hover over the errant one the strange "edit box" appears (see attachment)
I have made the combo larger so you can see what I mean
What is the control withing the combo box?
larger-combo.docx
As far as I can see the two combos on this form are declared similarly
When hover over the errant one the strange "edit box" appears (see attachment)
I have made the combo larger so you can see what I mean
What is the control withing the combo box?
larger-combo.docx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Attached, full xaml
fullxml.txt
fullxml.txt
ASKER
Attached, full xaml source for this form
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes,
The form is rendered ok
Th problem is when I select in the the main combo
First of all the control adds a weird control that looks like edit box
The it won't actually display the selected data.
screendump.docx
The form is rendered ok
Th problem is when I select in the the main combo
First of all the control adds a weird control that looks like edit box
The it won't actually display the selected data.
screendump.docx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
looks better (no strange control within control)
But still not displaying the item text as yours is?
But still not displaying the item text as yours is?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
drop down list has values which I can see and select
Selected item never show anything
No styles defined for text block
Selected item never show anything
No styles defined for text block
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This solution helped with the issue
But still not seeing data
Am going to try from scratch to build a new application and see what happens with that.
But still not seeing data
Am going to try from scratch to build a new application and see what happens with that.
ASKER
Yes, the data are connected to the combo box OK and I can select an item. But look at the top image. This is with an item selected. The item does not show in the combo but instead there is a strange white rectangle at the bottom of the client area (all along the bottom)?