private static void InitializeColumns(System.Windows.Controls.ListView listView) { if (ListView.TryRegisterColumns(listView)) { ListView.AlignColumns(listView); } }
private static void OnTextAlignmentChanged(DependencyObject attachingElement, DependencyPropertyChangedEventArgs e) { // Get the parent ListView of the current column if (attachingElement is GridViewColumn gridViewColumn && ListView.ColumnListViewTable.TryGetValue(gridViewColumn, out System.Windows.Controls.ListView listView)) { ListView.AlignColumns(listView); } }