Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Displaying Child collection as Grid in Carousel item
posted

I am trying to use a carousel to display a few fields, one of which is a collection of child items. In the case of the child items, Instead of making them drill down into lower level carousel, I'd instead like to use a CellValuePresenter for the collection field, and create a control template that contains a grid of child items. 

Using a fictional example: There is a List<Person>, which would be bound to a XamDataCarousel.

class Person {

string Name {get; set;}

List<string> PhoneNumbers { get; set}

}

For each person represented by the carousel, the aim would be that name would appear in the top row of the carousel block, and the control template would appear for the child collection. The control template would create a XamDataGrid that listed all the phone numbers for the person.

I have tried implementing this, but the list seems to be ignored by the carousel. I assume there is special handling in there for lists which makes them get ignored, rather than processed in the usual way. Is this so?

My attempt so far...

<igDP:FieldLayout>
    <igDP:FieldLayout.Fields>
        <igDP:Field Name="Name" />
        <igDP:Field Name="PhoneNumbers">
            <igDP:Field.Settings>
                <igDP:FieldSettings CellValuePresenterStyle="{StaticResource PhoneNumberCellPresenterStyle}" />
            </igDP:Field.Settings>
        </igDP:Field>
    </igDP:FieldLayout.Fields>
</igDP:FieldLayout>

With the style creating a template, then a grid bound to the cell's value, defined as so:

<Style x:Key="PhoneNumberCellPresenterStyle" TargetType="{x:Type igDP:CellValuePresenter}" >
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                <igDP:XamDataGrid DataSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"
                                  Theme="[current]">
                </igDP:XamDataGrid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Is there any way to achieve what I want to?

 

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.

     

    Thanks again.

Children
No Data