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

Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

Sort Posts: Previous Next
  •  12-10-2009, 5:04 PM Post no. 25152

    Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Attachment: WpfPropertyDetail.zip

    I have bound a DataGrid to a collection of data that contains several string properties.  The view I am using is CompactCardView (or CardView) with HideEmptyCells set to True.

    The problem I'm having is that properties returning null strings are not editable, the only way to make properties editable is to ensure they return a non-null string, either string.Empty or a non-empty string.  However, doing this results in those properties being visible all the time (even when not in edit mode) and this is not desired as I have HideEmptyCells set to True for this reason.

    When a record is edited, all the empty fields appear, so this implies that fields are supposed to be editable even though they are hidden while empty when not in edit mode.  Is this a correct assumption, or is it purely to show to the user that there are some empty fields that are null and have no objects associated them to allow any change to take place?

    Ideally, I would like HideEmptyCells to hide cells that contain non-null but empty string properties (i.e., return string.Empty or "").  Otherwise, I would like to be able to edit null fields.

    I have attached an example project demonstrating this behaviour.  In it, the elements in the bound collection each contain several properties demonstrating the effect that returning non-null and null strings has on the editable/hidden characteristics within the grid.

    Could this please be investigated?

    Many thanks in advance.

    Jason


    Associate, .NET Development
    Morgan Stanley, UK
  •  12-11-2009, 5:03 PM Post no. 25171 in reply to 25152

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Hi Jason,

    The issue with editing is occurring because the AutoCreateColumns property is set to false, in which case the grid doesn't create cell editors for null values. You need to either set the AutoCreateColumns property to true or to explicitly define a cell editor for that column:

       <xcdg:Column FieldName="GetsNullIfEmpty" Title="Gets Null If Empty"
                             CellEditor="{x:Static xcdg:CellEditor.TextBoxEditor}"/>

    As for the HideEmptyCells issue, I would have thought the string.empty cells would have been hidden. A fix request was open to investigate this issue further.

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
  •  12-14-2009, 11:57 AM Post no. 25182 in reply to 25171

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Thanks Diane.  Setting AutoCreateColumns to True resolved the issue.  However, this doesn't seem right.  What if my data source has properties I do not wish to show columns for?  By explicitly specifying the columns and setting AutoCreateColumns to False, I can control which properties are represented in columns.  As soon as I set AutoCreateColumns to True (which it seems is necessary for a CellEditor to be formed for null values), I no longer have control over which properties are shown as columns... unless I set the Visible property of said columns.  But then, what's the point in AutoCreateColumns="False" in that case if it can only be used in a [Compact]CardView view when it can be certain there'll be no null value properties?  I've attached a similar example to my previous post with an extra property demonstrating this.

    The HideEmptyCells issue where string.Empty cells should be hidden - what's the fix ID for this - could you notify me when there is a fix available for this please?


    Associate, .NET Development
    Morgan Stanley, UK
  •  12-14-2009, 12:17 PM Post no. 25186 in reply to 25182

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Hi Jason,

    As explained in my previous answer, if you leave AutoCreateColumns property to false, you must then explicitly define a cell editor for that column.

    For example:
       <xcdg:Column FieldName="GetsNullIfEmpty" Title="Gets Null If Empty"
                             CellEditor="{x:Static xcdg:CellEditor.TextBoxEditor}"/>

    As for the HideEmptyCells issue, the case id for the fix request is 129204. It has already been linked to your support ticket and you will be notified when the fix becomes available for download.

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
  •  12-14-2009, 12:30 PM Post no. 25188 in reply to 25186

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Ok, understand that.  But that means for every column that represents a string property that could be null, I need to specify a CellEditor in XAML explicitly for AutoCreateColumns="False".  I don't understand the connection between AutoCreateColumns and why it affects whether a CellEditor automatically forms for null strings.  Surely, they are two completely separate things?

    I just wish to understand why I must explicitly specify a CellEditor for all my null-accepting string columns for AutoCreateColumns="False" as this will impact code substantially, especially where columns are created programmatically.


    Associate, .NET Development
    Morgan Stanley, UK
  •  04-01-2010, 1:17 PM Post no. 26372 in reply to 25188

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    I notice in 3.6 this issue with HideEmptyCells not hiding non-null cells still exists.  Is the fix request with case ID 129204 still yet to be implemented?


    Associate, .NET Development
    Morgan Stanley, UK
  •  04-01-2010, 2:17 PM Post no. 26374 in reply to 26372

    Re: Null strings are not editable in [Compact]CardView and HideEmptyCells only hides null strings, not string.Empty

    Hi Jason,

    That is correct, case 129204 hasn't been implemented yet, it is still pending in the development team's request list.

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.