Link to home
Start Free TrialLog in
Avatar of KevinJoeBadger
KevinJoeBadgerFlag for United Kingdom of Great Britain and Northern Ireland

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" IsSynchronizedWithCurrentItem="True" ItemTemplate="{StaticResource AccountTemplate}"     ItemsSource="{Binding}" Margin="0,13,14,0" Name="AccountsList"     VerticalAlignment="Top" SelectionChanged="AccountsList_SelectionChanged"     HorizontalAlignment="Right" Width="576">

This is data template

<Window x:Class="VirginOneAccount.AccountInfo"
        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="CenterScreen" Initialized="AccountsForm_Initialized">
    <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
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KevinJoeBadger

ASKER

Hi,Thanks for response.
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)?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
no, noting overrides the combo box style.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Attached, full xaml
fullxml.txt
Attached, full xaml source for this form
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
looks better (no strange control within control)
But still not displaying the item text as yours is?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
drop down list has values which I can see and select
Selected item never show anything

No styles defined for text block
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.