I am very new to WPF in C# and I am stuck working on an application made to (among other things) calculate the total number of items on a list. I want to print a label with that number/the sum and in tutorials I have seen people call labelname.Text in their source code, but when I try to do the same I don't have that option.
It is in Danish, but what I need is the sum of "Antal" from the table printed on a label next to "Samlet antal varer:" to the right of the table.
My DataGrid:
<DataGrid ColumnWidth="*" CanUserAddRows="False" x:Name="StockList" Margin="57,23,453,261">
<!--Column Header Text & Bindings -->
<DataGrid.Columns>
<DataGridTextColumn Header="Vare" Binding="{Binding vare}" Width="auto"/>
<DataGridTextColumn Header="Pris" Binding="{Binding pris}" Width="50"/>
<DataGridTextColumn Header="Antal" Binding="{Binding antal}" Width="50"/>
<DataGridTextColumn Header="Samlet pris" Binding="{Binding samletPris}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
My Labels:
<!-- labels -->
<Label x:Name="lblSamletVarer" HorizontalAlignment="Left" Margin="637,142,0,0" VerticalAlignment="Top"/>
<Label x:Name="lblSamletPrisEkskl" HorizontalAlignment="Left" Margin="637,192,0,0" VerticalAlignment="Top"/>
<Label x:Name="lblSamletPrisInkl" HorizontalAlignment="Left" Margin="637,242,0,0" VerticalAlignment="Top"/>
I hope it all makes sense. Please reach out if you need more information in order to help.