Sorting & BindingContext

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a DataGrid (DG) and adjacent TextBoxes (TB) that are all bound to the
cells of the DG. If you move the DG row left indicator (arrowhead) the TB's
update to agree with the row of the DG. All this is done with the
CurrentCellChanged() event

However, if I sort a DG column (allowsorting == true), the TB's don't
update with the new data of that sorted row (I have to reselcted a different
row to rebind). So, when I sort a DG column, the TB still show the data for
that previous row location

How can I solve problem?

Steve
 
There may be an easier way, but one way I did this was to create a hash
table with the position of each row as it comes in originally and the key
value. THen I could always use that original position after I sorted to
find whatever record I wanted by setting the BindingContext's position to
it. DataBinding isn't my strong suit so there is probably a more
elegant/simple way to do it, but in a pinch I know this will work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top