コード例 #1
0
        // Applies the given Style to the Row if it's supposed to use DataGrid.RowStyle
        private static void EnsureElementStyle(FrameworkElement element, Style oldDataGridStyle, Style newDataGridStyle)
        {
            Debug.Assert(element != null);

            // Apply the DataGrid style if the row was using the old DataGridRowStyle before
            if (element != null && (element.Style == null || element.Style == oldDataGridStyle))
            {
                element.SetStyleWithType(newDataGridStyle);
            }
        }