Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/TableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@
_headerRow = GetTemplateChild("HeaderRow") as TableViewHeaderRow;
_scrollViewer = GetTemplateChild("ScrollViewer") as ScrollViewer;
_headerRowDefinition = GetTemplateChild("HeaderRowDefinition") as RowDefinition;
if (_scrollViewer is not null) _scrollViewer.Loaded += OnScrollViewerLoaded;

if (IsLoaded)
{
while (ItemsPanelRoot is null) await Task.Yield();
Expand All @@ -292,9 +294,9 @@
}

/// <summary>
/// Handles the Loaded event of the TableView control.
/// Handles the Loaded event of the ScrollViewer control.
/// </summary>
private void OnLoaded(object sender, RoutedEventArgs e)
private void OnScrollViewerLoaded(object sender, RoutedEventArgs e)
{
var scrollPresenter = _scrollViewer?.FindDescendant<ScrollContentPresenter>();
var xScrollBar = _scrollViewer?.FindDescendant<ScrollBar>(sb => sb.Name is "HorizontalScrollBar2");
Expand All @@ -316,7 +318,13 @@
Mode = BindingMode.TwoWay,
Source = this
});

}

/// <summary>
/// Handles the Loaded event of the TableView control.
/// </summary>
private void OnLoaded(object sender, RoutedEventArgs e)
{
EnsureAutoColumns();
}

Expand Down Expand Up @@ -588,7 +596,7 @@
}
else
{
foreach (var propertyInfo in dataType.GetProperties())

Check warning on line 599 in src/TableView.cs

View workflow job for this annotation

GitHub Actions / build

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties()'. The return value of method 'WinUI.TableView.Extensions.ObjectExtensions.GetItemType(IEnumerable)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
{
var displayAttribute = propertyInfo.GetCustomAttributes().OfType<DisplayAttribute>().FirstOrDefault();
var autoGenerateField = displayAttribute?.GetAutoGenerateField();
Expand Down Expand Up @@ -1514,4 +1522,4 @@
var offset = CellsHorizontalOffset + Columns.VisibleColumns.Where(c => c.IsFrozen).Sum(c => c.ActualWidth);
AttachedPropertiesHelper.SetFrozenColumnScrollBarSpace(_scrollViewer, offset);
}
}
}
Loading