Avatar of KevinJoeBadger
KevinJoeBadger
Flag 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#
Microsoft SQL ServerC#

Avatar of undefined
Last Comment
KevinJoeBadger

8/22/2022 - Mon
SOLUTION
angus_young_acdc

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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
Gautham Janardhan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
KevinJoeBadger

ASKER
no, noting overrides the combo box style.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

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
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

ASKER
Attached, full xaml
fullxml.txt
KevinJoeBadger

ASKER
Attached, full xaml source for this form
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

ASKER
looks better (no strange control within control)
But still not displaying the item text as yours is?
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

ASKER
drop down list has values which I can see and select
Selected item never show anything

No styles defined for text block
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
KevinJoeBadger

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes