Beispiel #1
0
        private async Task SetDtGridLastColumnWidth()
        {
            totalWidthOfColumnsDtGrid = 0;
            foreach (var column in DtGrid.Columns)
            {
                if (column.Visibility == Visibility.Visible)
                {
                    column.Width = new DataGridLength(0, DataGridLengthUnitType.Auto);
                }
            }
            DtGrid.Refresh();
            await Task.Delay(10);       //for render recaculate width of column

            foreach (var column in DtGrid.Columns)
            {
                if (column.Visibility == Visibility.Visible)
                {
                    lastColumn = column;
                    totalWidthOfColumnsDtGrid += column.ActualWidth;
                }
            }

            if (lastColumn != null)
            {
                if (totalWidthOfColumnsDtGrid < DtGrid.ActualWidth)
                {
                    lastColumn.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
                }
            }
            DtGrid.Refresh();
            await Task.Delay(10);       //for render recaculate width of column

            if (lastColumn != null)
            {
                lastColumn.Width = lastColumn.ActualWidth;
            }
        }
Beispiel #2
0
 private void AutoUpdateCheckbox_Unchecked(object sender, RoutedEventArgs e)
 {
     DtGrid.AddHandler(DataGridRow.MouseDoubleClickEvent, new MouseButtonEventHandler(DtGridRow_MouseDoubleClick));
 }