Skip to content

Commit

Permalink
#964 修复视频详情页滚动到当前项错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Jan 7, 2025
1 parent d2616a6 commit f83ffa2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Controls/VideoListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Grid
x:Name="VideoListItemGrid"
ToolTipService.ToolTip="{x:Bind Title}"
Height="87"
ContextRequested="UIElement_OnContextRequested"
ContextFlyout="{StaticResource VideoItemFlyout}" >
<Grid.ColumnDefinitions>
Expand Down
6 changes: 3 additions & 3 deletions src/BiliLite.UWP/Controls/VideoListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using BiliLite.Models.Common.Video;
using BiliLite.Services.Biz;
using BiliLite.ViewModels.Video;
using Microsoft.Toolkit.Uwp.UI.Controls;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板

Expand Down Expand Up @@ -108,7 +107,7 @@ private void ScrollToItem(VideoListItem item)
private double GetItemOffsetHeight(VideoListItem item)
{
var offset = 0d;
var expanders = this.FindChildrenByType<Expander>().ToList();
var expanders = this.FindChildrenByType<Microsoft.UI.Xaml.Controls.Expander>().ToList();
if (!expanders.Any()) return 0;
var expanderHeaderHeight = (expanders.First().Header as FrameworkElement).ActualHeight;
var videoListItemGridHeight = 87;
Expand All @@ -133,11 +132,12 @@ private double GetItemOffsetHeight(VideoListItem item)

foreach (var videoItem in section.Items)
{
offset += videoListItemGridHeight;
if (videoItem == item)
{
return offset;
}

offset += videoListItemGridHeight;
}
}
}
Expand Down

0 comments on commit f83ffa2

Please sign in to comment.