public CollectionListView() { InitializeComponent(); ListCollectionData.MouseDoubleClick += ListCollectionDataOnMouseDoubleClick; ListCollectionData.SelectionChanged += OnListViewSelectionChanged; ListCollectionData.SetBinding(Selector.SelectedItemProperty, new Binding { Source = this, Path = new PropertyPath(nameof(SelectedItem)), Mode = BindingMode.TwoWay }); ListCollectionData.Loaded += (sender, args) => { Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { var maxWidth = Math.Max(600, ListCollectionData.ActualWidth) / Math.Min(3, GridCollectionData.Columns.Count + 1); foreach (var col in GridCollectionData.Columns) { col.Width = col.ActualWidth > maxWidth ? maxWidth : Math.Max(100, col.ActualWidth); } })); _listLoaded = true; }; }
public CollectionListView() { InitializeComponent(); ListCollectionData.MouseDoubleClick += ListCollectionDataOnMouseDoubleClick; ListCollectionData.SelectionChanged += OnListViewSelectionChanged; ListCollectionData.SetBinding(Selector.SelectedItemProperty, new Binding { Source = this, Path = new PropertyPath(nameof(SelectedItem)), Mode = BindingMode.TwoWay }); }