question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ArgumentException when TabViewItem.Header is null or empty string

See original GitHub issue

Describe the bug ArgumentException when a TabViewItem with empty or null Header displayed.

Steps to reproduce the bug

<TabView>
    <TabViewItem Header="">
        <TextBlock Text="123" />
    <TabViewItem>
<TabView>

or

<TabView>
    <TabViewItem Header="{x:Null}">
        <TextBlock Text="123" />
    <TabViewItem>
<TabView>

or

<TabView>
    <TabViewItem>
        <TextBlock Text="123" />
    <TabViewItem>
<TabView>

Does not reproduce if TabViewItem.Content is not set, or set to a string instead of a control.

Version Info

NuGet package version:

Microsoft.UI.Xaml 2.4.3 Microsoft.UI.Xaml.2.5.0-prerelease.200923002 Microsoft.WinUI 3.0.0-preview2.200713.0

Windows app type:

UWP Win32
Yes Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041)
November 2019 Update (18363) Yes
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenLPeterscommented, Sep 25, 2020

In teaching tip we ended up doing a content presenter who’s content is a border, who’s content is template bound to the property. that way we could put the foreground on the parent content presenter. I think that same model would work here?

0reactions
StephenLPeterscommented, Oct 1, 2020

That, unfortunately, makes sense. I think you are right and setting the content presenter’s content from code behind makes sense… 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should I Throw ArgumentNullException if a string is blank?
ArgumentException should be thrown for the String.Empty case. This would indicate an issue other than it being null.
Read more >
Error: Header has an empty/null field
Header has an empty/null field. This causes the import task to fail. Perform one of the following actions to resolve the error by...
Read more >
ArgumentException.ThrowIfNullOrEmpty(String ...
The string argument to validate as non- null and non-empty. paramName: String. The name of the parameter with which argument corresponds. Exceptions.
Read more >
Xamarin forms templatedview. I'm trying to do a content button ...
Control as null always. var listView = new ListView { ItemsSource = xxx, ItemTemplate = new ... I have tested it on a...
Read more >
Cannot set currency to an empty or null string
I'm getting 'ArgumentException: Cannot set currency to an empty or null string' trying to implement codeless IAP.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found