Skip to content

Commit

Permalink
Allow session info and overlay data grid shrinking
Browse files Browse the repository at this point in the history
  • Loading branch information
tremwil committed May 9, 2021
1 parent 2db7d27 commit abf4588
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions DS3ConnectionInfo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion DS3ConnectionInfo/OverlayWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</local:OverlayTextBlock.Style>
</local:OverlayTextBlock>
<DataGrid CanUserSortColumns="False" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" HeadersVisibility="None"
Background="Transparent" RowBackground="Transparent" ItemsSource="{Binding}" AutoGenerateColumns="False" Name="dataGrid">
Background="Transparent" RowBackground="Transparent" ItemsSource="{Binding}" AutoGenerateColumns="False" Name="dataGrid" ColumnWidth="SizeToCells">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Slot" SortDirection="Ascending">
<DataGridTemplateColumn.CellTemplate>
Expand Down

0 comments on commit abf4588

Please sign in to comment.