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.

Make the .ctor of the NavigableElement public

See original GitHub issue

Description

Hello, The NavigableElement is a public class but we can’t inherit it because the .ctor is internal.

image

Looks like a trick to resolve sealed inheritance - you can do it, we not. Meanwhile, the NavigableElement implements a major feature - implicit styles, besides the shell navigation.

My question - Is there any reason to stop NavigableElement inheritance? Could you make the .ctor public?

Steps to Reproduce

So, why are we here:

  • MAUI doesn’t support the DefaultStyle engine like WPF. We stopped using implicit style in our components and basically remove the whole XAML from our assemblies. There are performance and usage issues that we get tired to fix.
  • There are special cases when we should set up the appearance of component parts, like DataGrid.ColumnAppearance. The ColumnAppearance a not presented in the visual tree as an element. It’s a “logical element” that provides a way to set the properties for drawing. In this case, we need implicit styles for our customers! It’s super flexible to write XAML like:
...
<Resouces>
  <Style TargetType="ColumnAppearance">
     <Setter Property="Background" Value="Red"/>
  </Style>
</Resouces>

We inherited our appearance class from VisualElement. It’s tricky and I don’t really like it:

  • It’s WA and is not a quality solution. A lot of VisualElement properties (like Width, Height …) don’t work and are unnecessary.
  • We faced some issues with HotReload in this case (I go to sending a separate issue)

Link to public reproduction project repository

https://github.com/dotnet/maui

Version with bug

6.0 Release Candidate 2 or older

Last version that worked well

6.0 Release Candidate 2 or older

Affected platforms

iOS, Android, Windows

Affected platform versions

iOS 15

Did you find any workaround?

No response

Relevant log output

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Alexgooncommented, Oct 24, 2022

Hello, The issue affects many APIs in our DevExpress product line. According to our experience, inherited properties that don’t work, confuse users, and we would like to avoid this. Would you please clarify if there is a chance NavigableElement to become public in the next release or should we rely on the fact that this won’t change soon?

0reactions
alexdi220commented, Oct 12, 2022

Could you explain the plans for it? What are you think about how long it’ll be implemented?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavigableElement Class (Xamarin.Forms)
Gets or sets a value that allows the automation framework to find and interact with this element. (Inherited from Element). BindingContext. Gets or...
Read more >
NavigableElement Class (Microsoft.Maui.Controls)
Gets or sets a value that allows the automation framework to find and interact with this element. (Inherited from Element). BindingContext. Gets or...
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