GithubHelp home page GithubHelp logo

Comments (6)

rlebowitz avatar rlebowitz commented on May 16, 2024 15

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.

Eilon avatar Eilon commented on May 16, 2024 3

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.

Eilon avatar Eilon commented on May 16, 2024 3

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.

nickkfwong avatar nickkfwong commented on May 16, 2024

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.

Eilon avatar Eilon commented on May 16, 2024

I'll ask some Blazor experts about this.

from mobileblazorbindings.

whann0205 avatar whann0205 commented on May 16, 2024

Any news regarding this topic, since it is still present?

from mobileblazorbindings.

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.