Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 940527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:58:23+00:00 2026-05-15T21:58:23+00:00

I have tried to set up combo boxes in the gridview but all the

  • 0

I have tried to set up combo boxes in the gridview but all the combo boxes have the same value in them instead of the value from the database. I am using entity framework and WPF. There is a parent child relationship between two tables but the source for the combo box is a separate table with names and IDs for tags. I have been looking all day. Hopefully this won’t be too easy to solve.

The “Tag” Column displays the combo box. The Column “Tag ID” displays the value from the database. When I display the data the TagID Changes in diffrent rows but the Tag column is the same (the first choice) in all the rows. When I change one combo box they all change. I can’t see where they are hooked together. Any assistance you can provide would be appreciated. (Buler?)

Here is the XAML

<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="372" Width="675" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:TagFinanceWPF">
<Window.Resources>
    <CollectionViewSource x:Key="TransactionsViewSource" d:DesignSource="{d:DesignInstance my:Transaction, CreateList=True}" />
    <CollectionViewSource x:Key="TransactionsTransactionTagsViewSource" Source="{Binding Path=TransactionTags, Source={StaticResource TransactionsViewSource}}" />
    <CollectionViewSource x:Key="TagLookup" />
</Window.Resources>
<Grid DataContext="{StaticResource TransactionsViewSource}">
    <ListView ItemsSource="{Binding Source={StaticResource TransactionsTransactionTagsViewSource}}" Margin="12" Name="TransactionTagsListView" SelectionMode="Single">
        <ListView.ItemContainerStyle>
            <Style>
                <Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="Control.VerticalContentAlignment" Value="Stretch" />
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.View>
            <GridView>
                <GridViewColumn x:Name="TransactionIDColumn1" Header="Transaction ID" Width="80">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Label Content="{Binding Path=TransactionID}" Margin="6,-1,-6,-1" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn x:Name="TagIDColumn" Header="Tag" Width="80">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <ComboBox Margin="-6,-1" 
                                      ItemsSource="{Binding Source={StaticResource TagLookup}}" 
                                      DisplayMemberPath="TagName" 
                                      SelectedValuePath="TagID"
                                      SelectedValue="{Binding TagID}" 
                                      IsReadOnly="True">
                            </ComboBox>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>

                <GridViewColumn x:Name="TagIDColumn2" Header="Tag ID" Width="80">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Label Content="{Binding Path=TagID}" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
            </GridView>
        </ListView.View>
    </ListView>
</Grid>

The VB code is:

Class MainWindow

Dim BentleyvideoEntities As TagFinanceWPF.bentleyvideoEntities = New TagFinanceWPF.bentleyvideoEntities()

Private Function GetTransactionsQuery(ByVal BentleyvideoEntities As TagFinanceWPF.bentleyvideoEntities) As System.Data.Objects.ObjectQuery(Of TagFinanceWPF.Transaction)

    Dim TransactionsQuery As System.Data.Objects.ObjectQuery(Of TagFinanceWPF.Transaction) = BentleyvideoEntities.Transactions
    'Update the query to include TransactionTags data in Transactions. You can modify this code as needed.
    TransactionsQuery = TransactionsQuery.Include("TransactionTags")
    'Returns an ObjectQuery.
    Return TransactionsQuery
End Function

Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

    'Load data into Transactions. You can modify this code as needed.
    Dim TransactionsViewSource As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("TransactionsViewSource"), System.Windows.Data.CollectionViewSource)
    Dim TransactionsQuery As System.Data.Objects.ObjectQuery(Of TagFinanceWPF.Transaction) = Me.GetTransactionsQuery(BentleyvideoEntities)
    TransactionsViewSource.Source = TransactionsQuery.Execute(System.Data.Objects.MergeOption.AppendOnly)
    'Load data into Tags. You can modify this code as needed.


    Dim customerList = From c In BentleyvideoEntities.Tags _
                                  Order By c.TagName

    Dim custSource = CType(Me.FindResource("TagLookup"), CollectionViewSource)
    custSource.Source = customerList.ToList()

End Sub

End Class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:58:24+00:00Added an answer on May 15, 2026 at 9:58 pm

    I found this while researching your issue and it sounds like the exact same issue you are experiencing.

    Snippit from link:

    I’m not sure if this will help, but I
    was reading in Chris Sells ‘Windows
    Forms Binding in C#, footnote, page
    482’, that the data source is bound to
    each combobox and is managed by a
    common Binding manager which in turn
    is part of a Binding Context. The
    Binding amager keeps all comboboxes
    synchronized to the same row in the
    database. However, if each combobox
    has a different Binding context, hence
    a diferent Binding Manager, then the
    combo boxes can show different rows
    from the same data source.

    Based on this second article (and the suggested solution) you would need to use the row databinding event to set up the combobox’s binding so that a new instace of the binding manager is created for each row bind.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried all of these various ways to set the value of the
I have tried setting the debug flags using the set command in cmake but
All right so I tried using the button set. So fair, I have been
I want to achieve this using html and css: I have tried to set
I have tried the obvious SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED, but my
I have tried this but it doesn't work: tell application Preview set myfile to
I have 3 dropdown boxes (combo box) in asp.net environment. They are all optional,
I have some combo-boxes that are set up as drop down lists, and the
I have multiple combo and option boxes whose visibility is set true or false
I have created a button in my Android application & I tried to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.