I have a grid inside a stack panel.
On the grid I will place several different textboxes that will show positional values that the boxes are databound from my database.
I will want to have buttons to increment/decrement by small, medium, large, etc. amounts.
This is a touchscreen display so I want the user to touch the textbox (or whatever control I should use) and then with it "selected" I want the user to be able to touch one of the several increment/decrement buttons.
The increment/decrement buttons using relay commands need to take the value of the selected textbox(or what control I should use) and then increment/decrement it.
As a note, I will need to be able to know whether and what has changed so I can allow the user to save the changes if they want. I'll need to be able to know what was changed so I can update the database with the new values.
I'm using MVVM with WPF and am stuck as I'm new to WPF.
What I have tried:
Below is my RelayCommand. There are a couple things I've tried and commented out because they didn't work. I did hard code a value of one of the textboxes I created just to make sure, as a start, that I could increment by +5 and it would update properly. This is working. I have no idea how to "pass" that property/value to the RelayCommand.
public RelayCommand cmdIncrementSmall { get; private set; }
public void doIncrementSmall(object? o)
{
_LeverHeightLeft += 5;
}
Below is the StackPanel that I've created with the textbox and button as a start to begin testing. Once I have it figured out I can add the other textboxes (or whatever control I should use) and the other increment/decrement buttons.
<stackpanel x:name="ExercisePositionSetter" margin="1255,3,0,0" height="2017" background="Teal">
<grid>
<grid.columndefinitions>
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="160">
<columndefinition width="*">
<grid.rowdefinitions>
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="125">
<rowdefinition height="135">
<textblock grid.column="0" grid.row="1" horizontalalignment="Center" verticalalignment="Bottom" fontsize="42" fontweight="SemiBold" textalignment="Center">
Lever <linebreak>
Height
<textbox x:name="LeverHeightLeft" grid.column="0" grid.row="2" horizontalalignment="Center" verticalalignment="Bottom" fontsize="42" fontweight="SemiBold" textalignment="Center"
text="{Binding Path =_LeverHeightLeft}" width="125" isreadonly="True">