Group Summary
The second page in the Adverse Impact calculator shows the current groups that have been added.

Challenges
A list of some challenges we faced with this page.
Deleting a specific group
.png)
The event triggered by deleting a group
One of the challenges we faced was deleting a specific group after it had been added to the grid containing the summary.
-
A group can be added with a specific row and column.
-
Example: Group A needs to be in row 4, column 5.
-
-
The initial plan was to store the positions of each group in a tuple containing (row X, column Y);
-
Later we could find that group again based on these coordinates.
​
However we soon learned that finding an element in a grid can't be done by searching a row and column. Once an element is added to a grid it becomes one of the children of that grid. This meant that:
-
The group would be child X in the grid.
-
Because we don't know how many groups the user will add, or has added, we don't know X.
-
So we couldn't use (4,5) to find the group again. And didn't know what child the group was.
​
We solved it by using the way we save groups data:
-
The groups are saved in a dictionary with their group name as their key.
-
When pressing a delete icon we can identify the index of the button that has been pressed by searching for that element.
-
Because the group name is always 3 children before the pressed delete Icon we can find X.
-
X = index delete button - 3
-
-
Now we can find the group name in child X and delete it from the dictionary.
-
We rebuild the grid with the current dictionary members.
Adding a group in the grid

The function adding a group to an existing grid
A group being added starts by getting the data from the dictionary that contains all the groups. The dictionary is defined as:
-
Key: <string>
-
Value: Tuple <string, double, double, bool>
-
Which can be read as:
-
Key: <group name>
-
Value: <group name, total, selection, is unknown>
-
​
In the XAML file the grid is already made. We start by preparing some variables and adding 2 new row definitions.
The first row will contain the group data. The second row will be used to paint a green line between the rows.
​
When adding a group, the user can select if the numbers are unknown. This is stored as the 4th value in the tuple with a boolean. If this value is true then the group total and group selection both get the text "unknown". Otherwise the known numbers are converted to strings and are then added.
​
A new delete icon gets created and gets stored in a stack layout. The reason this action is performed is because we noticed that the icon didn't behave as expected. Becoming larger and smaller than intended when changes were made to the view. By storing it in the stack layout the height and width behaves as expected.
​
Everything gets added to the grid in column 0, 1, 2 and 3. With "i" being the row number variable. When the group data has been added into the row, "i" is increased by 1. In the new row a box view gets added with a green background. This box view is then expanded to all 4 columns. The variable "i" is increased again for the next group data to be added.
​
​