Hello Team,
I am unable to change the width and label of fields. I presume that labels should be displayed in the application as column names, but field 'names' are displayed instead. I dont want to use field 'names', I want to use 'labels'. Field 'names' correspond to the field names in the list bound to the grid. Also the field 'width' is not having any impact on the fields width in the grid. Please help.
I have the following xaml code for a grid:
<igWPF:XamDataGrid Grid.Row="1" Height="390" HorizontalAlignment="Left" Margin="10,0,0,0" Name="xamDataGrid1" VerticalAlignment="Top" Theme="IGTheme" BindToSampleData="False" IsNestedDataDisplayEnabled="False" DataSource="{Binding MTOs, Mode=TwoWay, NotifyOnTargetUpdated=True}" BorderThickness="2" BorderBrush="#FF1A008D" IsGroupByAreaExpanded="False" GroupByAreaLocation="None" Width="901" ActiveDataItem="{Binding SelectedMTO, Mode=TwoWay}"> <!--<igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:FieldLayoutSettings AutoGenerateFields="False"></igWPF:FieldLayoutSettings> </igWPF:XamDataGrid.FieldLayoutSettings>--> <igWPF:XamDataGrid.FieldLayouts> <igWPF:FieldLayout> <igWPF:FieldLayout.FieldSettings> <igWPF:FieldSettings AllowEdit="False"/> </igWPF:FieldLayout.FieldSettings> <igWPF:FieldLayout.Fields> <igWPF:Field Name="MTO_ID" Label="ID" DisallowModificationViaClipboard="False" Width="12" > <igWPF:Field.Settings> <igWPF:FieldSettings AllowEdit="False" /> </igWPF:Field.Settings> </igWPF:Field> <igWPF:Field Name="Client_Name" Label="Client Name" > <igWPF:Field.Settings> <igWPF:FieldSettings /> </igWPF:Field.Settings> </igWPF:Field> <igWPF:Field Name="MTO_Description" Label="Description" > <igWPF:Field.Settings> <igWPF:FieldSettings /> </igWPF:Field.Settings> </igWPF:Field> <igWPF:Field Name="mt_dateuploaded" Label="Date Uploaded"/> <igWPF:Field Name="mt_uploadedby" Label="Uploaded By"/> <igWPF:Field Name="Date_Modified" Label="Date Modified"/> <igWPF:Field Name="ModifiedBy" Label="Modified By"/> <igWPF:Field Name="Status" Label="Status"/> </igWPF:FieldLayout.Fields> </igWPF:FieldLayout> </igWPF:XamDataGrid.FieldLayouts> </igWPF:XamDataGrid>
I have the following additional questions as well:
- I would like to the wrap the field name. For example 'Customer Names' should be wrapped and each word should be on a separate line, thus reducing the field width while displaying the full field name.
- I would also like to know how to have a field width that is dynamically adjustable depending on the data that is populated in the column.
Thank you and looking forward to your assistance.
Hello Sherif,
I am just checking your progress on the issue.
If you require any further assistance, please do not hesitate to ask.
I have been looking into your post and created a sample project (XamDataGridLabels.zip) trying to represent the behavior you had described. On my side the Label property changes the text that is displayed on the top of the field and value of the Width property corresponds to the width of the field.
If you want to wrap the labels so that the text is shown on multiple rows, you could set the LabelTextWrapping property of the FieldSettings. You can change the Width property to Auto and the width of the fields will adjust dynamically depending on the displayed text.
Please feel free to ask if you have any other questions.