C#C
C#2y ago
47 replies
remi.nz

✅ Help with Data Bindings

So, now I'm trying to create a Task Manager clone, just the graphs part for now. So, I have a UserControl called Graph.xaml which is basically a graph and a text box. Then I have a Home.xaml which is my View and then HomeVM which is obviously my ViewModel. Now, I have an issue. In my Graph.xaml I've created a Binding called GraphData and then through Home.xaml I'm trying to define that GraphData so that my User Control remains re-usable and I use it for other graphs too.

Home.xaml
    <userControls:Graph x:Name="CPU_Graph" GraphData="{Binding GraphDataCPU}" />

and in my Graph.xaml, I've put it like this
            <lvc:CartesianChart Series="{Binding GraphData}" LegendLocation="None" Height="250" Width="500" Hoverable="False">


but when I debug the program, it says that Graph.xaml is looking for "GraphData" in HomeVM and it's unable to find it, but instead it should look for "GraphDataCPU" as defined in Home.xaml, why is it not working?
Was this page helpful?