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

  • Home
  • SEARCH
  • 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 3631608
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:25:09+00:00 2026-05-19T00:25:09+00:00

I have a WPF 4 app with a ComboBox embedded in a DataGrid. The

  • 0

I have a WPF 4 app with a ComboBox embedded in a DataGrid. The ComboBox is in a template column that displays the combobox when in edit mode but just a TextBlock otherwise. If I edit the cell and pick a new value from the combobox, when leaving the cell, the TextBlock in view mode does not reflect the new value. Ultimately, the new value gets saved and is displayed when the window is refreshed but it does not happen while still editing in the grid.

The DB table structure is as follows: Employee(int employeeID, string last, string first, string phone); Project(int projectID, string projectName); ProjectMember(int projMemID, int projectID, int employeeID, string role). A readonly property, FullName, was added to the Employee entity concatenating first + last. So the view TextBlock displays ProjectMember.Employee.FullName. The combobox items come from Employee.FullName.

Here are the parts that are making this more complicated. The grid and the combobox are bound to different ItemsSource from the EnityFramework which is tied to my database. For this problem, the grid is displaying project members. The project member name can be picked from the combobox which gives a list of all company employees.

Any ideas on how to tie the view mode of the DataGridColumnTemplate to the edit value when they are pointing to different DataSources?

Relevant XAML

<Window.Resources>
    <ObjectDataProvider x:Key="EmployeeODP" />
</Window.Resources>
<StackPanel>
<DataGrid Name="teamProjectGrid"  AutoGenerateColumns="false" ItemsSource="{Binding  Path=ProjectMembers}"
       <DataGrid.Columns>
          <DataGridTemplateColumn Header="Name" x:Name="colProjectMember">
             <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
               <TextBlock Text="{Binding Path=ProjectMemberFullName}" />
            </DataTemplate>
          </DataGridTemplateColumn.CellTemplate>
          <DataGridTemplateColumn.CellEditingTemplate>
            <DataTemplate>
               <ComboBox x:Name="ProjectMemberCombo" IsReadOnly="True"
                  DisplayMemberPath="FullName"
                  SelectedValue="{Binding Path=Employee}"
                  ItemsSource="{Binding Source={StaticResource EmployeeODP}}"
                />
            </DataTemplate>
         </DataGridTemplateColumn.CellEditingTemplate>
      </DataGridTemplateColumn>
      <DataGridTextColumn x:Name="colProjectRole" Binding="{Binding Path=ProjectRole}" Header="Role" />
   </DataGrid.Columns>
</DataGrid>
</StackPanel>

Relevant Code Behind

this.DataContext = new MyEntityLibrary.MyProjectEntities();

ObjectDataProvider EmployeeODP= (ObjectDataProvider)FindResource("EmployeeODP");
if (EmployeeODP != null)
{
   EmployeeODP.ObjectInstance = this.DataContext.Employees;
}
  • 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-19T00:25:10+00:00Added an answer on May 19, 2026 at 12:25 am

    Just replace a combobox:

    <ComboBox x:Name="ProjectMemberCombo" IsReadOnly="True"
                  DisplayMemberPath="FullName" SelectedValuePath="FullName"
                  SelectedItem="{Binding Path=Employee}"
                  SelectedValue="{Binding Path=ProjectMemberFullName}"
                  ItemsSource="{Binding Source={StaticResource EmployeeODP}}"
                />
    

    Also the property ProjectMemberFullName must raise the event PropertyChanged.

    Another way – replace TextBlock:

    <TextBlock Text="{Binding Path=Employee.FullName}" />
    

    You can get rid of the property FullName:

    <TextBlock DataContext="{Binding Employee}">
        <Run Text="{Binding First}"/> <Run Text="{Binding Last}"/>
    </TextBlock>
    

    But I’m not sure if the entity implements INotifyPropertyChanged interface.
    In the second variant the property Employee must call OnNotifyPropertyChanged("Employee")

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

Sidebar

Related Questions

I have a WPF app which snaps to screen edges (I just set the
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
This is an interesting conundrum. We have a WPF app that has a Vista-like
I have a Windows Forms app, that has a single ElementHost containing a WPF
I have a WPF App which is grinding to a halt after running out
I'm creating a WPF app and have a system tray icon with a context
I have a mixed UI (Win App, WPF App, and soon an ASP.NET MVC
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)
I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have a WPF project and I'm trying to setup a NAnt build script

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.