I am following the master/detail example and I am a bit confused about @bind-Value="@order"
. In the example, order is dynamic. Why is that? We know the type is Order.
Furthermore, if I try and just create Order selectedOrder
and value bind that, it wont event compile:
Render Code:
__builder.AddAttribute(231, "ValueChanged", new System.Action<System.Object>(__value => basicSelectedWorker = __value));
Error:
Cannot implicitly convert type 'object' to 'Order'. An explicit conversion exists (are you missing a cast?)
I was able to get my code to work like so:
Order _order;
object order
{
get
{
return _order;
}
set
{
if (_order!= value)
{
_order= (Order)value;
StateHasChanged();
}
}
}
This is obviously pretty ugly, plus, I have to use _order in the detail view everywhere once I do this. Is there a better way? DataGrid knows the TItem
, why is there so much boilerplate?