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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:16:40+00:00 2026-05-11T04:16:40+00:00

We have an app that uses simple one way binding with a GridView to

  • 0

We have an app that uses simple one way binding with a GridView to display some data. Well, now we need to allow the user to change some of that data, so I’ve been trying to get two way data binding to work in the GridView. So far everything displays correctly, but editing cells in the GridView seems to do nothing at all. What am I messing up? Is two way databinding like this even possible? Should I just start converting everything to use a different control, like maybe a DataGrid?

I wrote a tiny test app that shows my problem. If you try it, you’ll see that the property setters never get called after their initialization.

Xaml:

    Title='Window1' Height='300' Width='300'>     <Grid>         <ListView Name='TestList'>             <ListView.View>                 <GridView>                     <GridViewColumn Header='Strings'>                         <GridViewColumn.CellTemplate>                             <DataTemplate>                                 <TextBox Text='{Binding Path=String, Mode=TwoWay}'/>                             </DataTemplate>                         </GridViewColumn.CellTemplate>                     </GridViewColumn>                     <GridViewColumn Header='Bools'>                         <GridViewColumn.CellTemplate>                             <DataTemplate>                                 <CheckBox IsChecked='{Binding Path=Bool, Mode=TwoWay}'/>                             </DataTemplate>                         </GridViewColumn.CellTemplate>                     </GridViewColumn>                 </GridView>             </ListView.View>         </ListView>     </Grid> </Window> 

And here’s the corresponding code:

using System.Collections.Generic; using System.Windows;  namespace GridViewTextbox {     public partial class Window1 : Window     {         private List<TestRow> _rows = new List<TestRow>();          public Window1()         {             InitializeComponent();              _rows.Add(new TestRow('a', false));             _rows.Add(new TestRow('b', true));             _rows.Add(new TestRow('c', false));              TestList.ItemsSource = _rows;             TestList.DataContext = _rows;         }     }      public class TestRow : System.Windows.DependencyObject     {         public TestRow(string s, bool b)         {             String = s;             Bool = b;         }          public string String         {             get { return (string)GetValue(StringProperty); }             set { SetValue(StringProperty, value); }         }          // Using a DependencyProperty as the backing store for String.  This enables animation, styling, binding, etc...         public static readonly DependencyProperty StringProperty =             DependencyProperty.Register('String', typeof(string), typeof(TestRow), new UIPropertyMetadata(''));           public bool Bool         {             get { return (bool)GetValue(BoolProperty); }             set { SetValue(BoolProperty, value); }         }          // Using a DependencyProperty as the backing store for Bool.  This enables animation, styling, binding, etc...         public static readonly DependencyProperty BoolProperty =             DependencyProperty.Register('Bool', typeof(bool), typeof(TestRow), new UIPropertyMetadata(false));     } } 
  • 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. 2026-05-11T04:16:41+00:00Added an answer on May 11, 2026 at 4:16 am

    When you use Dependency Properties, the Setters will not be called by bindings, instead they change the value directly (using SetValue or something similar).

    Try adding a PropertyChangedCallback, and set a breakpoint in there to see if the value is changed from the GridView.

    public static readonly DependencyProperty BoolProperty =     DependencyProperty.Register('Bool', typeof(bool), typeof(TestRow), new UIPropertyMetadata(false, OnBoolChanged)); private static void OnBoolChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) {     //this method will be called everytime Bool changes value } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 138k
  • Answers 138k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Apache 1.x uses POSIX Extended Regular Expressions and those don’t… May 12, 2026 at 7:33 am
  • Editorial Team
    Editorial Team added an answer You could probably do this by wrapping the COM object… May 12, 2026 at 7:33 am
  • Editorial Team
    Editorial Team added an answer Every control when it gets instantiated it gets its Style… May 12, 2026 at 7:33 am

Related Questions

Currently we generate classes in App_Code by returning all the sprocs from all of
We recently changed some of our system requirements on a light weight application (it
First of all, I'm kinda new to the barcode formats and what I do
I am working on an new web app I need to store any changes

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.