How to customize TabView in WinUI3

C CB 170 Reputation points
2024-06-28T02:26:12.2266667+00:00

How to customize TabView in WinUI3 as follows:

  1. Set the header of the selected tab to bold font and red background, and the header of the unselected tab to yellow background.
  2. Leave some space between each tab header.
  3. Add a red dividing line between the head of the tab and the content area below, with the width of the line equal to the width of the entire TabView.
  4. Add a red rectangular box to the outermost layer of each tab's content area, so that the content is displayed within the rectangular box.

To my knowledge, implementing these may require modifying the control template, but I am not familiar with it. I hope those who know can provide a complete XAML example.

Furthermore, how to achieve the following functions:

How to make the display text of the tab header editable after clicking, and cannot input or paste certain special characters such as slashes during editing, losing focus or completing editing after entering, just like changing the name of a Windows file/folder.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
798 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,039 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.