C
C#2y ago
friedice

❔ Data-binding multiple components Blazor

So let's say I have 3 components. Component C is a child of component B, and component B is a child of component A. Is it possible 2-way bind Component C and component A so that when a parameter value of Component C is updated, Component A's value will also get updated?
2 Replies
friedice
friedice2y ago
I tried cascading value, but Component A's value wasn't being updated until I manually call StateHasChanged()
\\Component C
<Component D
@bind-SelectedItems=SelectedItems/>

@code
{
[CascadingParameter]
public List<stuff> Selecteditems {get;set;}
}
\\Component B
<Component C />

\\Component A
<CascadingValue Name=SelectedItems Value=Data.SelectedItems>
<Component B/>
</CascadingValue>

@code
{
public class Data
{
public List<stuff> SelectedItems {get;set;}
}
}
\\Component C
<Component D
@bind-SelectedItems=SelectedItems/>

@code
{
[CascadingParameter]
public List<stuff> Selecteditems {get;set;}
}
\\Component B
<Component C />

\\Component A
<CascadingValue Name=SelectedItems Value=Data.SelectedItems>
<Component B/>
</CascadingValue>

@code
{
public class Data
{
public List<stuff> SelectedItems {get;set;}
}
}
something like this is what i have do I have to post on stackoverflow when
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ Enumerating Running ProcessesI am missing something, besides brain cells but what should I be returning if I want a ComboBox to h❔ Error adding new model in EF CoreI'm trying to add a new model "Tickets" in my ASP.NET Core web API. After trying to update the datab❔ Error message when trying to move direction for my tiles in a N-puzzleHi! I get this error message when trying to move around my tiles in my N puzzle "System.IndexOutOfRa❔ I should develop an app for windows and macos but i don't know how to do thisHello, today i started my first internship, but in my company i m the only dev and as a project i ha❔ any way to add panel to winforms net core?I am beginner and I was wondering if there was a way to add panel to net core project, cause it is n❔ Copying code from youtube and it doesn't work for meI'm new to the C# scripts and i am trying to make a board game, while trying to understand how to do❔ Error while trying to connect to MySql using MySql .Data**While trying to connect to maria db using mysql.data i get this error: ** > `Unhandled task excep❔ ✅ 'ConsoleColor' does not contain a definition for 'DrawingColor'I am experimenting a sample code to create a colourful UI on console, and am getting this error: ```❔ WinUI exe launch issueI receive this following issue every time from event viewer when I try to start the application via ✅ Logging incoming HTTP requests with WebApplicationI've got a route in my app that isn't being triggered properly. I can't currently figure out what's