Home Forums WPF controls Xceed DataGrid for WPF Cannot edit any rows after upgrade

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

    Hello,

    We are in a sort of an emergency situation here – ever since we upgraded to your latest Xceed version ( 1.1.7326.14130) , all our grids appear readonly – I didn’t find anything in your forums that indicates that there is something special to be done to make the grids editable. It used to work fine in your version before this one.

    Please help.
    Thanks,
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 710 views)

    User (Old forums)
    Member
    Post count: 23064

    If you haven’t already, try comparing your code to one of working example from the documentation or examples.

    Confirm that the DataaGridControl.ReadOnly flag is false, the Column.ReadOnly flags are false for your columns and that your editor bindings are TwoWay (BindingMode.TwoWay).

    Imported from legacy forums. Posted by Richard (had 480 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the reply. Tried this – the key was to define two-way binding for each column. Also when I try and edit the cell, the value of the cell changes to System.Xml.XmlElement from the value it was bound to. Is there a way to get around this.

    Here’s a sample I am working with:

    <xcdg:DataGridControl ItemsSource=”{Binding Source={StaticResource rssFeed}}”
    AutoCreateColumns=”False” >

    <xcdg:DataGridControl.Columns>

    <xcdg:Column Title=”Description”
    FieldName=”description”
    Width=”200″
    DisplayMemberBinding=”{Binding Mode=TwoWay, XPath=description}”/>

    <xcdg:Column Title=”Publication Date”
    FieldName=”pubDate”
    Width=”70″
    DisplayMemberBinding=”{Binding Mode=TwoWay, XPath=pubDate}”/>

    </xcdg:DataGridControl.Columns>

    </xcdg:DataGridControl>

    Also can you point me to a sample that uses xml binding.
    Thanks very much
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 362 views)

    User (Old forums)
    Member
    Post count: 23064

    Check out this post for a similar observation about Cell.Content becoming an XmlElement in the latest version.

    http://forums.xceed.com/forums/ShowPost.aspx?PostID=8672

    I’m not working with XML data currently, but you could try using a ValueConverter on the binding to do any conversions you need. Check out MSDN for this:

    http://msdn2.microsoft.com/en-us/library/ms752091.aspx

    Imported from legacy forums. Posted by Richard (had 413 views)

    User (Old forums)
    Member
    Post count: 23064

    Also don’t forget about the {xcdg:CellEditorBinding} MarkUp extension for CellEditors. You can read about this in the docs

    See post http://forums.xceed.com/forums/ShowPost.aspx?PostID=8377 for an example editor using it.

    Imported from legacy forums. Posted by Richard (had 304 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for your response . I was aware of this change in the new xceed version but even then on clicking inside a cell, the text should not change to System.Xml.XmlELement. I understand clicking inside the cell, activates it’s cell editor and if it is an AutoSelectTextBox, the Text property being bound to {xcdg:celleditorbinding} will display the string System.Xml.XmlELement. But what is the workaround – do I have to use valueconverters or catch the click event so I can intervene in time before the content gets tostringed. Shouldn’t xceed be hadling this. It really sounds like a bug to me.

    Thanks
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 338 views)

    User (Old forums)
    Member
    Post count: 23064

    Perhaps “System.Xml.XmlElement” is displayed because the binding is against this object type and ToString() for this just returns the name of the type.

    Perhaps you could try binding to Path=InnerText, something like, but I’m guessing as I’m not currently using bound XML data.

    Here’s a guess at what could work, but again I stress, I’m not using bound XML data so you’ll have to experiment.

    <xcdg:Column FieldName=”???” Title=”???” DisplayMemberBinding=”{Binding Path=???, Mode=TwoWay}” Width=”80″>
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>

    <xcd:AutoSelectTextBox Text=”{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type xcdg:DataCell}}, Path=DataContent.InnerText}” />

    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    <xcdg:CellEditor.ActivationGestures>
    <xcdg:TextInputActivationGesture />
    </xcdg:CellEditor.ActivationGestures>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column>

    Imported from legacy forums. Posted by Richard (had 283 views)

    User (Old forums)
    Member
    Post count: 23064

    Here are two posts using an XML data island. The bindings used show how XPath should be used for XML data.

    http://forums.xceed.com/forums/ShowPost.aspx?PostID=8597

    http://forums.xceed.com/forums/ShowPost.aspx?PostID=8685

    Use “XPath” bindings for XML data. I don’t think you should use a “Path” binding against InnerText.

    Imported from legacy forums. Posted by Richard (had 405 views)

    User (Old forums)
    Member
    Post count: 23064

    Actually Path does work but DataContent.InnerText doesn’t work at all . If I use the InnerText on clicking inside a cell, it blanks out. What does work is Content.InnerXml.

    So here is what did finally work out:

    <xcdg:Column FieldName=”title”
    Title=”Title”
    Width=”200″
    DisplayMemberBinding=”{Binding Mode=TwoWay, XPath=title}”
    >
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>

    <xcd:AutoSelectTextBox Text=”{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type xcdg:DataCell}}, Path=Content.InnerXml}” />

    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    <xcdg:CellEditor.ActivationGestures>
    <xcdg:TextInputActivationGesture />
    </xcdg:CellEditor.ActivationGestures>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column>

    So the DisplayMemberBinding uses the XPath property and the Binding statement that is bound to a DependencyProperty of a cell editor (like Text for AutoSelectTextBox) uses Path. This works but that means that you have to define the cell editor for each column explicitly. In the last version I did not have to do this – xceed would use its inbuilt cell editor. I still think it is a bug but for now the workaround works.

    Thanks for all your help,
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 461 views)

    User (Old forums)
    Member
    Post count: 23064

    Interesting…it does sound a bit suspect that the behavior would change unless the change is well documented :-\

    Seems we’ll have to wait for the Xceed team or someone else with the whole story to clarify.

    Glad you got to a workaround at least 🙂

    One thing you could consider is creating a custom control CellEditor that encapsulates this behavior so that it’s a bit easier to reuse.

    Imported from legacy forums. Posted by Richard (had 6761 views)

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