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 8819283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:19:03+00:00 2026-06-14T05:19:03+00:00

Help me to solve binding problem. The poject is in WPF + WAF +

  • 0

Help me to solve binding problem. The poject is in WPF + WAF + ef code first. I want to bind DataGridComboBoxColumn value to models property, but something not working.
Models:

public class DocumentMove
    {
        [Key]
        public Guid DocumentMoveId { get; set; }
        public Guid RawMaterialId { get; set; }
        public RawMaterial RawMaterial { get; set; }
        public decimal Amount { get; set; }
        public decimal Price { get; set; }
    }

public class RawMaterial
    {
        [Key]
        public Guid RawMaterialId { get; set; }
        public RawMaterialGroup Group { get; set; }
        [MaxLength(20)]
        public string Code { get; set; }
        public Colour Colour { get; set; }        
        [MaxLength(100)]
        public string Name { get; set; }
        public Measure Measure { get; set; }        
        public List<ArrLocation> ArrLocations { get; set; }        
        public List<RawMove> RawMoves { get; set; }
        public Delivery Supplier { get; set; }
        public RawMaterial()
        {            
        }
}

The grid:

<DataGrid x:Name="documentMoveTable" AutoGenerateColumns="False" ItemsSource="{Binding DocumentMoves}" 
        SelectedItem="{Binding SelectedDocumentMove}" CanUserDeleteRows="False" IsReadOnly="False" RowEditEnding="documentMoveTable_RowEditEnding">
        <DataGrid.InputBindings>
            <KeyBinding Command="{Binding RemoveCommand}" Key="Del"/>
        </DataGrid.InputBindings>

        <DataGrid.Columns>
            <DataGridComboBoxColumn Header="{x:Static p:Resources.RawMaterial}"
                SelectedValueBinding="{Binding RawMaterialId}" 
                DisplayMemberPath="Name" SelectedValuePath="RawMaterialId">

                <DataGridComboBoxColumn.ElementStyle>
                        <Style TargetType="{x:Type ComboBox}">
                            <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RawMaterials}" />
                            <Setter Property="IsReadOnly" Value="True"/>
                        </Style>
                </DataGridComboBoxColumn.ElementStyle>
                <DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="{x:Type ComboBox}">
                            <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RawMaterials}" />
                        </Style>
                </DataGridComboBoxColumn.EditingElementStyle>
            </DataGridComboBoxColumn>

            <DataGridTextColumn Binding="{Binding Amount, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, 
                                ValidatesOnExceptions=True, NotifyOnValidationError=True}"
                                Header="{x:Static p:Resources.Amount}" Width="*" ElementStyle="{StaticResource TextCellElementStyle}"/>

            <DataGridTextColumn Binding="{Binding Price, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, 
                                ValidatesOnExceptions=True, NotifyOnValidationError=True}"
                                Header="{x:Static p:Resources.Price}" Width="*" ElementStyle="{StaticResource TextCellElementStyle}"/>

        </DataGrid.Columns>
    </DataGrid>

And ViewModel:

[Export]
public class EditDocumentViewModel : ViewModel<IEditDocumentView>
{
    private IEnumerable<DocumentMove> _documentMoves;        
    private ICommand _removeCommand;        
    private ICommand _editListCommand;

    public IEnumerable<DocumentMove> DocumentMoves
    {
        get { return _documentMoves; }
        set
        {
            _documentMoves = value;
            RaisePropertyChanged("DocumentMoves");
        }
    }

    public DocumentMove SelectedDocumentMove { get; set; }

…

}

While trying add a new row to grid, I can select a value from ComboBox and add values for “Amount” and “Price”. On the Controller’s side while handling the EditListCommand the values of _editDocumentViewModel.SelectedDocumentMove.Amount and _editDocumentViewModel.SelectedDocumentMove.Price are present but the value of _editDocumentViewModel.SelectedDocumentMove.RawMaterialId and _editDocumentViewModel.SelectedDocumentMove.RawMaterial are empty. I think something in my ComboBoxColumn binding is wrong, or may be something else?

I have seen several similar question 1 , 2, but
cant find how to fix it.

Please help, and sorry for my english ) .

  • 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-06-14T05:19:04+00:00Added an answer on June 14, 2026 at 5:19 am

    I added parameter UpdateSourceTrigger=PropertyChanged to SelectedValueBinding="{Binding RawMaterialId}" and it working!

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

Sidebar

Related Questions

perhaps you can help me to solve this problem. I want to display a
While using regex to help solve a problem in the Python Challenge , I
I'm hoping people have some ideas to help solve this problem. I am developing
Please help me solve this problem with capybara I have a button like this
Please help me solve my big problem. in my on-line shopping project i created
I have a little problem. i searched but did not get help to solve
My friends, i Have a problem in WPF which i just cannot solve. I
http://jsfiddle.net/YaMhn/8/ ^^^^Take a look and see if you can help solve this Ok so
Need some help to solve this. I have a gridview and inside the gridview
can anybody help me solve this : i got $filename= index 198.php; i use

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.