我想为我的应用程序定义一个 XamDataGrid 的全局设置,但我希望其他开发人员能够在不覆盖整个设置的情况下覆盖特定设置。下面的示例 xaml:
<igDP:FieldLayoutSettings x:Key="DefaultFieldLayoutSettings"
HighlightAlternateRecords="True"
FilterRecordLocation="OnTop"
FilterUIType="LabelIcons"
ReevaluateFiltersOnDataChange="True"
SummaryDescriptionVisibility="Visible"
GroupBySummaryDisplayMode="SummaryCellsAlwaysBelowDescription"
AllowClipboardOperations="Copy"
AllowRecordFixing="Top"
AllowAddNew="False"
AllowDelete="False"
AutoFitMode="ExtendLastField"
AutoGenerateFields="False"
HeaderPrefixAreaDisplayMode="FieldChooserButton"
HighlightPrimaryField="Highlight"
FixedFieldUIType="Button"
FixedRecordUIType="Button"
DataRecordCellAreaStyle="{StaticResource defaultDataRecordCellArea}"
/>
<igDP:FieldSettings x:Key="DefaultFieldSettings"
AllowRecordFiltering="True"
FilterClearButtonVisibility="Visible"
FilterStringComparisonType="CaseInsensitive"
FilterLabelIconDropDownType="MultiSelectExcelStyle"
AllowSummaries="True"
CellHeight="200"
SummaryDisplayArea="BottomFixed"
SummaryUIType="MultiSelectForNumericsOnly"
AllowEdit="False"
AllowFixing="Near"
AllowGroupBy="True"
AllowResize="True"
/>
<Style x:Key="DefaultXamDataGridStyle" TargetType="{x:Type igDP:XamDataGrid}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Theme" Value="Office2010Blue" />
<Setter Property="IsNestedDataDisplayEnabled" Value="False"/>
<Setter Property="ClipboardCellDelimiter" Value=","/>
<Setter Property="ClipboardRecordSeparator" Value=";"/>
<Setter Property="IsUndoEnabled" Value="True"/>
<Setter Property="FieldLayoutSettings" Value="{StaticResource DefaultFieldLayoutSettings}"/>
<Setter Property="FieldSettings" Value="{StaticResource DefaultFieldSettings}"/>
</Style>
视图中的实际 xaml。
<igDP:XamDataGrid DataSource="{Binding Path=QueryStatuses}" Style="{StaticResource
DefaultXamDataGridStyle}">
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings CellClickAction="SelectRecord" />
</igDP:XamDataGrid.FieldSettings>
</igDP:XamDataGrid>
现在有办法只覆盖本地 fieldSetings 中明确定义的内容并保留其他全局设置。现在,本地 FieldSetting 覆盖了全局 fieldSettings,这是有道理的。