Home Forums WPF controls Xceed DataGrid for WPF Binding multiple XML attributes to a CellContentTemplate

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #22528 |

    This might not even be worth it since the XML data binding is for demo purposes and eventually the grid will be bound to a real List<T> object. But, for giggles…I’m trying to get multiple values from my XML node into the CellContentTemplate so I can add a tool tip or context menu to display more data.

    Sample XML:

    <Item ID=”1″ Type=”Mail” Subject=”Lorem ipsum dolor sit amet.” Message=”Lorem ipsum dolor sit amet, consectetuer adipiscing elit..”/>

    What I have now that works fine:

    <xcdg:Column FieldName=”Subject” Title=”Subject” MinWidth=”360″ DisplayMemberBinding=”{Binding XPath=@Subject}” />

    What I’d like to have, and tried, but does not work:

    <xcdg:Column FieldName=”Subject” Title=”Subject” MinWidth=”360″ CellContentTemplate=”{StaticResource checkboxCellTemplate}” />

    <DataTemplate x:Key=”checkboxCellTemplate”>
    <TextBlock Text=”{Binding XPath=@Subject}” />
    <TextBlock Text=”{Binding XPath=@Message}” />

    Imported from legacy forums. Posted by Brett (had 1864 views)

    Xceed Support
    Post count: 5658

    The way the DataGridControl currently works is that if the DisplayMemberBinding specified on your column maps to a XmlNode, then we bind the content of the Cell to the InnerXml of the node (not to the node itself). Therefore, the pattern as you specified is not possible.

    It would however create no problem is you deserialized your XML data to list of objects (as you indicated).

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

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