2010-11-05 72 views
2

我想在XAML中設置XamDataGrid的列寬。有沒有寬度屬性可用像設置XAML中XamDataGrid的列寬

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

回答

5

A Width屬性已添加到9.2版的Fields中。但是FieldSettings上一直有CellWidth,CellMinWidthCellMaxWidth屬性,並且每個字段都有其自己的FieldSettings

+0

@Mike:你有沒有在XAML中試過它們?至少我不能在v7.2中訪問它們。 – Saghar 2010-11-05 14:30:45

+0

您可以像這樣定義一個字段: < ip:FieldSettings CellMaxWidth =「50」/> ' – 2010-11-05 14:47:17

+0

讓我試試看。 – Saghar 2010-11-05 15:00:25