We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Format GroupDescriptor PropertyName

Hi,

In my .xaml i have de following code:

                        <syncfusion:SfListView.DataSource>
                            <data:DataSource>
                                <data:DataSource.SortDescriptors>
                                    <data:SortDescriptor PropertyName="ClockDate" Direction="Ascending"/>
                                </data:DataSource.SortDescriptors>
                                <data:DataSource.GroupDescriptors>
                                    <data:GroupDescriptor PropertyName="ClockDate"/>
                                </data:DataSource.GroupDescriptors>
                            </data:DataSource>

ClockDate is a DateTime property.

Is it possible to format it like dd-MM-yyyy

Best regards,

Thijs van Rijswijk

3 Replies

JN Jayaleshwari N Syncfusion Team November 27, 2018 06:27 AM UTC

Hi Thijs van Rijswijk, 
 
Thanks for Contacting Syncfusion Support. 
 
We have checked the reported query “Format GroupDescriptor PropertyName” from our side. You can achieve your requirement by using GroupHeadeTemplate and define the binding with StringFormat for the property you are bound to the elements loaded in the GroupHeaderTemplate. 
 
<syncfusion:SfListView.GroupHeaderTemplate> 
    <DataTemplate> 
        <ViewCell> 
            <ViewCell.View> 
                <Grid Padding="2" Margin="2"> 
                    <Frame Padding="2" Margin="2" OutlineColor="AntiqueWhite" HasShadow="True"> 
                        <StackLayout> 
                            <Label x:Name="label" Text="{Binding Key, StringFormat='\{0:dd-MM-yyyy}'}"  
                            FontSize="22"                                    
                            FontAttributes="Bold"                                     
                            VerticalOptions="Center"  
                            HorizontalOptions="Start"  
                            /> 
                        </StackLayout> 
                    </Frame> 
                </Grid> 
            </ViewCell.View> 
        </ViewCell> 
    </DataTemplate> 
</syncfusion:SfListView.GroupHeaderTemplate> 
 
We have attached the sample for your reference and you can download the same from the following location. 
 
Please let us know, if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 



TV Thijs van Rijswijk November 27, 2018 06:46 AM UTC

Hi,

Works like a charm.

Thank you.


JN Jayaleshwari N Syncfusion Team November 27, 2018 09:35 AM UTC

Hi Thijs van Rijswijk, 

Thanks for the update. Please get in touch if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 


Loader.
Live Chat Icon For mobile
Up arrow icon