diff --git a/.github/workflows/azure-static-web-app.yml b/.github/workflows/azure-static-web-app.yml deleted file mode 100644 index 597e2914..00000000 --- a/.github/workflows/azure-static-web-app.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Azure Static Web Apps CI/CD - -on: - push: - branches: - - main - -jobs: - build_and_deploy_job: - env: - DIST_PATH: samples/WinUI.TableView.SampleApp.Uno/bin/Release/net10.0-browserwasm/publish/wwwroot - DotnetVersion: '10.0.100' - runs-on: ubuntu-latest - container: 'unoplatform/wasm-build:3.0' - name: Build and Deploy Job - steps: - - uses: actions/checkout@v3 - with: - submodules: true - lfs: false - - # When running on macos, set the DOTNET_INSTALL_DIR so a workspace local folder - # is used to install the SDK. This is required for the Uno.Sdk.Updater to work - - name: Set DOTNET_INSTALL_DIR - if: runner.os == 'macos' || runner.os == 'linux' - shell: bash - run: echo "DOTNET_INSTALL_DIR=$GITHUB_WORKSPACE/.dotnet" >> $GITHUB_ENV - - - name: 'Set Wasm cache path' - shell: pwsh - run: echo "WasmCachePath=${{ github.workspace }}/.emscripten-cache" >> $env:GITHUB_ENV - - - name: Cache EMSDK - id: cache-emsdk - uses: actions/cache@v4 - env: - cache-name: cache-emsdk-modules - with: - path: ${{ env.WasmCachePath }} - key: ${{ runner.os }}-build-emsdk-${{ env.ValidationUnoCheckVersion }} - restore-keys: | - ${{ runner.os }}-build-emsdk-${{ env.ValidationUnoCheckVersion }} - - - name: Cache .NET - id: cache-dotnet - uses: actions/cache@v4 - env: - cache-name: cache-dotnet-install - with: - path: ${{ github.workspace }}/.dotnet - key: ${{ runner.os }}-build-dotnet-${{ env.DotnetVersion }} - restore-keys: | - ${{ runner.os }}-build-dotnet-${{ env.DotnetVersion }} - - - name: Setup .NET - uses: actions/setup-dotnet@v1.7.2 - with: - dotnet-version: ${{ env.DotnetVersion }} - - - uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 - id: nbgv - with: - toolVersion: 3.6.139 - setAllVars: true - - - run: | - cd samples/WinUI.TableView.SampleApp.Uno - dotnet workload restore - name: Setup Workloads - - - run: | - cd samples/WinUI.TableView.SampleApp.Uno - dotnet workload install wasm-tools - name: Setup Workloads - - - run: | - cd samples/WinUI.TableView.SampleApp.Uno - dotnet publish -c Release -f net10.0-browserwasm "/p:PackageVersion=${{ steps.nbgv.outputs.SemVer2 }}" /p:EnableWindowsTargeting=true /bl:../binlogs/output.binlog - name: Build Uno Wasm App - - - uses: actions/upload-artifact@v4 - with: - name: wasm-site - path: ${{ env.DIST_PATH }} - - - uses: actions/upload-artifact@v4 - with: - name: logs - path: binlogs - - - name: Build And Deploy - id: builddeploy - continue-on-error: true - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LIVELY_GROUND_0D0F6A810 }} - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: "upload" - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: "${{ env.DIST_PATH }}" # App source code path - api_location: "" # Api source code path - optional - output_location: "" # Built app content directory - optional - ###### End of Repository/Build Configurations ###### diff --git a/.github/workflows/ci-build-samples.yml b/.github/workflows/ci-build-samples.yml index 42f68b4d..74651124 100644 --- a/.github/workflows/ci-build-samples.yml +++ b/.github/workflows/ci-build-samples.yml @@ -12,7 +12,7 @@ on: - 'docs/**' jobs: - build: + build-winui-sample: runs-on: windows-latest strategy: @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v6.0.3 with: submodules: recursive @@ -36,6 +36,197 @@ jobs: 9.0.x 10.0.100 - - name: Build + - name: Build WinUI sample app run: | - msbuild /restore samples/WinUI.TableView.SampleApp/WinUI.TableView.SampleApp.csproj /p:Configuration=Release /p:Platform=${{ matrix.architecture }} + msbuild /restore samples/WinUI.TableView.SampleApp/WinUI.TableView.SampleApp.csproj /p:Configuration=Release /p:Platform=${{ matrix.architecture }} /bl:artifacts/binlogs/build-winui-sample-${{ matrix.architecture }}.binlog + + - name: Upload WinUI sample artifacts + uses: actions/upload-artifact@v7.0.1 + with: + name: winui-sample-${{ matrix.architecture }} + if-no-files-found: warn + path: | + samples/WinUI.TableView.SampleApp/bin/${{ matrix.architecture }}/Release/** + artifacts/binlogs/build-winui-sample-${{ matrix.architecture }}.binlog + + build-uno-desktop: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v6.0.3 + with: + submodules: recursive + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v5.0.1 + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.100 + + - name: Restore Uno workloads + run: dotnet workload restore samples/WinUI.TableView.SampleApp.Uno/WinUI.TableView.SampleApp.Uno.csproj + + - name: Build Uno desktop sample app + run: dotnet build samples/WinUI.TableView.SampleApp.Uno/WinUI.TableView.SampleApp.Uno.csproj -c Release -f net10.0-desktop -bl:artifacts/binlogs/build-uno-desktop.binlog + + - name: Upload Uno desktop artifacts + uses: actions/upload-artifact@v7.0.1 + with: + name: uno-desktop + if-no-files-found: warn + path: | + samples/WinUI.TableView.SampleApp.Uno/bin/Release/net10.0-desktop/** + artifacts/binlogs/build-uno-desktop.binlog + + build-uno-wasm: + env: + DIST_PATH: samples/WinUI.TableView.SampleApp.Uno/bin/Release/net10.0-browserwasm/publish/wwwroot + DotnetVersion: '10.0.100' + runs-on: ubuntu-latest + container: 'unoplatform/wasm-build:3.0' + steps: + - uses: actions/checkout@v6.0.3 + with: + submodules: true + lfs: false + + # When running on macos, set the DOTNET_INSTALL_DIR so a workspace local folder + # is used to install the SDK. This is required for the Uno.Sdk.Updater to work + - name: Set DOTNET_INSTALL_DIR + if: runner.os == 'macos' || runner.os == 'linux' + shell: bash + run: echo "DOTNET_INSTALL_DIR=$GITHUB_WORKSPACE/.dotnet" >> $GITHUB_ENV + + - name: 'Set Wasm cache path' + shell: pwsh + run: echo "WasmCachePath=${{ github.workspace }}/.emscripten-cache" >> $env:GITHUB_ENV + + - name: Cache EMSDK + id: cache-emsdk + uses: actions/cache@v4 + env: + cache-name: cache-emsdk-modules + with: + path: ${{ env.WasmCachePath }} + key: ${{ runner.os }}-build-emsdk-${{ env.DotnetVersion }} + restore-keys: | + ${{ runner.os }}-build-emsdk-${{ env.DotnetVersion }} + + - name: Cache .NET + id: cache-dotnet + uses: actions/cache@v4 + env: + cache-name: cache-dotnet-install + with: + path: ${{ github.workspace }}/.dotnet + key: ${{ runner.os }}-build-dotnet-${{ env.DotnetVersion }} + restore-keys: | + ${{ runner.os }}-build-dotnet-${{ env.DotnetVersion }} + + - name: Setup .NET + uses: actions/setup-dotnet@v5.0.1 + with: + dotnet-version: ${{ env.DotnetVersion }} + + - uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 + id: nbgv + with: + toolVersion: 3.6.139 + setAllVars: true + + - name: Setup Workloads + run: | + cd samples/WinUI.TableView.SampleApp.Uno + dotnet workload restore + + - name: Install Wasm Tools + run: | + cd samples/WinUI.TableView.SampleApp.Uno + dotnet workload install wasm-tools + + - name: Build Uno wasm sample app + run: | + cd samples/WinUI.TableView.SampleApp.Uno + dotnet publish -c Release -f net10.0-browserwasm "/p:PackageVersion=${{ steps.nbgv.outputs.SemVer2 }}" -bl:artifacts/binlogs/build-uno-wasm.binlog + + - name: Upload Uno wasm artifacts + uses: actions/upload-artifact@v7.0.1 + with: + name: uno-wasm + if-no-files-found: warn + path: | + samples/WinUI.TableView.SampleApp.Uno/bin/Release/net10.0-browserwasm/** + artifacts/binlogs/build-uno-wasm.binlog + + deploy-uno-wasm: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: build-uno-wasm + runs-on: ubuntu-latest + steps: + - name: Download Uno wasm artifacts + uses: actions/download-artifact@v7 + with: + name: uno-wasm + path: wasm-dist + + - name: Deploy to Azure Static Web Apps + id: builddeploy + continue-on-error: true + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LIVELY_GROUND_0D0F6A810 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "wasm-dist/samples/WinUI.TableView.SampleApp.Uno/bin/Release/net10.0-browserwasm/publish/wwwroot" # App source code path + api_location: "" # Api source code path - optional + output_location: "" # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + build-uno-mobile: + if: false # Disabled for now. + runs-on: macos-latest + + strategy: + matrix: + target_framework: [net10.0-android, net10.0-ios] + + steps: + - name: Checkout + uses: actions/checkout@v6.0.3 + with: + submodules: recursive + + - name: Set DOTNET_INSTALL_DIR + shell: bash + run: echo "DOTNET_INSTALL_DIR=$GITHUB_WORKSPACE/.dotnet" >> "$GITHUB_ENV" + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v5.0.1 + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.100 + + - name: Restore Uno workloads + run: dotnet workload restore samples/WinUI.TableView.SampleApp.Uno/WinUI.TableView.SampleApp.Uno.csproj + + - name: Install mobile workloads + run: dotnet workload install android ios + + - name: Build Uno mobile sample app + run: dotnet build samples/WinUI.TableView.SampleApp.Uno/WinUI.TableView.SampleApp.Uno.csproj -c Release -f ${{ matrix.target_framework }} -bl:artifacts/binlogs/build-uno-mobile-${{ matrix.target_framework }}.binlog + + - name: Upload Uno mobile artifacts + uses: actions/upload-artifact@v7.0.1 + with: + name: uno-mobile-${{ matrix.target_framework }} + if-no-files-found: warn + path: | + samples/WinUI.TableView.SampleApp.Uno/bin/Release/${{ matrix.target_framework }}/** + artifacts/binlogs/build-uno-mobile-${{ matrix.target_framework }}.binlog diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index cbad4266..8715e676 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -41,12 +41,11 @@ jobs: msbuild /restore ` /t:Build tests/WinUI.TableView.Tests.csproj ` /p:Platform=x64 ` - /p:Configuration=Release ` - /p:OutputPath=build + /p:Configuration=Release - name: Run Tests run: | - vstest.console.exe tests\build\WinUI.TableView.Tests.build.appxrecipe --logger:"console;verbosity=normal" /InIsolation + tests\bin\x64\Release\net9.0-windows10.0.19041.0\WinUI.TableView.Tests.build.appxrecipe --logger:"console;verbosity=normal" /InIsolation - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/docs/docs/release-notes/index.md b/docs/docs/release-notes/index.md index 74b8fd6e..ab4a7abd 100644 --- a/docs/docs/release-notes/index.md +++ b/docs/docs/release-notes/index.md @@ -24,6 +24,7 @@ This section contains release notes for all versions of WinUI.TableView. | Version | Date | Highlights | |---------|------|------------| +| [v1.5.0-preview1](v1.5.0-preview1.md) | July 7, 2026 | CellWithRow selection, drag selection, paste support, AOT, accessibility | | [v1.4.0-preview2](v1.4.0-preview2.md) | January 23, 2026 | Performance boost, SortMemberPath, double-tap events | | [v1.4.0-preview1](v1.4.0-preview1.md) | November 28, 2025 | Frozen columns, row details, column reordering, conditional styling | | [v1.3.0-preview2](v1.3.0-preview2.md) | April 3, 2025 | Uno Platform support (WASM, macOS, Linux) | diff --git a/docs/docs/release-notes/toc.yml b/docs/docs/release-notes/toc.yml index 7ec3030b..04d8307b 100644 --- a/docs/docs/release-notes/toc.yml +++ b/docs/docs/release-notes/toc.yml @@ -30,6 +30,8 @@ href: v1.0.0.md - name: Preview Releases items: + - name: v1.5.0-preview1 + href: v1.5.0-preview1.md - name: v1.4.0-preview2 href: v1.4.0-preview2.md - name: v1.4.0-preview1 diff --git a/docs/docs/release-notes/v1.5.0-preview1.md b/docs/docs/release-notes/v1.5.0-preview1.md new file mode 100644 index 00000000..72551bdb --- /dev/null +++ b/docs/docs/release-notes/v1.5.0-preview1.md @@ -0,0 +1,46 @@ +# v1.5.0-preview1 + +> **Preview Release** · July 7, 2026 · [NuGet](https://www.nuget.org/packages/WinUI.TableView/1.5.0-preview1) · [GitHub Release](https://github.com/w-ahmad/WinUI.TableView/releases/tag/v1.5.0-preview1) + +## 🌟 Features + +- Added `CellWithRow` selection mode to select the clicked cell while keeping the full row highlighted by [@w-ahmad](https://github.com/w-ahmad) in [#388](https://github.com/w-ahmad/WinUI.TableView/pull/388) +- Added drag selection rectangle for multi-cell selection by [@godlytalias](https://github.com/godlytalias) in [#344](https://github.com/w-ahmad/WinUI.TableView/pull/344) +- Added clipboard paste support (`CanPaste`, `Pasting` event, paste command) by [@w-ahmad](https://github.com/w-ahmad) in [#379](https://github.com/w-ahmad/WinUI.TableView/pull/379) +- Added `ColumnAutoWidthMode` to auto-size columns to their content by [@Mangepange](https://github.com/Mangepange) in [#361](https://github.com/w-ahmad/WinUI.TableView/pull/361) +- Added support for inline cell templates in `TableViewTemplateColumn` by [@w-ahmad](https://github.com/w-ahmad) in [#360](https://github.com/w-ahmad/WinUI.TableView/pull/360) +- Added Native AOT compatibility by [@w-ahmad](https://github.com/w-ahmad) in [#352](https://github.com/w-ahmad/WinUI.TableView/pull/352) +- Added UI Automation / accessibility support (`TableViewAutomationPeer`, `TableViewCellAutomationPeer`, `TableViewRowAutomationPeer`, `TableViewColumnHeaderAutomationPeer`, `TableViewRowHeaderAutomationPeer`) by [@w-ahmad](https://github.com/w-ahmad) in [#397](https://github.com/w-ahmad/WinUI.TableView/pull/397) + +## Enhancements + +- Improved keyboard navigation (Tab, Enter, and arrow key handling across cells) by [@Mangepange](https://github.com/Mangepange) in [#356](https://github.com/w-ahmad/WinUI.TableView/pull/356) +- Added `OperationContentBinding` to `TableViewTemplateColumn` for sorting, filtering, and export support by [@Mangepange](https://github.com/Mangepange) in [#356](https://github.com/w-ahmad/WinUI.TableView/pull/356) +- `TableViewTemplateColumn` now uses `ClipboardContentBinding` for copy and export operations by [@Mangepange](https://github.com/Mangepange) in [#355](https://github.com/w-ahmad/WinUI.TableView/pull/355) +- Extended compiled binding path to support mixed collections and subclass hierarchies by [@DanielTrommel](https://github.com/DanielTrommel) in [#382](https://github.com/w-ahmad/WinUI.TableView/pull/382) +- Added option to select a cell or row when a context menu is triggered by [@cricketthomas](https://github.com/cricketthomas) in [#374](https://github.com/w-ahmad/WinUI.TableView/pull/374) +- Migrated library source to C# 14 using the `field` keyword by [@w-ahmad](https://github.com/w-ahmad) in [#375](https://github.com/w-ahmad/WinUI.TableView/pull/375) +- Improved memory management and lifecycle handling for `TableView` by [@w-ahmad](https://github.com/w-ahmad) in [#369](https://github.com/w-ahmad/WinUI.TableView/pull/369) +- Allow selector-only `TableViewTemplateColumn` to enter edit mode by [@w-ahmad](https://github.com/w-ahmad) in [#400](https://github.com/w-ahmad/WinUI.TableView/pull/400) +- Derive default date/time formats from the user profile locale by [@w-ahmad](https://github.com/w-ahmad) in [#401](https://github.com/w-ahmad/WinUI.TableView/pull/401) +- Added Persian (fa-IR) translations by [@ghost1372](https://github.com/ghost1372) in [#402](https://github.com/w-ahmad/WinUI.TableView/pull/402) +- Updated Windows App SDK target from 1.6 to 1.8 by [@licon4812](https://github.com/licon4812) in [#285](https://github.com/w-ahmad/WinUI.TableView/pull/285) +- Updated Uno.SDK and Uno.WinUI to latest versions by [@w-ahmad](https://github.com/w-ahmad) in [#405](https://github.com/w-ahmad/WinUI.TableView/pull/405) + +## Fixes + +- Fix: null clipboard payload handling by [@mavaddat](https://github.com/mavaddat) in [#305](https://github.com/w-ahmad/WinUI.TableView/pull/305) +- Fix: End current edit when `IsReadOnly` changes on `TableView` or column by [@Mangepange](https://github.com/Mangepange) in [#389](https://github.com/w-ahmad/WinUI.TableView/pull/389) +- Fix: End editing on pointer press to prevent stale edit states by [@Mangepange](https://github.com/Mangepange) in [#357](https://github.com/w-ahmad/WinUI.TableView/pull/357) +- Fix: Column width regression after C# 14 refactor and `ColumnAutoWidthMode` changes by [@DanielTrommel](https://github.com/DanielTrommel) in [#386](https://github.com/w-ahmad/WinUI.TableView/pull/386) +- Fix: Ensure cell measures when element is set for correct column auto-sizing by [@w-ahmad](https://github.com/w-ahmad) in [#372](https://github.com/w-ahmad/WinUI.TableView/pull/372) +- Fix: Filter flyout search behavior using custom `MenuFlyout` control by [@w-ahmad](https://github.com/w-ahmad) in [#378](https://github.com/w-ahmad/WinUI.TableView/pull/378) +- Fix: Guard column reorder on valid drop target and prevent duplicate header option commands by [@w-ahmad](https://github.com/w-ahmad) in [#352](https://github.com/w-ahmad/WinUI.TableView/pull/352) +- Fix: Implement platform-specific `ClockIdentifier` logic for date/time columns by [@w-ahmad](https://github.com/w-ahmad) in [#404](https://github.com/w-ahmad/WinUI.TableView/pull/404) + +## New Contributors + +- [@godlytalias](https://github.com/godlytalias) made their first contribution in [#344](https://github.com/w-ahmad/WinUI.TableView/pull/344) +- [@mavaddat](https://github.com/mavaddat) made their first contribution in [#305](https://github.com/w-ahmad/WinUI.TableView/pull/305) +- [@Mangepange](https://github.com/Mangepange) made their first contribution in [#355](https://github.com/w-ahmad/WinUI.TableView/pull/355) +- [@ghost1372](https://github.com/ghost1372) made their first contribution in [#402](https://github.com/w-ahmad/WinUI.TableView/pull/402) diff --git a/global.json b/global.json index 38abb8e5..ad670604 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "msbuild-sdks": { - "Uno.Sdk": "6.4.53" + "Uno.Sdk": "6.5.36" }, "sdk": { "version": "10.0.100", diff --git a/samples/Directory.Packages.props b/samples/Directory.Packages.props index 834cdd1b..4d16e1a3 100644 --- a/samples/Directory.Packages.props +++ b/samples/Directory.Packages.props @@ -5,8 +5,9 @@ - + + - + \ No newline at end of file diff --git a/src/Columns/TableViewDateColumn.cs b/src/Columns/TableViewDateColumn.cs index 1c3db4e6..dc3fa334 100644 --- a/src/Columns/TableViewDateColumn.cs +++ b/src/Columns/TableViewDateColumn.cs @@ -2,6 +2,8 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using System; +using Windows.Globalization.DateTimeFormatting; +using Windows.System.UserProfile; using WinUI.TableView.Controls; using WinUI.TableView.Extensions; using WinUI.TableView.Helpers; @@ -19,6 +21,20 @@ namespace WinUI.TableView; #endif public partial class TableViewDateColumn : TableViewBoundColumn { + /// + /// Initializes a new instance of the TableViewDateColumn class. + /// + public TableViewDateColumn() + { +#if WINDOWS + var languages = GlobalizationPreferences.Languages; + var patterns = languages.Count > 0 ? new DateTimeFormatter("shortdate", languages).Patterns : null; + DateFormat = patterns?.Count > 0 ? patterns[0] : "shortdate"; +#else + DateFormat = DateTimeFormatter.ShortDate.Patterns[0]; +#endif + } + /// /// Generates a TextBlock element for the cell. /// diff --git a/src/Columns/TableViewTimeColumn.cs b/src/Columns/TableViewTimeColumn.cs index bf5ef184..e8899a1f 100644 --- a/src/Columns/TableViewTimeColumn.cs +++ b/src/Columns/TableViewTimeColumn.cs @@ -2,7 +2,6 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using System; -using Windows.Globalization.DateTimeFormatting; using WinUI.TableView.Controls; using WinUI.TableView.Extensions; using WinUI.TableView.Helpers; @@ -24,7 +23,12 @@ public partial class TableViewTimeColumn : TableViewBoundColumn /// public TableViewTimeColumn() { - ClockIdentifier = DateTimeFormatter.LongTime.Clock; +#if WINDOWS + var clocks = Windows.System.UserProfile.GlobalizationPreferences.Clocks; + ClockIdentifier = clocks.Count > 0 ? clocks[0] : "24HourClock"; +#else + ClockIdentifier = Windows.Globalization.DateTimeFormatting.DateTimeFormatter.ShortTime.Clock; +#endif } /// diff --git a/src/Helpers/DateTimeFormatHelper.cs b/src/Helpers/DateTimeFormatHelper.cs index 81bf1e84..95ac7aab 100644 --- a/src/Helpers/DateTimeFormatHelper.cs +++ b/src/Helpers/DateTimeFormatHelper.cs @@ -88,6 +88,21 @@ internal static DateTimeFormatter GetDateTimeFormatter(string strFormat, string? formatter.Calendar, strClock ?? formatter.Clock); +#if !WINDOWS + if (strFormat is "shorttime") + { + var longDateFormat = new DateTimeFormatter("longdate").Patterns[0]; + var timeFormat = result.Patterns[0].Replace(longDateFormat, "").Trim(); + + result = new DateTimeFormatter( + timeFormat, + formatter.Languages, + formatter.GeographicRegion, + formatter.Calendar, + strClock ?? formatter.Clock); + } +#endif + _formatters[(strFormat, strClock)] = result; return result; diff --git a/src/TableViewCell.cs b/src/TableViewCell.cs index bd0fcfbd..523f8a46 100644 --- a/src/TableViewCell.cs +++ b/src/TableViewCell.cs @@ -646,7 +646,8 @@ internal void EnsureStyle(object? item) /// /// Gets a value indicating whether the cell is read-only. /// - public bool IsReadOnly => TableView?.IsReadOnly is true || Column is TableViewTemplateColumn { EditingTemplate: null } or { IsReadOnly: true }; + public bool IsReadOnly => TableView?.IsReadOnly is true + || Column is TableViewTemplateColumn { EditingTemplate: null, EditingTemplateSelector: null } or { IsReadOnly: true }; /// /// Gets the slot for the cell. diff --git a/src/WinUI.TableView.csproj b/src/WinUI.TableView.csproj index 9937dcb8..ca393d21 100644 --- a/src/WinUI.TableView.csproj +++ b/src/WinUI.TableView.csproj @@ -22,6 +22,11 @@ 10.0.19041.56 + + 6.2.87 + 6.5.237 + + <_Parameter1>WinUI.TableView.Tests @@ -29,12 +34,11 @@ - + - - + @@ -45,11 +49,11 @@ - - - TableView.cs - - + + + TableView.cs + + WinUI.TableView diff --git a/tests/TableViewTemplateColumnTests.cs b/tests/TableViewTemplateColumnTests.cs index 933fee38..1035864f 100644 --- a/tests/TableViewTemplateColumnTests.cs +++ b/tests/TableViewTemplateColumnTests.cs @@ -63,4 +63,16 @@ public void TableViewTemplateColumn_UsesTemplateSelectors() Assert.AreSame(displayTemplate, displayElement.ContentTemplate); Assert.AreSame(editingTemplate, editingElement.ContentTemplate); } + + [UITestMethod] + public void TableViewCell_IsNotReadOnly_WhenTemplateColumnUsesEditingTemplateSelector() + { + var cell = new TableViewCell(); + cell.Column = new TableViewTemplateColumn + { + EditingTemplateSelector = new ConstantTemplateSelector(TableViewColumnTestHelpers.CreateTemplate("selected-edit")) + }; + + Assert.IsFalse(cell.IsReadOnly); + } } diff --git a/tests/TableViewTimeColumnTests.cs b/tests/TableViewTimeColumnTests.cs index 1a6f4798..70b26e7e 100644 --- a/tests/TableViewTimeColumnTests.cs +++ b/tests/TableViewTimeColumnTests.cs @@ -4,7 +4,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer; using System; -using Windows.Globalization.DateTimeFormatting; +using Windows.System.UserProfile; using WinUI.TableView.Controls; using WinUI.TableView.Helpers; @@ -33,7 +33,8 @@ public void TableViewTimeColumn_GeneratesEditingElementWithConfiguredProperties( Assert.AreEqual(TableViewLocalizedStrings.TimePickerPlaceholder, element.PlaceholderText); Assert.AreEqual(typeof(TimeOnly), element.SourceType); Assert.AreEqual(item.AppointmentTime, column.PrepareCellForEdit(cell, new RoutedEventArgs())); - Assert.AreEqual(DateTimeFormatter.LongTime.Clock, new TableViewTimeColumn().ClockIdentifier); + var clocks = GlobalizationPreferences.Clocks; + Assert.AreEqual(clocks.Count > 0 ? clocks[0] : "24HourClock", new TableViewTimeColumn().ClockIdentifier); } [UITestMethod] diff --git a/tests/UnitTestApp.xaml.cs b/tests/UnitTestApp.xaml.cs index e8f0dc08..c1d63c52 100644 --- a/tests/UnitTestApp.xaml.cs +++ b/tests/UnitTestApp.xaml.cs @@ -40,12 +40,12 @@ public UnitTestApp() /// Details about the launch request and process. protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { - UnitTestClient.CreateDefaultUI(); - MainWindow.Activate(); UITestMethodAttribute.DispatcherQueue = MainWindow.DispatcherQueue; + UnitTestClient.CreateDefaultUI(); + UnitTestClient.Run(Environment.CommandLine); } } diff --git a/tests/WinUI.TableView.Tests.csproj b/tests/WinUI.TableView.Tests.csproj index dbf8adb5..b6c899ba 100644 --- a/tests/WinUI.TableView.Tests.csproj +++ b/tests/WinUI.TableView.Tests.csproj @@ -8,8 +8,8 @@ app.manifest x86;x64;ARM64 win-x86;win-x64;win-arm64 - win-$(Platform).pubxml true + false true enable true @@ -44,7 +44,11 @@ - + + build + + +