Home Forums WPF controls Xceed DataGrid for WPF Custom DataRow Template for Card View

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

    Hi,

    I am trying to create a custom DataRow Template for a Card View.  I am using an Expander, but the header doesn’t show any data.  Am I doing something wrong? 

    Thanks,

    Wally

    The Following is the DataCell and DataRow Templates:

    <Style x:Key=”CardViewDataCellStyle” TargetType=”{x:Type xcdg:DataCell}”>

    <Setter Property=”Template”>

    <Setter.Value>

    <ControlTemplate TargetType=”{x:Type xcdg:DataCell}”>

    <ContentPresenter

    Content=”{xcdg:CellContentBinding}”

    ContentTemplate=”{TemplateBinding ContentTemplate}”

    ContentTemplateSelector=”{TemplateBinding ContentTemplateSelector}”/>

    </ControlTemplate>

    </Setter.Value>

    </Setter>

    </Style>

    <ControlTemplate x:Name=”CardViewDataRowTemplate” TargetType=”{x:Type xcdg:DataRow}”>

    <Expander x:Name=”PART_RowFocusRoot”

    Background=”{TemplateBinding Background}”

    BorderBrush=”{TemplateBinding BorderBrush}”

    BorderThickness=”{TemplateBinding BorderThickness}”

    Padding=”{TemplateBinding Padding}”>

    <Expander.Header>

    <Grid>

    <Grid.RowDefinitions>

    <RowDefinition Height=”Auto”/>

    <RowDefinition Height=”Auto”/>

    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>

    <ColumnDefinition Width=”*”/>

    <ColumnDefinition Width=”Auto”/>

    </Grid.ColumnDefinitions>

    <xcdg:DataCell Grid.Row=”0″ Grid.Column=”0″ FieldName=”Case” Style=”{StaticResource CardViewDataCellStyle}”/>

    <xcdg:DataCell Grid.Row=”1″ Grid.Column=”0″ FieldName=”Debtor” Style=”{StaticResource CardViewDataCellStyle}”/>

    <xcdg:DataCell Grid.Row=”0″ Grid.Column=”1″ FieldName=”Date” Style=”{StaticResource CardViewDataCellStyle}”/>

    <xcdg:DataCell Grid.Row=”1″ Grid.Column=”1″ FieldName=”Time” Style=”{StaticResource CardViewDataCellStyle}”/>

    </Grid>

    </Expander.Header>

    <StackPanel x:Name=”PART_CellsHost” Grid.IsSharedSizeScope=”True” Margin=”5″ Orientation=”Vertical”/>

    </Expander>

    </ControlTemplate>

     

    Imported from legacy forums. Posted by Wally (had 3243 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Wally,

    I am not certain why the DataCell does not appear in the header of the expander nor have I extensivly tested; however, you could just place a TextBlock that is bound to the desired property (don’t forget to hide the equivalent cells since they will be created in the PART_CellsHost).

    <Expander.Header>
      
    <TextBlock Text=”{Binding [FirstName]}” />
    </Expander.Header>

     

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

    User (Old forums)
    Member
    Post count: 23064

    Jenny,

    Thank you very much for your reply.

    That works but that will not give me the CellEditor when I click on it.  It there another work around that will work the same as the DataCell? 

    It seems like it doesn’t work with an Expander because it just searches the content and not the complete visual tree.

    Thanks again,

    Wally

     

    Imported from legacy forums. Posted by Wally (had 604 views)

    Xceed Support
    Member
    Post count: 5658

    [quote user=”Wally”]

    It seems like it doesn’t work with an Expander because it just searches the content and not the complete visual tree.

    [/quote]

    I don’t have a solution for you other than maybe creating your own custom expander-like control in which you display the datacells.

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

    User (Old forums)
    Member
    Post count: 23064

    Jenny,

    Thanks, again for your time.

    That’s what I thought.

    Wally

    Imported from legacy forums. Posted by Wally (had 1391 views)

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