I work with a custom TextBox
in a winform project, I added this property in my custom TextBox
:
private TextBox _nextControl;
public TextBox NextControl
{
set { _nextControl=value; }
get { return _nextControl; }
}
and I got this result for a form with 2 TextBox
(textBox1 and textBox2) in my custom TextBox
properties with the property NextControl
; I can see all TextBox
es in the form:
In this case the property NextControl
will show all TextBox
in my form to select my next control.
But when I want to do the same in my new WPF costum TextBox
I got this with the same condition(2 TextBox
es, textBox1 and textBox2):
Why I don't have the same result? And how to do this in my WPF project?
Update:
For more explanation, in my winform project I use the property NextControl
to select the next control from the UI properties.
protected override void OnKeyDown(KeyEventArgs e)
{
if(e.KeyCode==Keys.Down)
// select the next TextBox chosen in this TextBox option
_nextControl.Select();
}
Because I can already choose the name of the next TextBox
in UI, I don't want to do this with extra code.
But this not work in WPF: I can't see the names of my TextBox
es in my window for the property NextControl
(automatically in winform if I choose the type of property = TextBox
).
p.s.: My custom TextBox
inherited from System.Windows.Controls.TextBox
.
Update:
I uploded a winform project with the custom TextBox
[here] of a sample project for what I want a WPF can behaves the same.
I've updated the link of this sample.