Skip to content

Commit

Permalink
Merge pull request #1008 from lepoco/development
Browse files Browse the repository at this point in the history
Sync development and bump version
  • Loading branch information
pomianowski committed Mar 19, 2024
2 parents 65e7bc6 + 95e8e20 commit f59daa0
Show file tree
Hide file tree
Showing 24 changed files with 550 additions and 230 deletions.
59 changes: 38 additions & 21 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,57 @@
release:
- base-branch: 'main'

PR:
- "*"
- base-branch: [ 'main', 'development' ]

dotnet:
- '**/*.cs'

github_actions:
- ".github/workflows/*"
- changed-files:
- any-glob-to-any-file: '.github/workflows/**'

documentation:
- "docs/*"
- changed-files:
- any-glob-to-any-file: 'docs/**'

update:
- "src/Directory.Build.props"
dotnet:
- changed-files:
- any-glob-to-any-file: '**/*.cs'

dependencies:
- "src/Packages.props"
- "branding/package.json"
- "src/Packages.props"
update:
- changed-files:
- any-glob-to-any-file: 'src/Directory.Build.props'

NuGet:
- "src/Packages.props"
- changed-files:
- any-glob-to-any-file: 'src/Directory.Packages.props'

dependencies:
- changed-files:
- any-glob-to-any-file: [ 'src/Directory.Packages.props', 'branding/package.json' ]

styles:
- "src/Wpf.Ui/**/*.xaml"
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui/**/*.xaml'

themes:
- "src/Wpf.Ui/Appearance/*"
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui/Appearance/**'

tray:
- "src/Wpf.Ui.Tray/*"
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui.Tray/**'

controls:
- "src/Wpf.Ui/Controls/*"

icons:
- "src/Wpf.Ui/Resources/Fonts/*"
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui/Controls/**'

navigation:
- "src/Wpf.Ui/Controls/NavigationView/*"
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui/Controls/NavigationView/'

gallery:
- changed-files:
- any-glob-to-any-file: 'src/Wpf.Ui.Gallery/**'

icons:
- changed-files:
- any-glob-to-any-file: [ 'src/Wpf.Ui/Resources/Fonts/**', 'src/Wpf.Ui/Controls/IconSource/*', 'src/Wpf.Ui/Controls/IconElement/*' ]
39 changes: 0 additions & 39 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.1</Version>
<Version>3.0.2</Version>
<LangVersion>12.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public partial class MainWindowViewModel : ObservableObject
{
new NavigationViewItem(nameof(System.Windows.Controls.DataGrid), typeof(DataGridPage)),
new NavigationViewItem(nameof(ListBox), typeof(ListBoxPage)),
new NavigationViewItem(nameof(ListView), typeof(ListViewPage)),
new NavigationViewItem(nameof(Ui.Controls.ListView), typeof(ListViewPage)),
new NavigationViewItem(nameof(TreeView), typeof(TreeViewPage)),
#if DEBUG
new NavigationViewItem("TreeList", typeof(TreeListPage)),
Expand Down
57 changes: 46 additions & 11 deletions src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Title="ListViewPage"
d:DataContext="{d:DesignInstance local:ListViewPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="450"
d:DesignHeight="750"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Expand All @@ -30,17 +30,18 @@
\t&lt;/ListView.ItemTemplate&gt;\n
&lt;/ListView&gt;
</controls:ControlExample.XamlCode>
<ListView
Height="200"
<ui:ListView
MaxHeight="200"
d:ItemsSource="{d:SampleData ItemCount=2}"
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}"
SelectedIndex="2"
SelectionMode="Single">
<ListView.ItemTemplate>
<ui:ListView.ItemTemplate>
<DataTemplate DataType="{x:Type models:Person}">
<TextBlock Margin="8,4" Text="{Binding Name, Mode=OneWay}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ui:ListView.ItemTemplate>
</ui:ListView>
</controls:ControlExample>

<controls:ControlExample Margin="0,36,0,0" HeaderText="ListView with Selection Support.">
Expand All @@ -58,13 +59,14 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ListView
<ui:ListView
Grid.Column="0"
Height="200"
MaxHeight="200"
d:ItemsSource="{d:SampleData ItemCount=2}"
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}"
SelectedIndex="1"
SelectionMode="{Binding ViewModel.ListViewSelectionMode, Mode=OneWay}">
<ListView.ItemTemplate>
<ui:ListView.ItemTemplate>
<DataTemplate DataType="{x:Type models:Person}">
<Grid Margin="8,0">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -98,8 +100,8 @@
Text="{Binding Company, Mode=OneWay}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ui:ListView.ItemTemplate>
</ui:ListView>
<StackPanel
Grid.Column="1"
MinWidth="120"
Expand All @@ -114,5 +116,38 @@
</StackPanel>
</Grid>
</controls:ControlExample>

<controls:ControlExample Margin="0,36,0,0" HeaderText="ListView with GridView">
<controls:ControlExample.XamlCode>
&lt;ListView ItemsSource=&quot;{Binding ViewModel.BasicListViewItems}&quot;&gt;\n
\t&lt;ListView.View&gt;\n
\t\t&lt;GridView&gt;\n
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding FirstName}&quot; Header=&quot;First Name&quot;/&gt;\n
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding LastName}&quot; Header=&quot;Last Name&quot;/&gt;\n
\t\t\t&lt;GridViewColumn DisplayMemberBinding=&quot;{Binding Company}&quot; Header=&quot;Company&quot;/&gt;\n
\t\t&lt;/GridView&gt;\n
\t&lt;/ListView.View&gt;\n
&lt;/ListView&gt;
</controls:ControlExample.XamlCode>
<ui:ListView
MaxHeight="200"
d:ItemsSource="{d:SampleData ItemCount=3}"
BorderThickness="0"
ItemsSource="{Binding ViewModel.BasicListViewItems, Mode=TwoWay}">
<ui:ListView.View>
<GridView>
<GridViewColumn
Width="100"
DisplayMemberBinding="{Binding FirstName}"
Header="First Name" />
<GridViewColumn
Width="100"
DisplayMemberBinding="{Binding LastName}"
Header="Last Name" />
<GridViewColumn DisplayMemberBinding="{Binding Company}" Header="Company" />
</GridView>
</ui:ListView.View>
</ui:ListView>
</controls:ControlExample>
</StackPanel>
</Page>
7 changes: 5 additions & 2 deletions src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
controls:PageControlDocumentation.DocumentationType="{x:Type ui:TextBox}"
d:DataContext="{d:DesignInstance local:TextBoxPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="450"
d:DesignHeight="750"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Expand All @@ -34,7 +34,10 @@
Margin="0,36,0,0"
HeaderText="A multi-line TextBox."
XamlCode="&lt;ui:TextBox PlaceholderText=&quot;Type something...&quot;TextWrapping=&quot;Wrap&quot; /&gt;">
<ui:TextBox PlaceholderText="Type something..." TextWrapping="Wrap" />
<ui:TextBox
MinHeight="100"
PlaceholderText="Type something..."
TextWrapping="Wrap" />
</controls:ControlExample>
</StackPanel>
</Page>
1 change: 0 additions & 1 deletion src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<PropertyGroup>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<GenerateDocumentationFile Condition="'$(Configuration)'=='Release'">true</GenerateDocumentationFile>
<DebugType Condition="'$(Configuration)'=='Release'">none</DebugType>
<PackageIcon>wpfui.png</PackageIcon>
</PropertyGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
BorderThickness="1"
CornerRadius="8"
SnapsToDevicePixels="True">
<ListView
<controls:ListView
x:Name="PART_SuggestionsList"
MaxHeight="{TemplateBinding MaxSuggestionListHeight}"
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
Expand All @@ -154,15 +154,15 @@
ItemsSource="{TemplateBinding ItemsSource}"
KeyboardNavigation.DirectionalNavigation="Cycle"
SelectionMode="Single">
<ListView.ItemsPanel>
<controls:ListView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel
IsItemsHost="True"
IsVirtualizing="True"
VirtualizationMode="Recycling" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
</controls:ListView.ItemsPanel>
</controls:ListView>
</Border>
</Popup>
</Grid>
Expand Down
7 changes: 4 additions & 3 deletions src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Decorator
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="{TemplateBinding Padding}"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter.Value>
Expand Down
88 changes: 88 additions & 0 deletions src/Wpf.Ui/Controls/ListView/ListView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
namespace Wpf.Ui.Controls;

/// <summary>
/// Extends <see cref="System.Windows.Controls.ListView"/>, and adds customized support <see cref="ListViewViewState.GridView"/> or <see cref="ListViewViewState.Default"/>.
/// </summary>
/// <example>
/// <code lang="xml">
/// &lt;ui:ListView ItemsSource="{Binding ...}" &gt;
/// &lt;ui:ListView.View&gt;
/// &lt;GridView&gt;
/// &lt;GridViewColumn
/// DisplayMemberBinding="{Binding FirstName}"
/// Header="First Name" /&gt;
/// &lt;GridViewColumn
/// DisplayMemberBinding="{Binding LastName}"
/// Header="Last Name" /&gt;
/// &lt;/GridView&gt;
/// &lt;/ui:ListView.View&gt;
/// &lt;/ui:ListView&gt;
/// </code>
/// </example>
public class ListView : System.Windows.Controls.ListView
{
/// <summary>Identifies the <see cref="ViewState"/> dependency property.</summary>
public static readonly DependencyProperty ViewStateProperty = DependencyProperty.Register(nameof(ViewState), typeof(ListViewViewState), typeof(ListView), new FrameworkPropertyMetadata(ListViewViewState.Default, OnViewStateChanged));

/// <summary>
/// Gets or sets the view state of the <see cref="ListView"/>, enabling custom logic based on the current view.
/// </summary>
/// <value>The current view state of the <see cref="ListView"/>.</value>
public ListViewViewState ViewState
{
get => (ListViewViewState)GetValue(ViewStateProperty);
set => SetValue(ViewStateProperty, value);
}

private static void OnViewStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not ListView self)
{
return;
}

self.OnViewStateChanged(e);
}

protected virtual void OnViewStateChanged(DependencyPropertyChangedEventArgs e)
{
// Hook for derived classes to react to ViewState property changes
}

public ListView()
{
Loaded += OnLoaded;
}

private void OnLoaded(object sender, RoutedEventArgs e)
{
Loaded -= OnLoaded; // prevent memory leaks

// Setup initial ViewState and hook into View property changes
var descriptor = DependencyPropertyDescriptor.FromProperty(System.Windows.Controls.ListView.ViewProperty, typeof(System.Windows.Controls.ListView));
descriptor?.AddValueChanged(this, OnViewPropertyChanged);
UpdateViewState(); // set the initial state
}

private void OnViewPropertyChanged(object? sender, EventArgs e)
{
UpdateViewState();
}

private void UpdateViewState()
{
ListViewViewState viewState = View switch
{
System.Windows.Controls.GridView => ListViewViewState.GridView,
null => ListViewViewState.Default,
_ => ListViewViewState.Default
};

SetCurrentValue(ViewStateProperty, viewState);
}

static ListView()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListView), new FrameworkPropertyMetadata(typeof(ListView)));
}
}

0 comments on commit f59daa0

Please sign in to comment.