Comments (19)
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.
What would be the best way to get Styles applied to a non VisualElement?
from xamarin.forms.
@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.
When is this feature going to be released?
from xamarin.forms.
any update on this ?
from xamarin.forms.
I'll pick this one up. Might pick up the commandable span regions as well, afterwards.
from xamarin.forms.
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.
I want to open dialer when user click on Request Number value. How is it possible?
from xamarin.forms.
Looking forward to this. Any ETA for it?
from xamarin.forms.
@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.
#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.
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.
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.
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.
@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.
@adamped yes, that looks fine. MergedStyle is indeed responsible for applying normal Styles, whereas CSS styles are applied through Element
from xamarin.forms.
@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.
@adamped your commits are fine as-is
from xamarin.forms.
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.
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)
- App freezes on Windows (UWP) when using Frame
- Cannot reload Listview datasource more than once, app close after error, Object reference not set to an instance of an object
- After installing the "Miicrosoft.UI.XAML" NuGet package on UWP platform. The Xamarin Button control style was changed. HOT 2
- [Bug] Xamarin.iOS application crashes on device with test flight version but not with DEBUG version HOT 4
- Unable to build Android custom renderers with latest Xamarin.Forms version HOT 1
- Xamarin Google.Map.MapView crash HOT 1
- [Bug] Missing a crucial warning in the NSMenu.Items documentation. HOT 1
- [Bug] App is frozen when resumed (Android) HOT 1
- UWP camera save option is disabled untill you edit capture picture. HOT 1
- [Bug] Archiving in VS 2022 failing HOT 3
- [Enhancement] Add more descriptive exception for route not found (Shell.Current.GoToAsync). HOT 2
- [Bug] Xamarin Splash screen not visible turns out black in iOS HOT 2
- [Bug] Entry looses focus
- [Bug] DisplayActionSheet doesn't show up on macOS
- [Bug] Letters below the writing line are cut off on iOS
- X2Property binding seems to be unfunctional in a carouselview
- [Bug] Xamarin.Forms v5.0.0.2662 has a package version conflict with itself HOT 5
- [Visual Studio 17.9.3] Xamarin project encountered an issue with xaml
- Get code in app from stack trace
- [Bug] In .Net 8 MAUI VisibleViews property of CarouselView is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xamarin.forms.