aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

.cshtml does not accept 'string' for a 'object' type parameter

Open hungdluit opened this issue 8 years ago • 6 comments

I've created a button with

[Parameter]
public object Content {get;set;}

<XButton Content="Click Me !" Clicked="@MyHandler" ref="_button"></XButton>

Visual studio does not recognize 'Content' value,

Error:

image

hungdluit avatar May 10 '18 14:05 hungdluit

@hungdluit Could you elaborate?

SIkebe avatar May 10 '18 14:05 SIkebe

Also, component parameters should not be public.

danroth27 avatar May 10 '18 16:05 danroth27

We're not recognizing "Click Me !" as a string, probably because the property is of type object. This works though:

<XButton Content="@("Click Me !")" Clicked="@MyHandler" ref="_button"></XButton>

danroth27 avatar May 10 '18 16:05 danroth27

@rynowak is this behavior by design?

danroth27 avatar May 10 '18 16:05 danroth27

and currently 'int' is not accepted for 'double' parameter. I think we have an issue with inheritance of types ?

hungdluit avatar May 10 '18 16:05 hungdluit

Tracking this with https://github.com/aspnet/AspNetCore/issues/8581

danroth27 avatar Mar 15 '19 23:03 danroth27