Am I right about using one undo level with binding in this way ?

Am I right about using one undo level with binding in this way ?

Old forum URL: forums.lhotka.net/forums/t/6778.aspx


Programmer1987 posted on Sunday, April 12, 2009

I have Business Class [CostItem] that complex enough to make me crazy

it has many properties [A,B,C] some of them are inherited from businessListBase

I want to use Wpf Window with Cancel Ok buttons so I put this small plan for that :

1- my long story start in grid contains Collections of [CostItem] Class

2- double click on the row , opens new window for selected [CostItem]

3- Onload Window And Before Binding the SelectedCostItem To the [MainGrid] DataContext

I will Call BeginEdit() for the CostItem Object

4- Because I will made the CostItem Class Property [DisableIEditableObject] to True

The Begin Edit will only affect the costItem object and not of any its collection child.

5- when cancel button I will  call cancelEdit for CostItem Object

6- when okay button I will call ApplyEdit for Costitem object

7- when the user try to edit any of collection child property I will call Begin Edit just to this property

and call cancelEdit if user canceled that and applychange if the user want to commit that

--------------

my question is Am I right in this plan ? are there any problems or missing points

I know that i have to rebind the object after apllying changes , in Wpf is there any Pause binding Feature ?!!

sorry for talking alot :)

rsbaker0 replied on Sunday, April 12, 2009

I use DisableIEditableObject also, but I think your explict call to BeginEdit() will cascade to all child objects. It also does this if DisableIEditableObject is false, but only if BindingEdit also is false (e.g. the object is unbound at the time you call BeginEdit() )

Copyright (c) Marimer LLC