microsoft / microsoft/microsoft-ui-xaml

TextRange not usable in XAML

Open
#9,925 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-TextBlocks feature proposal team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

Describe the bug

One can't use TextRange in XAML because StartIndex and Length are fields not properties. One also can't create a derived class having such properties, because it is sealed. This makes it very difficult to use TextRange in a XAML data template.

Steps to reproduce the bug

Create a ListView with a resource for the DataTemplate as shown in the screenshot. Observe that the StartIndex and Length cannot be assigned or bound.

Expected behavior

Should be able to use TextRange in XAML.

Screenshots

image

NuGet package version

None

Windows version

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TextRange and the ListView resource/DataTemplate reproduction described in the issue. Verify the API behavior against XAML assignment and binding for StartIndex and Length; done means TextRange is usable in XAML.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.