Home Forums WPF controls Xceed DataGrid for WPF Cell and Row Editing Behaviour

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #26843 |

     Hi i am using this handler to get the excel behaviour in doin calculations, when user press tab and jump to next cell i need to get the result calculated in the next cell without jumping to next row or pressing enter. i was using the above code to do it but it only works for one row when i jump to next row it don’t work and angain got the same behaviour of pressing enter or moving to next line calculate the result which i don’t want to i want exactly the excel behaviour, how can i Do it.

    <

    Style TargetType=”{x:Type xcdg:DataRow}”>

    <EventSetter Event=”KeyUp”

    Handler=”row_KeyUp”/>

     

     

    void row_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
            {
                row = sender as DataRow;
                string keyName = e.Key.ToString();

                if (keyName.CompareTo(Keys.Tab.ToString()) == 0)
                {
                   
                    if (row != null)
                    {
                        row.EndEdit();
                        row.BeginEdit();
                        row.Cells[3].Content = m_gyroWizardEntry.calculatedAzimuth;
                    }
                }
            }

    Imported from legacy forums. Posted by harpreet (had 621 views)

    Xceed Support
    Member
    Post count: 5658

    You could create your own DataRow derived class in which you override the EndEdit() class to perform the required action.

    To do so, you will need to create your own DataGridControl derived class and DataRow derived class:

    public MyDataGridControl: DataGridControl
    {
        protected override DependencyObject GetContainerForItemOverride()
        {
          return new MyDataRow();
        }

        protected override bool IsItemItsOwnContainerOverride( object item )
        {
          return ( item is MyDataRow );
        }
    }

    public MyDataRow: DataRow
    {
        public override EndEdit()
        {
           base.EndEdit();
           //Do your stuff here!
        }

    }
     

    Imported from legacy forums. Posted by Marcus [Xceed] (had 1222 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.