diff --git a/.github/labeler.yml b/.github/labeler.yml index 1516e2e58..cb16e8682 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -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/*' ] diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 884f651c4..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - branches: [ development ] - -jobs: - analyze: - name: Analyze - runs-on: windows-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: microsoft/setup-msbuild@v1.3 - with: - msbuild-architecture: x64 - - - name: Setup .NET Core SDK 8.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build src\Wpf.Ui.Gallery\Wpf.Ui.Gallery.csproj --configuration Release --no-restore - - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: "csharp" - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/Directory.Build.props b/Directory.Build.props index a09c48302..2f9b63d5b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 3.0.1 + 3.0.2 12.0 true diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs index 7e96e95c5..43531e71d 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs @@ -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)), diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml index 345d4b568..35cdf639c 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml @@ -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}" @@ -30,17 +30,18 @@ \t</ListView.ItemTemplate>\n </ListView> - - + - - + + @@ -58,13 +59,14 @@ - - + @@ -98,8 +100,8 @@ Text="{Binding Company, Mode=OneWay}" /> - - + + + + + + <ListView ItemsSource="{Binding ViewModel.BasicListViewItems}">\n + \t<ListView.View>\n + \t\t<GridView>\n + \t\t\t<GridViewColumn DisplayMemberBinding="{Binding FirstName}" Header="First Name"/>\n + \t\t\t<GridViewColumn DisplayMemberBinding="{Binding LastName}" Header="Last Name"/>\n + \t\t\t<GridViewColumn DisplayMemberBinding="{Binding Company}" Header="Company"/>\n + \t\t</GridView>\n + \t</ListView.View>\n + </ListView> + + + + + + + + + + + diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml index 0ff6b51ce..0a4774c7d 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextBoxPage.xaml @@ -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}" @@ -34,7 +34,10 @@ Margin="0,36,0,0" HeaderText="A multi-line TextBox." XamlCode="<ui:TextBox PlaceholderText="Type something..."TextWrapping="Wrap" />"> - + diff --git a/src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj b/src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj index c155e8ab8..ac77b6eb5 100644 --- a/src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj +++ b/src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj @@ -22,7 +22,6 @@ true true - none wpfui.png diff --git a/src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml b/src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml index d6c8aa11a..389daa086 100644 --- a/src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml +++ b/src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.xaml @@ -144,7 +144,7 @@ BorderThickness="1" CornerRadius="8" SnapsToDevicePixels="True"> - - + - - + + diff --git a/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml b/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml index 2e8e596c6..c33cebc9b 100644 --- a/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml +++ b/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml @@ -44,11 +44,12 @@ - diff --git a/src/Wpf.Ui/Controls/ListView/ListView.cs b/src/Wpf.Ui/Controls/ListView/ListView.cs new file mode 100644 index 000000000..8520cd916 --- /dev/null +++ b/src/Wpf.Ui/Controls/ListView/ListView.cs @@ -0,0 +1,88 @@ +namespace Wpf.Ui.Controls; + +/// +/// Extends , and adds customized support or . +/// +/// +/// +/// <ui:ListView ItemsSource="{Binding ...}" > +/// <ui:ListView.View> +/// <GridView> +/// <GridViewColumn +/// DisplayMemberBinding="{Binding FirstName}" +/// Header="First Name" /> +/// <GridViewColumn +/// DisplayMemberBinding="{Binding LastName}" +/// Header="Last Name" /> +/// </GridView> +/// </ui:ListView.View> +/// </ui:ListView> +/// +/// +public class ListView : System.Windows.Controls.ListView +{ + /// Identifies the dependency property. + public static readonly DependencyProperty ViewStateProperty = DependencyProperty.Register(nameof(ViewState), typeof(ListViewViewState), typeof(ListView), new FrameworkPropertyMetadata(ListViewViewState.Default, OnViewStateChanged)); + + /// + /// Gets or sets the view state of the , enabling custom logic based on the current view. + /// + /// The current view state of the . + 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))); + } +} diff --git a/src/Wpf.Ui/Controls/ListView/ListView.xaml b/src/Wpf.Ui/Controls/ListView/ListView.xaml index bef8c8cb2..1af21cff0 100644 --- a/src/Wpf.Ui/Controls/ListView/ListView.xaml +++ b/src/Wpf.Ui/Controls/ListView/ListView.xaml @@ -10,10 +10,154 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:Wpf.Ui.Controls"> - + + + + + + + + + + + + + + + - - - + + \ No newline at end of file diff --git a/src/Wpf.Ui/Resources/Theme/Dark.xaml b/src/Wpf.Ui/Resources/Theme/Dark.xaml index b2f609801..5a8200d85 100644 --- a/src/Wpf.Ui/Resources/Theme/Dark.xaml +++ b/src/Wpf.Ui/Resources/Theme/Dark.xaml @@ -267,13 +267,10 @@ - - - - + - - + + diff --git a/src/Wpf.Ui/Resources/Theme/Light.xaml b/src/Wpf.Ui/Resources/Theme/Light.xaml index cf93807bb..a8288560c 100644 --- a/src/Wpf.Ui/Resources/Theme/Light.xaml +++ b/src/Wpf.Ui/Resources/Theme/Light.xaml @@ -268,13 +268,10 @@ - - - - + - - + + diff --git a/src/Wpf.Ui/Resources/Wpf.Ui.xaml b/src/Wpf.Ui/Resources/Wpf.Ui.xaml index d46cbda1e..27b33731a 100644 --- a/src/Wpf.Ui/Resources/Wpf.Ui.xaml +++ b/src/Wpf.Ui/Resources/Wpf.Ui.xaml @@ -14,6 +14,7 @@ + diff --git a/src/Wpf.Ui/VisualStudioToolsManifest.xml b/src/Wpf.Ui/VisualStudioToolsManifest.xml index ed61cc8c5..7444460fc 100644 --- a/src/Wpf.Ui/VisualStudioToolsManifest.xml +++ b/src/Wpf.Ui/VisualStudioToolsManifest.xml @@ -27,6 +27,7 @@ + diff --git a/src/Wpf.Ui/Wpf.Ui.csproj b/src/Wpf.Ui/Wpf.Ui.csproj index 1be76df5e..daa62b116 100644 --- a/src/Wpf.Ui/Wpf.Ui.csproj +++ b/src/Wpf.Ui/Wpf.Ui.csproj @@ -20,7 +20,6 @@ true true - none wpfui.png @@ -118,4 +117,4 @@ - \ No newline at end of file +