, , , DataColumnHeader, , .
:
from System.Windows.Media import VisualTreeHelper
def findChildren(parent, findType):
count = VisualTreeHelper.GetChildrenCount(parent)
for i in range(count):
child = VisualTreeHelper.GetChild(parent, i)
if isinstance(child, findType):
yield child
else:
for entry in findChildren(child, findType):
yield entry
:
from System.Windows.Controls import Button
from System.Windows.Controls.Primitives import DataGridColumnHeader
for entry in findChildren(self._gridControl, DataGridColumnHeader):
for button in findChildren(entry, Button):
button.Click += handler
, grid.Loaded, , .