Изменение стиля сетки таблицы Grid в WPF
Чтобы изменить стиль линий сетки в WPF:
Private Sub ShowGridLines() Dim t = Type.GetType("System.Windows.Controls.Grid+GridLinesRenderer," _ & " PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") Dim glr = Activator.CreateInstance(t) glr.GetType().GetField("s_oddDashPen", Reflection.BindingFlags.Static Or Reflection.BindingFlags.NonPublic).SetValue(glr, New Pen(Brushes.Silver, 0.2)) glr.GetType().GetField("s_evenDashPen", Reflection.BindingFlags.Static Or Reflection.BindingFlags.NonPublic).SetValue(glr, New Pen(Brushes.Silver, 0.2)) matrixGrid.ShowGridLines = True End Sub
Теги :