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 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

Related Questions

We have a simple console app that uses EF 4 to process data; read
I have a simple app that uses an SQL Express 2005 database. When the
I have a Cocoa app that uses a WebView to display an HTML interface.
I have a small app on Heroku's cedar stack that uses two processes. One
So I am working on a simple iPhone app, that uses core data to
I have a simple sinatra app that uses haml and sass for the views.
I have an app that uses EF. To test my stuff I generally wrap
I have an app that uses the python/c api and I was wondering what
I have an app that uses a tableview, along with a UIButton that I
I have a App that uses the In App feature. -(void) completeTransaction: (skPaymenttransaction *)transaction{

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.