Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to make some cells in datagrid Readonly?

Sort Posts: Previous Next
  •  06-11-2012, 3:54 AM Post no. 32231

    How to make some cells in datagrid Readonly?

    Hi All,

     

    I am trying to make some cells in datagrid to be readonly but not the whole column nor the whole row. The datacontext of each item is bound to an entity that has a IsReadOnly property.

  •  06-11-2012, 8:20 PM Post no. 32236 in reply to 32231

    Re: How to make some cells in datagrid Readonly?

    Hi Arthur,

    You can add a Style to your window which targets DataCell. In your style, you can add the Setter for the ReadOnly property. You can also add Binding to style which would help things. You can add a converter in case you have certain criteria that your ReadOnly should follow. Here is a simple piece of XAML to get you started:

    XAML

    -----------

    <Style TargetType="xcdg:DataCell">
                <Setter Property="ReadOnly">
                    <Setter.Value>
                        <Binding Path="Column5" />
                    </Setter.Value>
                </Setter>   
            </Style>

    -----------

    Moreover, you can refer to a Blog post that Michel wrote last year which shows how to style cells based on other values. You can click on this link for a further explanation. Sample applications do come with the blog post just in case you want to see it in action.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.