Question

I want to set the Column width of XamDataGrid in XAML. There is no Width Property available like

<ip:Field Label="Name" ........... Width="60"/>

Here is my sample code.

    <ip:XamDataGrid Name="PatientsList" DataSource="{Binding PatientsList}" SelectedItemsChanged="PatientsListSelectedItemsChanged"
                    XamDataGridBehaviours:XamDataGridBehavior.IsSynchronizedWithCurrentItem="True" GroupByAreaLocation="None">
        <ip:XamDataGrid.FieldLayoutSettings>
            <ip:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeRecord="Extended" MaxSelectedRecords="1"/>
        </ip:XamDataGrid.FieldLayoutSettings>
        <ip:XamDataGrid.FieldSettings>
            <ip:FieldSettings AllowEdit="False" CellClickAction="SelectRecord"/>
        </ip:XamDataGrid.FieldSettings>
        <ip:XamDataGrid.FieldLayouts>
            <ip:FieldLayout>
                <ip:FieldLayout.Fields>
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colSex}}" Name="Sex"/>
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colPatientId}}" Name="PatientId"/>
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colLastName}}" Name="LastName" />
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colFirstName}}" Name="FirstName" />
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colPatientId}}" Name="FullName" />
                    <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colDOB}}" Name="DateOfBirth" />
                </ip:FieldLayout.Fields>
            </ip:FieldLayout>
        </ip:XamDataGrid.FieldLayouts>
    </ip:XamDataGrid>
Was it helpful?

Solution

A Width property was added to Fields in version 9.2. But there have always been CellWidth, CellMinWidth, and CellMaxWidth properties on the FieldSettings and each field has its own FieldSettings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top