Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
More Undo/Redo docs on the way?
posted

I'm still really struggling with the documentation for Undo/Redo. Will there be more documentation posted soon?

Parents Reply
  • 330
    posted in reply to Andrew Smith [Infragistics]

    Thanks for the responses. I am very excited about Undo/Redo and would like to use it. Here is an example of the difficulty I'm having with the documentation:

    http://help.infragistics.com/Help/NetAdvantage/WPF/2012.1/CLR4.0/html/InfragisticsWPF4.Undo.v12.1~Infragistics.Undo.UndoUnit_members.html

    I do not see any documentation for the method, "Execute"

    Regarding the UndoExecuteContext, what is the difference between "ExecuteItemType" and "Reason"? They look very similar to me.

    Why is Target a required member of UndoUnit? How is it used by UndoManager?

    Is this implementation essentially how I would use UndoManager, or would I use it in a different way?

     

    using Infragistics.Undo;

     namespace UndoExample

    {

        public class Change : UndoUnit

        {

            public string MyProperty { get; set; }

     

            public Change()

            {

                MyProperty = "Original.";

            }

     

            protected override bool Execute(UndoExecuteContext executeInfo)

            {

                if (executeInfo.ExecuteItemType == UndoHistoryItemType.Undo)

                {

                    MyProperty = "Undone.";

                }

                else

                {

                    MyProperty = "Redone.";

                }

                return true;

            }

     

            public override string GetDescription(UndoHistoryItemType itemType, bool detailed)

            {

                return "Change MyProperty";

            }

     

            public override object Target

            {

                get { return null; }

            }

        }

     

     

        class Program

        {

            static void Main(string[] args)

            {

                UndoManager mgr = new UndoManager();

                var change = new Change();

                System.Console.Out.WriteLine(change.MyProperty);

                mgr.AddChange(change);

                mgr.Undo();

                System.Console.Out.WriteLine(change.MyProperty);

            }

        }

    }

     

Children