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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:38:37+00:00 2026-05-31T14:38:37+00:00

In my WPF app, I have a datagrid with a IntegerUpDown control displayed in

  • 0

In my WPF app, I have a datagrid with a IntegerUpDown control displayed in a column and its bound to a property in my viewmodel:

<DataGridTemplateColumn Header="Qty">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <toolkit:IntegerUpDown Minimum="1" Maximum="999" Value="{Binding SelectedQuantity, Mode=TwoWay}" Increment="1" HorizontalAlignment="Left" Margin="0,0,0,0" Name="integerUpDown1" VerticalAlignment="Top" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

It appears to be only 1 way binding. The value thats initially set in my viewmodel is shown in the control, but when I change the value of the control it doesn’t update the viewmodel. I’ve made sure to change the value of the control then press tab or enter to lose focus and trigger the update but still no luck. My viewmodel is pretty simple, and here’s the SelectedQuantity property

public int SelectedQuantity
{
    get
    {
        return _selectedQuantity;
    }
    set
    {
        if (value != _selectedQuantity)
        {
            _selectedQuantity = value;
            OnPropertyChanged("SelectedQuantity");
        }
    }
}
private int _selectedQuantity;

public event PropertyChangedEventHandler PropertyChanged;

private void OnPropertyChanged(string property)
{
    if (PropertyChanged != null)
    {
        PropertyChanged(this, new PropertyChangedEventArgs(property));
    }
}

It may have something to do with Automapper? I use Automapper to map my model to my viewmodel. I thought initially that I maybe needed to use Automappers “Ignore” on this property, but after trying that the same problem persisted. The SelectedQuantity is not a property in my model object. Maybe it has something to do with DataGridTemplateColumns?

Edit
It appears nothing is actually bound correctly with the datagrid (although other controls in the View are bound correctly) 🙁 This is how I’m populating my ObservableCollection<ProductViewModel> object

public void Search()
{
    _viewModel.SearchResults.Clear();
    List<ProductViewModel> searchResults = Mapper.Map<List<Product>, List<ProductViewModel>>(_productService.SearchProducts(_viewModel.SearchValue));

    foreach (ProductViewModel pvm in searchResults)
    {
        _viewModel.SearchResults.Add(pvm);
    }
}

Edit 2:

My DataGrid is bound to the ObservableCollection<ProductViewModel> object like so ItemsSource="{Binding SearchResults}" I am seeing the items properly in the DataGrid, changes just aren’t being reflected in the viewmodel. SelectedQuantity is a property in ProductViewModel.

  • 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-31T14:38:38+00:00Added an answer on May 31, 2026 at 2:38 pm

    I think you are mixing bindings. The datagrid is probably bound to an ObservableCollection (if it isn’t, I would start there). The item context at the row level is the individual object, which is the object that should have SelectedQuantity property in order for your XAML to work. If it is on your encompassing viewmodel, this won’t work as multiple rows will be bound to the same property and I don’t think it will give you the effect your looking for.

    Try adding some code to see if the value is being sent once you exit the row:

    <b:Interaction.Triggers>
        <b:EventTrigger EventName="RowEditEnding">
            <b:InvokeCommandAction  Command="{Binding RowEditEndingCommand}" CommandParameter="{Binding }"/>
        </b:EventTrigger>
     </b:Interaction.Triggers>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid in WPF app with several columns, including a Name column.
I have developed a simple DB-editing app using Xceed's excellent DataGrid for WPF (UX
I have a user control that contains a WPF toolkit DataGrid . This control
I have a WPF app with a listview control. The application basically loads a
I have a WPF 4 app with a ComboBox embedded in a DataGrid. The
I have a WPF app that uses DataGrid to display some data. When I
In a WPF app I have objects, derived from a custom control: ... <MyNamespace:MyCustControl
In a WPF app I have a custom control. I would like the ToolTip
In my WPF app I use a DataGrid, and when I have columns whose
I have a WPF MVVM app that contains an editable DataGrid. I am subscribing

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.