Wpf 如何设置XamDataGrid单元格';s视图模型中的工具提示thru属性
我正在MVVM架构上实现WPF XamDataGrid。想知道如何通过绑定到视图模型文件中的属性来设置单元格的工具提示文本? 欢迎提出任何建议!Wpf 如何设置XamDataGrid单元格';s视图模型中的工具提示thru属性,wpf,mvvm,tooltip,xamdatagrid,Wpf,Mvvm,Tooltip,Xamdatagrid,我正在MVVM架构上实现WPF XamDataGrid。想知道如何通过绑定到视图模型文件中的属性来设置单元格的工具提示文本? 欢迎提出任何建议! Anshuman例如,您需要一个用于行和行表示类GridRow的工具提示 在GridRow中添加下一步: class GridRow { GridRow() //or other constructor { ... RowToolTip = "Tooltip for one row"; } public string
Anshuman例如,您需要一个用于行和行表示类GridRow的工具提示 在GridRow中添加下一步:
class GridRow
{
GridRow() //or other constructor
{
...
RowToolTip = "Tooltip for one row";
}
public string RowToolTip {get; set;}
}
如果希望在运行时更新工具提示,请不要忘记为GridRow实现并使用INotifyPropertyChanged
在带有网格的xaml中添加下一个代码:
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="ToolTip" Value="{Binding DataItem.RowToolTip}" />
</Style>
</igDP:XamDataGrid.Resources>
若您需要为行中的不同单元格提供不同的工具提示,那个么这需要更多的代码。例如,您需要为行和行表示类GridRow提供一个工具提示 在GridRow中添加下一步:
class GridRow
{
GridRow() //or other constructor
{
...
RowToolTip = "Tooltip for one row";
}
public string RowToolTip {get; set;}
}
如果希望在运行时更新工具提示,请不要忘记为GridRow实现并使用INotifyPropertyChanged
在带有网格的xaml中添加下一个代码:
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="ToolTip" Value="{Binding DataItem.RowToolTip}" />
</Style>
</igDP:XamDataGrid.Resources>
若您需要为行中的不同单元格提供不同的工具提示,那个么这就需要更多的代码