From abf4588ec8298314519c12276cae748b3c2983c4 Mon Sep 17 00:00:00 2001 From: William Tremblay Date: Sun, 9 May 2021 02:03:51 -0400 Subject: [PATCH] Allow session info and overlay data grid shrinking --- DS3ConnectionInfo/MainWindow.xaml.cs | 16 ++++++++++++++++ DS3ConnectionInfo/OverlayWindow.xaml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/DS3ConnectionInfo/MainWindow.xaml.cs b/DS3ConnectionInfo/MainWindow.xaml.cs index b9a5f39..2b12bba 100644 --- a/DS3ConnectionInfo/MainWindow.xaml.cs +++ b/DS3ConnectionInfo/MainWindow.xaml.cs @@ -100,6 +100,22 @@ private void UpdateTimer_Tick(object sender, EventArgs e) foreach (Player p in Player.ActivePlayers()) playerData.Add(p); + // Update session info column sizes + foreach (var col in dataGridSession.Columns) + { + col.Width = new DataGridLength(1, DataGridLengthUnitType.Pixel); + col.Width = new DataGridLength(1, DataGridLengthUnitType.Auto); + } + dataGridSession.UpdateLayout(); + + // Update overlay column sizes + foreach (var col in overlay.dataGrid.Columns) + { + col.Width = new DataGridLength(1, DataGridLengthUnitType.Pixel); + col.Width = new DataGridLength(1, DataGridLengthUnitType.SizeToCells); + } + overlay.dataGrid.UpdateLayout(); + // Queue position update after the overlay has re-rendered Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(overlay.UpdatePosition)); diff --git a/DS3ConnectionInfo/OverlayWindow.xaml b/DS3ConnectionInfo/OverlayWindow.xaml index bf3546a..156e169 100644 --- a/DS3ConnectionInfo/OverlayWindow.xaml +++ b/DS3ConnectionInfo/OverlayWindow.xaml @@ -39,7 +39,7 @@ + Background="Transparent" RowBackground="Transparent" ItemsSource="{Binding}" AutoGenerateColumns="False" Name="dataGrid" ColumnWidth="SizeToCells">