Comments (6)
One simple work-around would be as follows:
_Imports.razor:
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using XF = Xamarin.Forms
Counter.razor:
<Frame CornerRadius="10" BackgroundColor="XF.Color.LightBlue">
<StackLayout Orientation="XF.StackOrientation.Horizontal" HorizontalOptions="XF.LayoutOptions.Center">
<Button Text="Increment" OnClick="@IncrementCount"></Button>
<Label Text="@("The button was clicked " + Count + " times")"
FontAttributes="XF.FontAttributes.Bold"
VerticalTextAlignment="XF.TextAlignment.Center">
</Label>
</StackLayout>
</Frame>
Counter.cs:
public partial class Counter
{
private int Count { get; set; }
private void IncrementCount()
{
Count++;
}
}
Note that I chose to separate the @code{}
portion of the XAML file out to a separate partial class in order to retain separation of the UI and logic. You don't have to do this, but it's a practice I try to follow.
from mobileblazorbindings.
Thank you for reporting this. This is unfortunately a known issue right now and I am investigating good workarounds or solutions. As you noted, these errors are indeed harmless, but I agree they are very annoying.
from mobileblazorbindings.
I do have an update, finally! This appears to be a Razor Tooling bug, so I talked to @NTaylorMullen on that team about it and he worked with me to figure out the cause, so I logged this issue: https://github.com/dotnet/aspnetcore/issues/26647
I'll see if I can send them a PR to fix it but it looks like the issue might be there to help avoid another issue, so we have to figure out how to fix this without causing a regression to another important scenario.
from mobileblazorbindings.
Since there are many attributes that goes into Xaramin.Form namespace, for now I used the full namespace for the element instead.
ie.
<Microsoft.MobileBlazorBindings.Elements.Frame>
</Microsoft.MobileBlazorBindings.Elements.Frame>
But intellisense seems doesnt work well on this though (maybe some of my config not setting correctly? - Im using VS2019 community)
from mobileblazorbindings.
I'll ask some Blazor experts about this.
from mobileblazorbindings.
Any news regarding this topic, since it is still present?
from mobileblazorbindings.
Related Issues (20)
- debug windows app that has a blazorwebview HOT 1
- Renderer was called before InitAsync
- IJSRuntime : {System.NullReferenceException: Object reference not set to an instance of an object. in DelegatingHandler HOT 2
- Does blazor hybrid work on iOS? HOT 5
- Is this project is dead ? HOT 1
- this project are discontinued? HOT 2
- Revisit ObjectExtensions.This() internal extension method HOT 4
- True Fullscreen on blazor windows HOT 4
- How to change WebView EBWebView folder path? HOT 2
- OnParametersSet is not invoked on Shell navigation
- Allow text content for Label control
- Allow passing additional parameters during Shell navigation
- Blazor WebView freeze after maximizing WPF Windows App
- Update Picker.ItemDisplayBinding to be Func instead of string
- Unable to load image from URL HOT 1
- WFP blazor Support MVVM in future release? HOT 4
- When will this project continue? HOT 3
- Window size
- NavigationManager does not work anymore on Hybrid Apps HOT 2
- VS 2022 Community is forever Installing SDK Components and never completes. HOT 1
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 mobileblazorbindings.