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
360
How to set the Label of a Field Correctly while DataBound
posted

Hello,

I've got a problem with the Field Label. I want to change the Header Text of the XamlDataGrid, but nothing changed here the xaml code:

<Grid x:Name="rows_grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<my:XamDataGrid Height="{Binding ElementName=rows_grid,Path=Height}" AutoFit="True" DataSource="{Binding Result, UpdateSourceTrigger=PropertyChanged}"
        Name="xamlGrid" IsSynchronizedWithCurrentItem="True"
        ActiveDataItem="{Binding Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged, Path=RowObject}" IsGroupByAreaExpanded="True" MouseRightButtonDown="xamlGrid_MouseRightButtonDown"
        >
<igDP:XamDataGrid.ViewSettings>
<igDP:GridViewSettings />
</igDP:XamDataGrid.ViewSettings>
<my:XamDataGrid.Resources>

</my:XamDataGrid.Resources>

<my:XamDataGrid.FieldSettings>
<my:FieldSettings AllowEdit="False" CellClickAction="SelectRecord"  >
</my:FieldSettings>
</my:XamDataGrid.FieldSettings>
<my:XamDataGrid.ContextMenu>
<ContextMenu>
    <MenuItem
        Header="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.ContextMenu.MenuOpenItem}"
        Command="{Binding ContextFileNameOpenClickCommand}"/>
</ContextMenu>
</my:XamDataGrid.ContextMenu>

<my:XamDataGrid.FieldLayoutSettings>
<my:FieldLayoutSettings AutoGenerateFields="False"  AutoFitMode="Always"/>
</my:XamDataGrid.FieldLayoutSettings>
<my:XamDataGrid.FieldLayouts>
<my:FieldLayout>
    <my:FieldLayout.Fields>
        <my:Field  Name="SalesAgentSK"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.SALogInName}"
                  Visibility="Visible" AutomationProperties.Name="A">
          
            <!--<my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:String}"/>
                          
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>-->

        </my:Field >

        <my:Field Name="SALogInName"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.SALogInName}"
                  Visibility="Visible" >
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:String}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="SAName"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.SAName}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}"  >
                            <Setter Property="ValueType" Value="{x:Type sys:String}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="OrderNumber"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.OrderNumber}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:String}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="OrderTicketNo"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.OrderTicketNo}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:Int32}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="OrderPrice"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.OrderPrice}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:Double}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="OldTurnover"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.OldTurnover}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:Double}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="OrderDate"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.OrderDate}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ValueType" Value="{x:Type sys:DateTime}"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

        <my:Field Name="PathFileName"
                  Label="{Binding Converter={StaticResource MyLocalizationConverter}, ConverterParameter=Maintab.Rows.GridLabel.PathFileName}"
                  Visibility="Visible">
            <my:Field.Settings>
                <my:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}" CellClickAction="SelectRecord">
                    <my:FieldSettings.EditorStyle>
                        <Style TargetType="{x:Type igEditors:XamTextEditor}" >
                            <Setter Property="ReadOnly" Value="True"/>
                        </Style>
                    </my:FieldSettings.EditorStyle>
                </my:FieldSettings>
            </my:Field.Settings>
        </my:Field>

    </my:FieldLayout.Fields>
</my:FieldLayout>
</my:XamDataGrid.FieldLayouts>


<my:XamDataGrid.InputBindings>
<MouseBinding  Gesture="LeftDoubleClick" Command="{Binding SelectedRowCommand}" CommandParameter="{Binding ElementName=xamlGrid,Path=SelectedRow.ListObject}"/>
</my:XamDataGrid.InputBindings>

</my:XamDataGrid>

 

Any ideas?

Thank in advance

 

 

 

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking through it and I suggest you see the “XamDataGridTest” sample from this forum thread:

     

    http://community.infragistics.com/forums/p/59980/307701.aspx#307701

     

    where it is shown how to bind the Field’s Label Property to a Property of the underlying data. Please let me know if you need further clarification on this matter.

     

    Looking forward for your reply.

Children