Skip to content

Commit f59daa0

Browse files
authored
Merge pull request #1008 from lepoco/development
Sync development and bump version
2 parents 65e7bc6 + 95e8e20 commit f59daa0

24 files changed

+550
-230
lines changed

.github/labeler.yml

+38-21
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
1+
release:
2+
- base-branch: 'main'
3+
14
PR:
2-
- "*"
5+
- base-branch: [ 'main', 'development' ]
36

4-
dotnet:
5-
- '**/*.cs'
6-
77
github_actions:
8-
- ".github/workflows/*"
8+
- changed-files:
9+
- any-glob-to-any-file: '.github/workflows/**'
910

1011
documentation:
11-
- "docs/*"
12+
- changed-files:
13+
- any-glob-to-any-file: 'docs/**'
1214

13-
update:
14-
- "src/Directory.Build.props"
15+
dotnet:
16+
- changed-files:
17+
- any-glob-to-any-file: '**/*.cs'
1518

16-
dependencies:
17-
- "src/Packages.props"
18-
- "branding/package.json"
19-
- "src/Packages.props"
19+
update:
20+
- changed-files:
21+
- any-glob-to-any-file: 'src/Directory.Build.props'
2022

2123
NuGet:
22-
- "src/Packages.props"
24+
- changed-files:
25+
- any-glob-to-any-file: 'src/Directory.Packages.props'
26+
27+
dependencies:
28+
- changed-files:
29+
- any-glob-to-any-file: [ 'src/Directory.Packages.props', 'branding/package.json' ]
2330

2431
styles:
25-
- "src/Wpf.Ui/**/*.xaml"
32+
- changed-files:
33+
- any-glob-to-any-file: 'src/Wpf.Ui/**/*.xaml'
2634

2735
themes:
28-
- "src/Wpf.Ui/Appearance/*"
36+
- changed-files:
37+
- any-glob-to-any-file: 'src/Wpf.Ui/Appearance/**'
2938

3039
tray:
31-
- "src/Wpf.Ui.Tray/*"
40+
- changed-files:
41+
- any-glob-to-any-file: 'src/Wpf.Ui.Tray/**'
3242

3343
controls:
34-
- "src/Wpf.Ui/Controls/*"
35-
36-
icons:
37-
- "src/Wpf.Ui/Resources/Fonts/*"
44+
- changed-files:
45+
- any-glob-to-any-file: 'src/Wpf.Ui/Controls/**'
3846

3947
navigation:
40-
- "src/Wpf.Ui/Controls/NavigationView/*"
48+
- changed-files:
49+
- any-glob-to-any-file: 'src/Wpf.Ui/Controls/NavigationView/'
50+
51+
gallery:
52+
- changed-files:
53+
- any-glob-to-any-file: 'src/Wpf.Ui.Gallery/**'
54+
55+
icons:
56+
- changed-files:
57+
- any-glob-to-any-file: [ 'src/Wpf.Ui/Resources/Fonts/**', 'src/Wpf.Ui/Controls/IconSource/*', 'src/Wpf.Ui/Controls/IconElement/*' ]

.github/workflows/codeql-analysis.yml

-39
This file was deleted.

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4-
<Version>3.0.1</Version>
4+
<Version>3.0.2</Version>
55
<LangVersion>12.0</LangVersion>
66
<Deterministic>true</Deterministic>
77
</PropertyGroup>

src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public partial class MainWindowViewModel : ObservableObject
7272
{
7373
new NavigationViewItem(nameof(System.Windows.Controls.DataGrid), typeof(DataGridPage)),
7474
new NavigationViewItem(nameof(ListBox), typeof(ListBoxPage)),
75-
new NavigationViewItem(nameof(ListView), typeof(ListViewPage)),
75+
new NavigationViewItem(nameof(Ui.Controls.ListView), typeof(ListViewPage)),
7676
new NavigationViewItem(nameof(TreeView), typeof(TreeViewPage)),
7777
#if DEBUG
7878
new NavigationViewItem("TreeList", typeof(TreeListPage)),

src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml

+46-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Title="ListViewPage"
1313
d:DataContext="{d:DesignInstance local:ListViewPage,
1414
IsDesignTimeCreatable=False}"
15-
d:DesignHeight="450"
15+
d:DesignHeight="750"
1616
d:DesignWidth="800"
1717
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
1818
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
@@ -30,17 +30,18 @@
3030
\t&lt;/ListView.ItemTemplate&gt;\n
3131
&lt;/ListView&gt;
3232
</controls:ControlExample.XamlCode>
33-
<ListView
34-
Height="200"
33+
<ui:ListView
34+
MaxHeight="200"
35+
d:ItemsSource="{d:SampleData ItemCount=2}"
3536
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}"
3637
SelectedIndex="2"
3738
SelectionMode="Single">
38-
<ListView.ItemTemplate>
39+
<ui:ListView.ItemTemplate>
3940
<DataTemplate DataType="{x:Type models:Person}">
4041
<TextBlock Margin="8,4" Text="{Binding Name, Mode=OneWay}" />
4142
</DataTemplate>
42-
</ListView.ItemTemplate>
43-
</ListView>
43+
</ui:ListView.ItemTemplate>
44+
</ui:ListView>
4445
</controls:ControlExample>
4546

4647
<controls:ControlExample Margin="0,36,0,0" HeaderText="ListView with Selection Support.">
@@ -58,13 +59,14 @@
5859
<ColumnDefinition Width="*" />
5960
<ColumnDefinition Width="Auto" />
6061
</Grid.ColumnDefinitions>
61-
<ListView
62+
<ui:ListView
6263
Grid.Column="0"
63-
Height="200"
64+
MaxHeight="200"
65+
d:ItemsSource="{d:SampleData ItemCount=2}"
6466
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}"
6567
SelectedIndex="1"
6668
SelectionMode="{Binding ViewModel.ListViewSelectionMode, Mode=OneWay}">
67-
<ListView.ItemTemplate>
69+
<ui:ListView.ItemTemplate>
6870
<DataTemplate DataType="{x:Type models:Person}">
6971
<Grid Margin="8,0">
7072
<Grid.RowDefinitions>
@@ -98,8 +100,8 @@
98100
Text="{Binding Company, Mode=OneWay}" />
99101
</Grid>
100102
</DataTemplate>
101-
</ListView.ItemTemplate>
102-
</ListView>
103+
</ui:ListView.ItemTemplate>
104+
</ui:ListView>
103105
<StackPanel
104106
Grid.Column="1"
105107
MinWidth="120"
@@ -114,5 +116,38 @@
114116
</StackPanel>
115117
</Grid>
116118
</controls:ControlExample>
119+
120+
<controls:ControlExample Margin="0,36,0,0" HeaderText="ListView with GridView">
121+
<controls:ControlExample.XamlCode>
122+
&lt;ListView ItemsSource=&quot;{Binding ViewModel.BasicListViewItems}&quot;&gt;\n
123+
\t&lt;ListView.View&gt;\n
124+
\t\t&lt;GridView&gt;\n
125+
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding FirstName}&quot; Header=&quot;First Name&quot;/&gt;\n
126+
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding LastName}&quot; Header=&quot;Last Name&quot;/&gt;\n
127+
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding Company}&quot; Header=&quot;Company&quot;/&gt;\n
128+
\t\t&lt;/GridView&gt;\n
129+
\t&lt;/ListView.View&gt;\n
130+
&lt;/ListView&gt;
131+
</controls:ControlExample.XamlCode>
132+
<ui:ListView
133+
MaxHeight="200"
134+
d:ItemsSource="{d:SampleData ItemCount=3}"
135+
BorderThickness="0"
136+
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}">
137+
<ui:ListView.View>
138+
<GridView>
139+
<GridViewColumn
140+
Width="100"
141+
DisplayMemberBinding="{Binding FirstName}"
142+
Header="First Name" />
143+
<GridViewColumn
144+
Width="100"
145+
DisplayMemberBinding="{Binding LastName}"
146+
Header="Last Name" />
147+
<GridViewColumn DisplayMemberBinding="{Binding Company}" Header="Company" />
148+
</GridView>
149+
</ui:ListView.View>
150+
</ui:ListView>
151+
</controls:ControlExample>
117152
</StackPanel>
118153
</Page>

src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
controls:PageControlDocumentation.DocumentationType="{x:Type ui:TextBox}"
1212
d:DataContext="{d:DesignInstance local:TextBoxPage,
1313
IsDesignTimeCreatable=False}"
14-
d:DesignHeight="450"
14+
d:DesignHeight="750"
1515
d:DesignWidth="800"
1616
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
1717
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
@@ -34,7 +34,10 @@
3434
Margin="0,36,0,0"
3535
HeaderText="A multi-line TextBox."
3636
XamlCode="&lt;ui:TextBox PlaceholderText=&quot;Type something...&quot;TextWrapping=&quot;Wrap&quot; /&gt;">
37-
<ui:TextBox PlaceholderText="Type something..." TextWrapping="Wrap" />
37+
<ui:TextBox
38+
MinHeight="100"
39+
PlaceholderText="Type something..."
40+
TextWrapping="Wrap" />
3841
</controls:ControlExample>
3942
</StackPanel>
4043
</Page>

src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<PropertyGroup>
2323
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
2424
<GenerateDocumentationFile Condition="'$(Configuration)'=='Release'">true</GenerateDocumentationFile>
25-
<DebugType Condition="'$(Configuration)'=='Release'">none</DebugType>
2625
<PackageIcon>wpfui.png</PackageIcon>
2726
</PropertyGroup>
2827

src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
BorderThickness="1"
145145
CornerRadius="8"
146146
SnapsToDevicePixels="True">
147-
<ListView
147+
<controls:ListView
148148
x:Name="PART_SuggestionsList"
149149
MaxHeight="{TemplateBinding MaxSuggestionListHeight}"
150150
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
@@ -154,15 +154,15 @@
154154
ItemsSource="{TemplateBinding ItemsSource}"
155155
KeyboardNavigation.DirectionalNavigation="Cycle"
156156
SelectionMode="Single">
157-
<ListView.ItemsPanel>
157+
<controls:ListView.ItemsPanel>
158158
<ItemsPanelTemplate>
159159
<VirtualizingStackPanel
160160
IsItemsHost="True"
161161
IsVirtualizing="True"
162162
VirtualizationMode="Recycling" />
163163
</ItemsPanelTemplate>
164-
</ListView.ItemsPanel>
165-
</ListView>
164+
</controls:ListView.ItemsPanel>
165+
</controls:ListView>
166166
</Border>
167167
</Popup>
168168
</Grid>

src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@
4444
<Setter Property="Template">
4545
<Setter.Value>
4646
<ControlTemplate TargetType="{x:Type TextBox}">
47-
<Decorator
47+
<controls:PassiveScrollViewer
4848
x:Name="PART_ContentHost"
49-
Margin="{TemplateBinding Padding}"
50-
HorizontalAlignment="Stretch"
5149
VerticalAlignment="Stretch"
50+
HorizontalAlignment="Stretch"
51+
Margin="{TemplateBinding Padding}"
52+
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
5253
TextElement.Foreground="{TemplateBinding Foreground}" />
5354
</ControlTemplate>
5455
</Setter.Value>
+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
namespace Wpf.Ui.Controls;
2+
3+
/// <summary>
4+
/// Extends <see cref="System.Windows.Controls.ListView"/>, and adds customized support <see cref="ListViewViewState.GridView"/> or <see cref="ListViewViewState.Default"/>.
5+
/// </summary>
6+
/// <example>
7+
/// <code lang="xml">
8+
/// &lt;ui:ListView ItemsSource="{Binding ...}" &gt;
9+
/// &lt;ui:ListView.View&gt;
10+
/// &lt;GridView&gt;
11+
/// &lt;GridViewColumn
12+
/// DisplayMemberBinding="{Binding FirstName}"
13+
/// Header="First Name" /&gt;
14+
/// &lt;GridViewColumn
15+
/// DisplayMemberBinding="{Binding LastName}"
16+
/// Header="Last Name" /&gt;
17+
/// &lt;/GridView&gt;
18+
/// &lt;/ui:ListView.View&gt;
19+
/// &lt;/ui:ListView&gt;
20+
/// </code>
21+
/// </example>
22+
public class ListView : System.Windows.Controls.ListView
23+
{
24+
/// <summary>Identifies the <see cref="ViewState"/> dependency property.</summary>
25+
public static readonly DependencyProperty ViewStateProperty = DependencyProperty.Register(nameof(ViewState), typeof(ListViewViewState), typeof(ListView), new FrameworkPropertyMetadata(ListViewViewState.Default, OnViewStateChanged));
26+
27+
/// <summary>
28+
/// Gets or sets the view state of the <see cref="ListView"/>, enabling custom logic based on the current view.
29+
/// </summary>
30+
/// <value>The current view state of the <see cref="ListView"/>.</value>
31+
public ListViewViewState ViewState
32+
{
33+
get => (ListViewViewState)GetValue(ViewStateProperty);
34+
set => SetValue(ViewStateProperty, value);
35+
}
36+
37+
private static void OnViewStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
38+
{
39+
if (d is not ListView self)
40+
{
41+
return;
42+
}
43+
44+
self.OnViewStateChanged(e);
45+
}
46+
47+
protected virtual void OnViewStateChanged(DependencyPropertyChangedEventArgs e)
48+
{
49+
// Hook for derived classes to react to ViewState property changes
50+
}
51+
52+
public ListView()
53+
{
54+
Loaded += OnLoaded;
55+
}
56+
57+
private void OnLoaded(object sender, RoutedEventArgs e)
58+
{
59+
Loaded -= OnLoaded; // prevent memory leaks
60+
61+
// Setup initial ViewState and hook into View property changes
62+
var descriptor = DependencyPropertyDescriptor.FromProperty(System.Windows.Controls.ListView.ViewProperty, typeof(System.Windows.Controls.ListView));
63+
descriptor?.AddValueChanged(this, OnViewPropertyChanged);
64+
UpdateViewState(); // set the initial state
65+
}
66+
67+
private void OnViewPropertyChanged(object? sender, EventArgs e)
68+
{
69+
UpdateViewState();
70+
}
71+
72+
private void UpdateViewState()
73+
{
74+
ListViewViewState viewState = View switch
75+
{
76+
System.Windows.Controls.GridView => ListViewViewState.GridView,
77+
null => ListViewViewState.Default,
78+
_ => ListViewViewState.Default
79+
};
80+
81+
SetCurrentValue(ViewStateProperty, viewState);
82+
}
83+
84+
static ListView()
85+
{
86+
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListView), new FrameworkPropertyMetadata(typeof(ListView)));
87+
}
88+
}

0 commit comments

Comments
 (0)