I am a beginner with WPF. I fear this may sound like a silly question.
I have a listbox with two columns. Each listbox item contains a horizontal stacked panel which in turn contains textblocks.
The listbox is empty, with each listbox item being added by the end-user through a couple of textboxes placed elsewhere. The first column accepts strings, and the second column accepts only percentages.
(I have attached a relevant portion of the event sub where a user is adding new rows.)
I would like to be able to check every time the above event is fired that the column of percentages does not exceed 100%. I have a couple of labels below the listbox itself where I would like to show the running total and the remainder. However, how can I loop through the second column of percentages to show the running total and remainder?
I would appreciate any sort of guidance towards a solution on this. Thank you very much.
Private Sub btnAddItem_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnAddSplit.Click
Dim ListBoxItemName As New TextBlock
ListBoxItemName.Text = Name.Text
ListBoxItemName.Width = 170
Dim ListBoxItemValue As New TextBlock
ListBoxItemValue.Text = SplitValue.Text
ListBoxItemValue.Width = 70
Dim ListBoxStackPanel As New StackPanel
ListBoxStackPanel.Orientation = Orientation.Horizontal
Dim NewEntry As New ListBoxItem
NewEntry.Content = ListBoxStackPanel