Jurioli / Blazor.WebForm.Components

ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly, Blazor Hybrid, Blazor Server.
MIT License
47 stars 9 forks source link

Setting component's Properties by their References (@ref) #10

Closed MG1376 closed 7 months ago

MG1376 commented 7 months ago

Hello, I am new to this package but I used Asp.Net years ago. Please see my question about blazor that I asked some years ago at stackoverflow Here

based on this question and answer, it is not possible to set component properties directly and answers suggest to use a method and call that method on the component.

Now my question is: at the time I wrote that question it was not possible to set component properties with out first defining a variable for that property and then set that variable. I tested it a lot, But maybe currently it is possible. So how it is guarantied that in the future, the microsoft team doesn't remove this ability and makes your package and many people that depend on it nonfunctional.

It is also important to me, since I like your package and reduced code it produced compared to other packages. And I really want to do part of my work with it.

Jurioli commented 7 months ago

I occasionally check for Microsoft updates to see if there are any changes to ComponentBase to avoid potential issues. This is because some functionalities in the base ControlComponent rely on reflection.

Regarding the question that you asked previously and their resolution, it's due to the SetParametersAsync method in ControlComponentBase being overridden to include parameters filtering: preventing previously set Control properties from being set again. This enables direct settings of component properties through references in events without the need for additional variable settings. Currently, the compiler only issues minor BL0007 warnings related to this code segment.