在我的应用程序中,我试图实现工具提示,它会根据dataGrid Column的文本向我显示datagrid中的一些错误。对于示例,我有4列带有用于输入一些数据的文本框,如果某些列中的数据对规则不多,或者如果其中一些列在最后的第4列为空,我应该向工具提示显示一些解释文本。
<WpfToolkit:DataGridTemplateColumn Width="0.02*" IsReadOnly="True">
<WpfToolkit:DataGridTemplateColumn.CellStyle>
<Style TargetType="{x:Type WpfToolkit:DataGridCell}" BasedOn="{StaticResource TransparentCellSelection}">
<Style.Triggers>
<DataTrigger Value="1">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DataGridRowToolTipConverter}">
<Binding Path="IsRequired" />
<Binding Path="InputColumns.Count" />
<Binding Path="HasDefaultValue" />
<Binding Path="HasOverwritingValue" />
<Binding Path="MappingType" />
<Binding Path="SourceColumnMappings" />
<Binding Path="ColumnStatus" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="ToolTip" Value="Translation mapping is incomplete." />
</DataTrigger>
<DataTrigger Value="2">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DataGridRowToolTipConverter}">
<Binding Path="IsRequired" />
<Binding Path="InputColumns.Count"/>
<Binding Path="HasDefaultValue" />
<Binding Path="HasOverwritingValue" />
<Binding Path="MappingType" />
<Binding Path="SourceColumnMappings" />
<Binding Path="ColumnStatus" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="ToolTip" Value="Overwriting Value overrides Mapping. Mapping and Default Value are ignored." />
</DataTrigger>
<DataTrigger Value="3">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DataGridRowToolTipConverter}">
<Binding Path="IsRequired" />
<Binding Path="InputColumns.Count" />
<Binding Path="HasDefaultValue" />
<Binding Path="HasOverwritingValue" />
<Binding Path="MappingType" />
<Binding Path="SourceColumnMappings" />
<Binding Path="ColumnStatus" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="ToolTip" Value="Default Value cannot be set for empty Mapping. Please define Mapping or use Overwriting Value instead of Default Value." />
</DataTrigger>
有人知道最好的方法吗?