Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
wpf
提交
4dda72bb
W
wpf
项目概览
dotNET Platform
/
wpf
大约 1 年 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wpf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4dda72bb
编写于
2月 07, 2022
作者:
A
Ashish Kumar Singh
提交者:
GitHub
2月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix hang when margin is not a multiple of DPI rounding quantum (#5841) (#6004)
Co-authored-by:
N
Sam Bent
<
sambent@microsoft.com
>
上级
9e130d78
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
18 deletion
+63
-18
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemsControl.cs
...entationFramework/System/Windows/Controls/ItemsControl.cs
+32
-0
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs
...amework/System/Windows/Controls/VirtualizingStackPanel.cs
+31
-18
未找到文件。
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemsControl.cs
浏览文件 @
4dda72bb
...
...
@@ -3079,6 +3079,38 @@ private bool IsOnCurrentPage(FrameworkElement viewPort, FrameworkElement element
return
ElementViewportPosition
.
None
;
}
// this version also returns the element's layout rectangle (in viewport's coordinates).
// VirtualizingStackPanel needs this, to determine the element's scroll offset.
internal
static
ElementViewportPosition
GetElementViewportPosition
(
FrameworkElement
viewPort
,
UIElement
element
,
FocusNavigationDirection
axis
,
bool
fullyVisible
,
bool
ignorePerpendicularAxis
,
out
Rect
elementRect
,
out
Rect
layoutRect
)
{
ElementViewportPosition
position
=
GetElementViewportPosition
(
viewPort
,
element
,
axis
,
fullyVisible
,
false
,
out
elementRect
);
if
(
position
==
ElementViewportPosition
.
None
)
{
layoutRect
=
Rect
.
Empty
;
}
else
{
Visual
parent
=
VisualTreeHelper
.
GetParent
(
element
)
as
Visual
;
Debug
.
Assert
(
element
!=
viewPort
&&
element
.
IsArrangeValid
&&
parent
!=
null
,
"GetElementViewportPosition called in unsupported situation"
);
layoutRect
=
CorrectCatastrophicCancellation
(
parent
.
TransformToAncestor
(
viewPort
)).
TransformBounds
(
element
.
PreviousArrangeRect
);
}
return
position
;
}
// in large virtualized hierarchical lists (TreeView or grouping), the transform
// returned by element.TransformToAncestor(viewport) is vulnerable to catastrophic
// cancellation. If element is at the top of the viewport, but embedded in
...
...
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs
浏览文件 @
4dda72bb
...
...
@@ -1189,6 +1189,7 @@ private void ClearAnchorInformation(bool shouldAbort)
if (fe.IsVisible)
{
Rect elementRect;
Rect layoutRect;
// get the vp-position of the element, ignoring the secondary axis
// (DevDiv2 1136036, 1203626 show two different cases why we
...
...
@@ -1201,7 +1202,8 @@ private void ClearAnchorInformation(bool shouldAbort)
direction,
false /*fullyVisible*/,
!isVSP45Compat /*ignorePerpendicularAxis*/,
out elementRect);
out elementRect,
out layoutRect);
if (elementPosition == ElementViewportPosition.PartiallyInViewport ||
elementPosition == ElementViewportPosition.CompletelyInViewport)
...
...
@@ -1287,20 +1289,35 @@ private void ClearAnchorInformation(bool shouldAbort)
{
if (direction == FocusNavigationDirection.Down)
{
firstContainerOffsetFromViewport = elementRect.Y;
if (!isVSP45Compat)
{
firstContainerOffsetFromViewport -= fe.Margin.Top;
}
}
if (isVSP45Compat)
{
firstContainerOffsetFromViewport = elementRect.Y;
}
else
{
// include the leading margin in the offset. Simply subtracting
// the margin doesn't work when layout rounding is in effect, as
// we can't deduce how rounding affected the arrangement of the
// element and its margin. Instead, just use the layout rect directly.
firstContainerOffsetFromViewport = layoutRect.Top;
}
}
else // (direction == FocusNavigationDirection.Right)
{
firstContainerOffsetFromViewport = elementRect.X;
if (!isVSP45Compat)
{
firstContainerOffsetFromViewport -= fe.Margin.Left;
}
}
if (isVSP45Compat)
{
firstContainerOffsetFromViewport = elementRect.X;
}
else
{
// include the leading margin in the offset. Simply subtracting
// the margin doesn't work when layout rounding is in effect, as
// we can't deduce how rounding affected the arrangement of the
// element and its margin. Instead, just use the layout rect directly.
firstContainerOffsetFromViewport = layoutRect.Left;
}
}
}
else if (findTopContainer && isTopContainer)
{
...
...
@@ -1931,7 +1948,7 @@ public ScrollViewer ScrollOwner
}
set
{
if (_scrollData == null)
EnsureScrollData();
EnsureScrollData();
if (value != _scrollData._scrollOwner)
{
ResetScrolling(this);
...
...
@@ -9510,10 +9527,6 @@ private int ItemCount
private void EnsureScrollData()
{
if (_scrollData == null) { _scrollData = new ScrollData(); }
else
{
Debug.Assert(_scrollData._scrollOwner != null, "Scrolling an unconnected VSP");
}
}
private static void ResetScrolling(VirtualizingStackPanel element)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录