установка ширины столбца XamDataGrid в XAML

Я хочу установить ширину столбца XamDataGrid в XAML. Свойство Width недоступно, например

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

Вот мой пример кода.

    <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>

person Saghar    schedule 05.11.2010    source источник


Ответы (1)


Свойство Width было добавлено в поля в версии 9.2. Но в FieldSettings всегда были свойства CellWidth, CellMinWidth и CellMaxWidth, и каждое поле имеет свой собственный FieldSettings.

person Mike Dour    schedule 05.11.2010
comment
@Mike: Ты пробовал их в XAML? По крайней мере, я не могу получить к ним доступ в v7.2. - person Saghar; 05.11.2010
comment
Вы можете определить поле следующим образом: <ip:Field Label="{Binding Source={x:Static properties:Resources.StudyManager_colSex}}" Name="Sex"> <ip:Field.Settings> <ip:FieldSettings CellMaxWidth="50" /> </ip:Field.Settings> </ip:Field> - person Mike Dour; 05.11.2010
comment
Он просто изменяет ширину ячейки, но не всего столбца. Вы поняли, что я имею в виду? Это выглядит очень некрасиво. - person Saghar; 05.11.2010
comment
Я не уверен, что понимаю. Изменяется ширина только одной ячейки или ширина всех ячеек изменяется, но заголовок поля не меняется? - person Mike Dour; 05.11.2010
comment
Да, заголовок поля не меняется. - person Saghar; 05.11.2010
comment
Я не вижу этого в версии 9.2. Похоже, это ошибка, которую исправили. Вы пробовали установить последний SR для 7.2? - person Mike Dour; 05.11.2010