Setting TextBox FontFamily property from Style causes XamlObjectWriterException
See original GitHub issue<Style Selector="TextBox.export">
<Setter Property="FontFamily" Value="Consolas"/>
</Style>
version: 0.7.1-build989-beta
Portable.Xaml.XamlObjectWriterException
HResult=0x80131500
Message=Set value of member '{clr-namespace:Avalonia.Styling;assembly=Avalonia.Styling}Setter.Value' threw an exception
Source=Avalonia.Markup.Xaml
StackTrace:
at Portable.Xaml.XamlObjectWriterInternal.SetValue(XamlMember member, Object target, Object value)
at Portable.Xaml.XamlObjectWriterInternal.SetValue(XamlMember member, Object value)
at Portable.Xaml.XamlObjectWriterInternal.OnWriteEndMember()
at Portable.Xaml.XamlWriterInternalBase.WriteEndMember()
at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at Avalonia.Markup.Xaml.AvaloniaXamlLoader.LoadFromReader(XamlReader reader, AvaloniaXamlContext context, IAmbientProvider parentAmbientProvider)
at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
at ThemeEditor.App.Initialize() in C:\DOWNLOADS\GitHub\ThemeEditor\src\ThemeEditor\App.xaml.cs:line 10
at Avalonia.Controls.AppBuilderBase`1.Setup()
at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
at ThemeEditor.Program.Main(String[] args) in C:\DOWNLOADS\GitHub\ThemeEditor\src\ThemeEditor\Program.cs:line 19
Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (10 by maintainers)
Top Results From Across the Web
How to change FontFamily for Textbox while defined in ...
It is working for me. I defined two styles, one for window, one special for text box. Special style wins and result is...
Read more >TextBlock.FontFamily Property (System.Windows.Controls)
The following example shows how to set the FontFamily property programmatically. C# Copy. TextBlock textBlock = new TextBlock(new Run("A bit of text content ......
Read more >HTML DOM Style fontFamily Property
Style fontFamily Property ... Set the font for an element: ... The fontFamily property sets or returns a list of font-family names and/or...
Read more >Styling type on the web with variable fonts
Whether loading variable fonts from a font delivery service or our own server, ... Let's assign a variable weight property to some of...
Read more >How To Style Text Elements with Font, Size, and Color in ...
You also set up a font-family property that applies specifically to heading text content. In the next section you will use the Google...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess you could define the font family in code by defining a static property and reference it in your style.
I also see the same issue as MiKaMaru with the Button control.
I’m able to set the other properties using the syntax below, but I get the error: “NullReferenceException: Object reference not set to an instance of an object.” for the FontFamily line.