Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
7099d04a
U
Uno
项目概览
lindexi_gd
/
Uno
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7099d04a
编写于
6月 02, 2023
作者:
J
Jérôme Laban
提交者:
GitHub
6月 02, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12359 from unoplatform/dev/mazi/singleselectionfocus
feat: Support for `SingleSelectionFollowsFocus`
上级
219e379a
58e37a62
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
103 addition
and
3 deletion
+103
-3
src/SamplesApp/UITests.Shared/UITests.Shared.projitems
src/SamplesApp/UITests.Shared/UITests.Shared.projitems
+7
-0
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_SingleSelection_Focus.xaml
...aml_Controls/ListView/ListView_SingleSelection_Focus.xaml
+34
-0
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_SingleSelection_Focus.xaml.cs
..._Controls/ListView/ListView_SingleSelection_Focus.xaml.cs
+32
-0
src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/ListViewBase.cs
...enerated/3.0.0.0/Windows.UI.Xaml.Controls/ListViewBase.cs
+2
-2
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.Properties.cs
.../UI/Xaml/Controls/ListViewBase/ListViewBase.Properties.cs
+25
-0
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.cs
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.cs
+3
-1
未找到文件。
src/SamplesApp/UITests.Shared/UITests.Shared.projitems
浏览文件 @
7099d04a
...
...
@@ -1970,6 +1970,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_SingleSelection_Focus.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_Resizing.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
...
...
@@ -6426,6 +6430,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_Focus.xaml.cs">
<DependentUpon>ListView_Focus.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_SingleSelection_Focus.xaml.cs">
<DependentUpon>ListView_SingleSelection_Focus.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_Resizing.xaml.cs">
<DependentUpon>ListView_Resizing.xaml</DependentUpon>
</Compile>
...
...
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_SingleSelection_Focus.xaml
0 → 100644
浏览文件 @
7099d04a
<UserControl
x:Class="UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_SingleSelection_Focus"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:UITests.Shared.Windows_UI_Xaml_Controls.ListView"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<StackPanel Spacing="8">
<TextBlock FontWeight="Bold" Text="SingleSelectionFollowsFocus = true" />
<ListView
x:Name="ListView1"
Width="100"
Height="200"
BorderBrush="Black"
BorderThickness="1"
SelectionMode="Single"
SingleSelectionFollowsFocus="True" />
<TextBlock Text="{x:Bind ListView1.SelectedItem, Mode=OneWay}" />
<TextBlock FontWeight="Bold" Text="SingleSelectionFollowsFocus = false" />
<ListView
x:Name="ListView2"
Width="100"
Height="200"
BorderBrush="Black"
BorderThickness="1"
SelectionMode="Single"
SingleSelectionFollowsFocus="False" />
<TextBlock Text="{x:Bind ListView2.SelectedItem, Mode=OneWay}" />
</StackPanel>
</UserControl>
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_SingleSelection_Focus.xaml.cs
0 → 100644
浏览文件 @
7099d04a
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Runtime.InteropServices.WindowsRuntime
;
using
Uno.UI.Samples.Controls
;
using
Uno.UI.Samples.UITests.Helpers
;
using
Windows.Foundation
;
using
Windows.Foundation.Collections
;
using
Windows.UI.Xaml
;
using
Windows.UI.Xaml.Controls
;
using
Windows.UI.Xaml.Controls.Primitives
;
using
Windows.UI.Xaml.Data
;
using
Windows.UI.Xaml.Input
;
using
Windows.UI.Xaml.Media
;
using
Windows.UI.Xaml.Navigation
;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace
UITests.Shared.Windows_UI_Xaml_Controls.ListView
{
[
Sample
(
"ListView"
,
IsManualTest
=
true
,
IgnoreInSnapshotTests
=
true
)]
public
sealed
partial
class
ListView_SingleSelection_Focus
:
UserControl
{
public
ListView_SingleSelection_Focus
()
{
this
.
InitializeComponent
();
ListView1
.
ItemsSource
=
Enumerable
.
Range
(
0
,
30
).
Select
(
i
=>
i
.
ToString
()).
ToArray
();
ListView2
.
ItemsSource
=
Enumerable
.
Range
(
0
,
30
).
Select
(
i
=>
i
.
ToString
()).
ToArray
();
}
}
}
src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/ListViewBase.cs
浏览文件 @
7099d04a
...
...
@@ -113,7 +113,7 @@ namespace Windows.UI.Xaml.Controls
}
}
#
endif
#
if
__ANDROID__
||
__IOS__
||
NET461
||
__WASM__
||
__SKIA__
||
__NETSTD_REFERENCE__
||
__MACOS__
#
if
false
[
global
::
Uno
.
NotImplemented
(
"__ANDROID__"
,
"__IOS__"
,
"NET461"
,
"__WASM__"
,
"__SKIA__"
,
"__NETSTD_REFERENCE__"
,
"__MACOS__"
)]
public
bool
SingleSelectionFollowsFocus
{
...
...
@@ -252,7 +252,7 @@ namespace Windows.UI.Xaml.Controls
typeof
(
global
::
Windows
.
UI
.
Xaml
.
Controls
.
ListViewBase
),
new
Windows
.
UI
.
Xaml
.
FrameworkPropertyMetadata
(
default
(
bool
)));
#
endif
#
if
__ANDROID__
||
__IOS__
||
NET461
||
__WASM__
||
__SKIA__
||
__NETSTD_REFERENCE__
||
__MACOS__
#
if
false
[
global
::
Uno
.
NotImplemented
(
"__ANDROID__"
,
"__IOS__"
,
"NET461"
,
"__WASM__"
,
"__SKIA__"
,
"__NETSTD_REFERENCE__"
,
"__MACOS__"
)]
public
static
global
::
Windows
.
UI
.
Xaml
.
DependencyProperty
SingleSelectionFollowsFocusProperty
{
get
;
}
=
Windows
.
UI
.
Xaml
.
DependencyProperty
.
Register
(
...
...
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.Properties.cs
0 → 100644
浏览文件 @
7099d04a
using
Windows.UI.Xaml
;
namespace
Windows.UI.Xaml.Controls
;
public
partial
class
ListViewBase
{
/// <summary>
/// Gets or sets a value that indicates whether item selection changes when keyboard focus changes.
/// </summary>
public
bool
SingleSelectionFollowsFocus
{
get
=>
(
bool
)
GetValue
(
SingleSelectionFollowsFocusProperty
);
set
=>
SetValue
(
SingleSelectionFollowsFocusProperty
,
value
);
}
/// <summary>
/// Identifies the SingleSelectionFollowsFocus dependency property.
/// </summary>
public
static
DependencyProperty
SingleSelectionFollowsFocusProperty
{
get
;
}
=
DependencyProperty
.
Register
(
nameof
(
SingleSelectionFollowsFocus
),
typeof
(
bool
),
typeof
(
ListViewBase
),
new
FrameworkPropertyMetadata
(
true
));
}
src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.cs
浏览文件 @
7099d04a
...
...
@@ -29,6 +29,7 @@ using Windows.Foundation;
using
Uno.UI
;
using
Windows.UI.Xaml.Input
;
using
Windows.System
;
using
Uno.UI.Xaml.Input
;
namespace
Windows.UI.Xaml.Controls
{
...
...
@@ -130,7 +131,8 @@ namespace Windows.UI.Xaml.Controls
}
// If selection mode is single, moving focus also selects the item
if
(
SelectionMode
==
ListViewSelectionMode
.
Single
)
if
(
SelectionMode
==
ListViewSelectionMode
.
Single
&&
SingleSelectionFollowsFocus
)
{
SelectedIndex
=
index
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录