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
140
DataValueChanged Event Question
posted

Is there anyway to force the CellValuePresenter's ValueHistory to store a change in the history if the new value happens to be the same as the current value?

Parents
No Data
Reply
  • 27093
    Verified Answer
    posted

    Hello Chris,

     

    I have been looking into your issue and even thought there seems to be no way to add a new DataValueInfo entry into the ValueHistory collection, I did manage to make use of its Tag property to save the number of times a value has been added. Here is a code snippet showing how you can do it:

     

    private void xamDataGrid1_DataValueChanged(object sender, DataValueChangedEventArgs e)

    {

        if (e.CellValuePresenter != null)

        {

            if (e.ValueHistory[0].Value == e.CellValuePresenter.Value)

            {

                if (e.ValueHistory[0].Tag == null)

                {

                    e.ValueHistory[0].Tag = 2;

                }

                else

                {

                    int temp;

                    if (int.TryParse( e.ValueHistory[0].Tag.ToString(), out temp))

                    {

                        e.ValueHistory[0].Tag = ++temp;

                    }

                }

            }

        }

    }

     

    Hope this helps. Please let me know if you require any further assistance on the matter.

     

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support

Children