作成日: 2019/05/31 最終更新日: 2019/05/31
文書種別
使用方法
詳細
CellFactoryクラスを継承した独自のCellFactoryを作成し、CreateCellContentメソッドをオーバーライドして、TooltipServiceを使用してセル要素にツールチップを設定します。
◎サンプルコード(Visual Basic)
◎サンプルコード(C#)
◎サンプルコード(Visual Basic)
Imports C1.WPF.FlexGrid
Class MainWindow
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
flexGrid.CellFactory = New CustomCellFactory()
End Sub
End Class
Class CustomCellFactory
Inherits CellFactory
Public Overrides Sub CreateCellContent(grid As C1FlexGrid, bdr As Border, rng As CellRange)
MyBase.CreateCellContent(grid, bdr, rng)
If (rng.Column = 0) Then
ToolTipService.SetToolTip(bdr, "ツールチップ")
End If
End Sub
End Class
Class MainWindow
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
flexGrid.CellFactory = New CustomCellFactory()
End Sub
End Class
Class CustomCellFactory
Inherits CellFactory
Public Overrides Sub CreateCellContent(grid As C1FlexGrid, bdr As Border, rng As CellRange)
MyBase.CreateCellContent(grid, bdr, rng)
If (rng.Column = 0) Then
ToolTipService.SetToolTip(bdr, "ツールチップ")
End If
End Sub
End Class
◎サンプルコード(C#)
using C1.WPF.FlexGrid;
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
flexGrid.CellFactory = new CustomCellFactory();
}
}
public class CustomCellFactory : CellFactory
{
public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
{
base.CreateCellContent(grid, bdr, rng);
if (rng.Column == 0)
ToolTipService.SetToolTip(bdr, "ツールチップ");
}
}
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
flexGrid.CellFactory = new CustomCellFactory();
}
}
public class CustomCellFactory : CellFactory
{
public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
{
base.CreateCellContent(grid, bdr, rng);
if (rng.Column == 0)
ToolTipService.SetToolTip(bdr, "ツールチップ");
}
}
旧文書番号
84008