Giter VIP home page Giter VIP logo

Comments (19)

adamped avatar adamped commented on July 17, 2024 5

Binding Text all working
image

Styles I have working, but only if I inherit Span off VisualElement, which is incorrect because it then gives Span additional properties it shouldn't have.
image

What would be the best way to get Styles applied to a non VisualElement?

from xamarin.forms.

StephaneDelcroix avatar StephaneDelcroix commented on July 17, 2024 2

@adamped Span could inherit from Element. Most of the boilerplate is done there. It should also implement IStyleSelectable so it can be part of a CSS Selector and IStylable so we can apply CSS properties to it.

while you're at it, it should implement ITextColor (deprecate the ForegroundColor property in favor of TextColor)

from xamarin.forms.

asanka-indrajith avatar asanka-indrajith commented on July 17, 2024 2

When is this feature going to be released?

from xamarin.forms.

Charuwaka avatar Charuwaka commented on July 17, 2024 1

any update on this ?

from xamarin.forms.

adamped avatar adamped commented on July 17, 2024 1

I'll pick this one up. Might pick up the commandable span regions as well, afterwards.

from xamarin.forms.

adamped avatar adamped commented on July 17, 2024 1

You can already set fonts etc to individual spans. The ability to add a Style, is only providing the ability to set these properties, via a Style. However with styles come triggers and reusability :)

from xamarin.forms.

Srusti-Thakkar avatar Srusti-Thakkar commented on July 17, 2024 1

I want to open dialer when user click on Request Number value. How is it possible?

from xamarin.forms.

jonasrembratttetrapak avatar jonasrembratttetrapak commented on July 17, 2024 1

Looking forward to this. Any ETA for it?

from xamarin.forms.

jerone avatar jerone commented on July 17, 2024 1

@DamianSuess commented on Apr 8, 2018, 4:21 PM GMT+2:

So the pull request at XamarinFormsCommunity was done on Feb 9th, 2018. However, there's not a pull request here on the main Xamain.Forms project. Am I missing something in the process loop?

See #1850

from xamarin.forms.

ChaseFlorell avatar ChaseFlorell commented on July 17, 2024

#1701 was actually part of my original proposal on Evolution, but I didn't know if it was easily doable, so I deleted it. I really wanted to pick this up, but I don't work with UWP, I'm glad you got this @adamped, it'll be a great addition.

from xamarin.forms.

ChaseFlorell avatar ChaseFlorell commented on July 17, 2024

What about an IStylable interface with a Style property. Then VisualElement can also implement it and styling throughout can utilize it... Might be too much change, but it shouldn't break anything.

from xamarin.forms.

adamped avatar adamped commented on July 17, 2024

The too much change is what I am concerned about. The Style in VisualElement sets a MergedStyle, which is a sealed class, inside the VisualElement class. So nothing else other than VisualElement can reach it at the moment. I'd have to pull that out. Messing around with the VisualElement is something I don't want to do, unless told to :)

from xamarin.forms.

llevera avatar llevera commented on July 17, 2024

Isn't it fairly unusual to be able to individually style spans in this way? Sure the whole label but each span? If you compare ios, I thought the attributable string can only be bolded etc as attributes on the string. I don't recall Android runs, so I thought they couldn't just be styled as a visual element either?

In other words I thought on the platforms string formatting sat outside of the normal style system

from xamarin.forms.

adamped avatar adamped commented on July 17, 2024

@StephaneDelcroix - VisualElement has a style property that sets a property in a class scoped MergedStyle class. This class looks like it is doing the applying of the style. If I inherit directly from Element and implement the interfaces, no styles are applied.

To me it looks like the MergedStyle class is the key. Though i'm not pretending I know what it does at this stage. If I copy that out of the VisualElement. Then inherit Span from Element as suggested, but make the Style BindableProperty like this:

public Span()
{
	_fontElement = new BindableSpan(this);
	_mergedStyle = new MergedStyle(GetType(), this);
}

public readonly MergedStyle _mergedStyle;

public static readonly BindableProperty StyleProperty = BindableProperty.Create("Style", typeof(Style), typeof(Span), default(Style),
propertyChanged: (bindable, oldvalue, newvalue) => ((Span)bindable)._mergedStyle.Style = (Style)newvalue);
		
public Style Style
{
	get { return (Style)GetValue(StyleProperty); }
	set { SetValue(StyleProperty, value); }
}

Then styling all works. Can I pull the MergedStyle out of VisualElement, so it can be used by both Span and VisualElement?

from xamarin.forms.

StephaneDelcroix avatar StephaneDelcroix commented on July 17, 2024

@adamped yes, that looks fine. MergedStyle is indeed responsible for applying normal Styles, whereas CSS styles are applied through Element

from xamarin.forms.

adamped avatar adamped commented on July 17, 2024

@StephaneDelcroix - I have my PR ready for a pre-review. XamarinFormsCommunity#4

Quick question: Do we need to squash our commits anymore, because now GitHub has a nice convenient Squash and Commit button.

from xamarin.forms.

StephaneDelcroix avatar StephaneDelcroix commented on July 17, 2024

@adamped your commits are fine as-is

from xamarin.forms.

fwanjohi avatar fwanjohi commented on July 17, 2024

This is great. I have been looking for this. How do you go about getting an update on your computer when this feature is completed?

from xamarin.forms.

DamianSuess avatar DamianSuess commented on July 17, 2024

So the pull request at XamarinFormsCommunity was done on Feb 9th, 2018. However, there's not a pull request here on the main Xamain.Forms project. Am I missing something in the process loop?

from xamarin.forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.