Skip to content

Port the ListViewItemPresenter/GridViewItemPresenter focus rectangle (FocusBorderBrush, FocusSecondaryBorderBrush) #25923

Open

Description

@MartinZikmund

What would you like to be added? 💡

The focus rectangle part of the ListViewItemPresenter / GridViewItemPresenter chrome, ported from WinUI. PR #25389 ports the chrome, but these properties are still marked [Uno.NotImplemented] because nothing reads them yet:

  • ListViewItemPresenter.FocusBorderBrush, FocusSecondaryBorderBrush
  • GridViewItemPresenter.FocusBorderBrush

That needs:

  • CListViewBaseItemChrome::CustomizeFocusRectangle (ListViewBaseItemChrome.cpp:3630) driving the focus visual. It picks m_pFocusSecondaryBorderBrush / m_pFocusBorderBrush as the first/second focus brushes (around lines 3572-3580). GridView items pick the state background as the second brush, with the 2px s_gridViewItemFocusBorderThickness border.
  • The m_isFocusVisualDrawnByFocusManager handshake between the chrome and the focus manager. WinUI does it per render walk; see the TODO Uno in ListViewBaseItemChrome.uno.cs. CalendarViewBaseItemChrome.CustomizeFocusRectangle is an existing Uno precedent.
  • The GridView focus border with a non-solid SelectedBackground, which today silently drops the border.
  • FocusVisualKind=DottedLine, which today renders nothing for chromed items.
  • Removing [Uno.NotImplemented] from the three properties, with runtime tests: keyboard focus on a ListView and a GridView item, in light, dark and high contrast.

Why is this needed? 🤔

Keyboard focus on ListView/GridView items doesn't honor these brushes. Theme resources such as ListViewItemFocusBorderBrush / GridViewItemFocusBorderBrush and app overrides have no effect, which hurts keyboard and high-contrast accessibility parity with WinUI.

For which platforms 📱💻🖥️

All (Skia)

Anything else we need to know? 💬

Follow-up to #25389 (ListViewItemPresenter/GridViewItemPresenter chrome port), raised in review.

Activity

  1. added
    kind/enhancement
    area/listview 📃
    project/items 🧾
    area/porting 🖨️
    on Nov 2, 2026
  2. MartinZikmund commented on Nov 14, 2026

    @MartinZikmund
    MemberAuthor

    State after the latest #25389 update, for whoever wires this:

    • Interim behavior: until CustomizeFocusRectangle is called by the focus visual, IsFocusVisualDrawnByFocusManager() (ListViewBaseItemChrome.uno.cs) returns false. So the non-rounded Overlay (GridView) chrome keeps drawing its selection/pointer-over ring on a keyboard-focused item, instead of losing it. When this is wired, restore the WinUI hand-off and flip When_GridView_Overlay_State_Ring_Drawn_While_Keyboard_Focused, so the ring is expected from the focus visual's second rectangle.
    • Brush types: FocusRectangleOptions.firstBrush and secondBrush are now typed Brush, matching WinUI's static_cast, so gradient and acrylic state brushes can stroke the ring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/listview 📃area/porting 🖨️kind/enhancementproject/items 🧾

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions