I want to create Empty Templete in xamDataGrid to display when there is no rows founded after binding.
Any help is appreciated
Thank you,
Hello Chakradhar,
Thank you for your post. I have been looking into it but it seems like that I am missing something in your scenario, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
HI, all
I am binding list to xamdatagrid,if the records are present in list it is displaying correctly but if i don't have records then have to display " No records " massage on datagrid.Have used peter posted code but it is not giving me solution.So any help will be appriciated.
Regards,
Chakradhar.
Thank you Petar
I got. Previously I tried it but It was also removing column heading. But I wanted to show column heading. I binded the same property with one of my ViewModel property that returns list count.
But yaa thank you very much for your time
Hello ,
You can create a style for the XamDataGrid with a DataTrigger that would change the ControlTempate according to the Records collection Count property. Here is sample xaml snippet that would turn the XamDataGrid into a aqua-coloured Grid with a red text in the middle:
<Style TargetType="{x:Type igDP:XamDataGrid}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self},Path=Records.Count}" Value="0">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:XamDataGrid}">
<Grid Background="Aqua" >
<TextBlock Text="There are no Records in this XamDataGrid!" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
Or you can just use <Grid />
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support