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.

Xaml.Label --> XF.Label or Forms.Label or View.Label or UI.Label

See original GitHub issue

Feedback from @migueldeicaza and others:

rename Xaml.FooBar to something else, e.g. UI.FooBar or XF.FooBar or Forms.FooBar

Of these I think I would prefer XF.Label, XF.Button etc., but please chime in if you have a preference.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
dsymecommented, May 19, 2018

Hi @charlesroddie

Yes, 2 is necessary for 1.

This enormous task is carried out in DynamicXaml.fs

The code is generated from the model in bindings.json and the binding.json is fairly straight-forward.

Regarding size - I’ve added to the roadmap to double check that the Xamarin tree-shaker removes unused portions of the code and only leaves the update code for the controls you use. If it doesn’t there’s something wrong with the tree-shaker, since there are no circular dependencies.

which attempts to maintain order in a large type-unsafe system.

TBH it’s actually fairly buttoned down. The process of code generation from bindings,json and subsequent compilation checks the overall validity of the construction of DynamicXaml.fs. There are niggles but the approach is sound in the sense that if properties are missing or the bindings.json model is ill-typed then you find out during the construction of the library. I’ve not encountered any practical typing problems from this approach.

You will have to maintain DynamicXaml.fs

You currently need to maintain bindings.json, and yes, there is a question of versioning and delivery.

For 3rd party controls there are various ways to skin this cat and we haven’t started skinning yet (as noted in the README.md). The approach closest to the results you want would be to make an F# type provider that automates the process. You would point the TP at any set of normal-looking control libraries (i.e. controls whose API surface area looks like the ones in Xamarin.Forms.Core.dll) and do the appropriate thing. An optional bindings.json could be used to configure this. The code would look something like this

type XF = XamlBindings<"Xamarin.Forms.Core; Xamarin.Forms.Maps; WidgetsInc.Widgets">

... code as before ...

In theory this approach could remove the need for any base Elmish.XamarinForms.dll library and all necessary code would be injected into the user application. This removes versioning problems but comes with some other drawbacks.

it will only apply to one UI framework

The approach is being prototyped over Xamarin.Forms but can in theory be applied to WPF and UWP directly. That’s a separate story though. XF is a sensible place to start. The approach is fairly straight-forward so it’s likely we’ll see other variations on it.

1reaction
dsymecommented, May 17, 2018

Note that implementing the C# 5.0 “open static classes” feature in F# would allow th prefix to be dropped altogether, but right now we need a qualifier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xaml.Label --> XF.Label or Forms.Label or View.Label or ...
This is a great argument for XF.Label vs Xaml.* right here. You refer to it as XF, but use Xaml, which will only...
Read more >
Xamarin.Forms Label
The Label view is used for displaying text, both single and multi-line. Labels can have text decorations, colored text, and use custom fonts...
Read more >
How to change label text in xamarin
Try initializing the Text value in XAML like the following: <Label x:Name="YourLableName" Text="Initial Label"/>. Then access it in the code ...
Read more >
Building a Floating Label Entry with Xamarin.Forms
The Float Label Pattern was introduced as a UI concept back in 2013 by ... a Xamarin Forms project and adding a ContentView...
Read more >
The Label control
An article on how and when to use the WPF Label control, including the usage of access keys/text and inline child controls.
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