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
420
I have to make a template column in a xamgrid as readonly
posted

Hi,

In the xamgrid i have a template column , i need to make it readonly when i click particular button . Template column should be readonly when i click the button . Other than it should be editable .

Thank YOu

JeevanVinay

  • 16495
    Verified Answer
    Offline posted

    Hello Jeevan,

     

    Thank you for your post.

     

    I have been looking into it and what I can suggest is to handle the click event of button and in the event handler you can access the column by its Key and get the ColumnBase objet. You should cast it to the EditableColumn and set it`s IsReadOnly property to True or False. The following code snippet illustrate this functionality:

     

    private void Button_Click(object sender, RoutedEventArgs e)

            {

                EditableColumn column = xamGrid1.Columns["Key"] as EditableColumn;

                if (column !=  null)

                   {

                                  If(column.IsReadOnly == false)

                                              column.IsReadOnly = true;

                                else

                                            column.IsReadOnly = false;

                   }

            }

     

    Please let me know if you need any further assistance on the matter.