I have a WPF window that contains a datagrid and a bunch of TextBox's that should allow the user to edit the data of the selected row. These fields are loaded with the row data from the datagrid in question by code in the Code Behind file.
However, None of the TextBox controls will allow me to even get the cursor into them, it is as if they are disabled, but they are not. I have tried all sorts of things to let me access these.
They are simply placed into individual cells of a grid, so no problems like being hidden by a Textblock etc as can happen in a Datagrid. I have added various Event checks, and these controls do receive Mouseover, MouseDown, Initialized, but do NOT receive KeyDown, GotFocus etc, which are the ones I want them to accept to allow me to edit them.
This is supposed to be the default setting for these Controls ?? but not in my case here.
Here is the XAML for just one of them I have used to test what is going on:
<TextBox x:Name="CustnonoEdit"
Grid.Row="3"
Grid.Column="2"
Margin="1"
Height="25"
IsEnabled="True"
IsReadOnly="False"
KeyDown="CustnonoEdit_KeyDown"
Background="{StaticResource Gray3}"
Foreground="{StaticResource Black0}"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Visibility="Visible"
Text="{Binding CustNo, UpdateSourceTrigger=LostFocus, Mode=TwoWay}" IsEnabledChanged="CustnonoEdit_IsEnabledChanged"
GotFocus="CustnonoEdit_GotFocus"
MouseMove="CustnonoEdit_MouseMove"
PreviewMouseDown="CustnonoEdit_PreviewMouseDown"/>
It is driving me Mad, can anyone tell me how to make these editable please ?
What I have tried:
Endless tests, see above to try to identify what they do respond to, including testing for IsEnablechanged, but it does not get hit.
See above for info on tests made, and I have searched the web, but mostly, people ask how to DISABLE them, not get the ENABLED as I am trying to do.