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
20
XamDataGrid
posted

                                        <igDP:TemplateField Name="FileName" Label="Nom du Fichier" 
                                                            VerticalContentAlignment="Center" 
                                                            ToolTip="Nom et chemin complet du Fichier">
                                            <igDP:TemplateField.DisplayTemplate>
                                                <DataTemplate>
                                                    <StackPanel>
                                                        <StackPanel Orientation="Vertical" >
                                                            <TextBlock Text="{Binding Mode=OneWay, Source={StaticResource GridDisplayTemplate}}" Foreground="red" FontWeight="Bold"/>
                                                            <TextBlock Text="{igEditors:TemplateEditorValueBinding}" FontStyle="Italic"/>
                                                        </StackPanel>
                                                        <TextBlock Text="{Binding Path=DataItem.Format}"/>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </igDP:TemplateField.DisplayTemplate>

Hello...

How do I bind to the Format cell?
<TextBlock Text="{Binding Path=DataItem.Format}"/> does not work

Can you help me, thanks

  • 1700
    Offline posted

    Hello Genoud,

    Depending on how you are binding the DataSource of the grid and if the ViewModel contains the format property you can try binding the Text property in the following way:

    <TextBlock Text="{Binding Path=DataContext.DataItem.Format}"/>

    Alternatively, you can use the following binding as well:

    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type ig:XamDataGrid}}, Path= DataContext.Format}"/>

    Additionally, I strongly recommend you reviewing the following topic in our documentation that provides further information of how to create a field with a custom display and edit template using a TemplateField:

    https://ko.infragistics.com/help/wpf/xamdatagrid-configuring-template-field

    I am also attaching a small sample that demonstrates how a template field could be used with data coming from the ViewModel.

    Please let me know if you have any questions or concerns.

    Regards,
    Ivan Kitanov

    TemplateField Binding.zip