Home Forums WPF controls Xceed DataGrid for WPF Inserting – Readonly Column

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

    Hello,

    I have a column that I’d like to keep readOnly except when the user is entering a new row…

    In which case I’d like the user to enter a value.

    When I set the column ReadOnly = True. I’m not able to provide value for the column during insertion.

    Is there a way I can get around this?

    Thanks!

    Imported from legacy forums. Posted by Murthy (had 2976 views)

    Xceed Support
    Member
    Post count: 5658

    I suggest overriding the DataRow and DataCell classes and change the logic of the BeginEdit() method so that the Cell of a particular column (even if its ReadOnly = false) cannot be edited.

    For this, you need to:

    – override DataCell and change the BeginEdit function
    – override the DataRow class and return a new Instance of CustomDataCell in the CreateCell() method.
    – override the DataGridControl and return a new Instance of CustomDataRow in the GetContainerForItemOverride().

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

    User (Old forums)
    Member
    Post count: 23064

    I am new to using the Exceed grid. Do you have an example of how to do this?

    – override DataCell and change the BeginEdit function
    – override the DataRow class and return a new Instance of CustomDataCell in the CreateCell() method.
    – override the DataGridControl and return a new Instance of CustomDataRow in the GetContainerForItemOverride().

    Thanks

    Imported from legacy forums. Posted by Bridet (had 450 views)

    Xceed Support
    Member
    Post count: 5658

    <code>
    public class CustomDataCell : DataCell
    {
    //override what is needed for your custom logic
    }

    public class CustomDataRow: DataRow
    {
    protected override Cell CreateCell( Column column)
    {
    return new CustomDataCell();
    }

    //override any other behavior for your custom logic
    }

    public class CustomDataGridControl: DataGridControl
    {
    protected override DependencyObject GetContainerForItemOverride()
    {
    return new CustomDataRow();
    }

    //override any other behavior for your custom logic
    }
    </code>

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

    User (Old forums)
    Member
    Post count: 23064

    Now i’m in the same situation with this topic. In version 2.0 or 3.0 is i need same way to meet my requirement?

    Thanks!

    Imported from legacy forums. Posted by PaNN (had 1196 views)

    Xceed Support
    Member
    Post count: 5658

    Please see Marcus’s response.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 789 views)

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