Home Forums WPF controls Xceed DataGrid for WPF DataBinding problem in CellContentTemplate.

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

    Hi,

    I try to define a cell content template as below:

    <DataTemplate x:Key=”NameTemplate” >

    <StackPanel>

    <TextBlock Text=”{Binding FirstName}” />

    <TextBlock Text=”{Binding LastName}” />

    </StackPanel>

    </DataTemplate>

    When I try to set one of the column to this data template which the
    FieldName = “FirstName”. The cell in the template return empty.

    For your information, i’m using CLR collection object as ItemsSource.

    Imported from legacy forums. Posted by William (had 1755 views)

    Xceed Support
    Member
    Post count: 5658

    Since the Column is already mapped to “FirstName” (which is probably a string), it is normal that the FirstName and LastName property are not found on a String object.

    To create a “Name” Column, set the display member binding of the column to “{Binding .}” and then the DataTemplate will work.

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

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