TextBox: How to Capture Inputs from Users
Posted: 07 Jul 2025, 19:52
Hey again! I'm trying to capture User Inputs for an inventory search (typing into a search field), and started by setting up a Textbox for that, but I'm running into some challenges getting it off the ground.
1) I can't seem to capture any keyboard inputs into the textbox. Even with the unmodified stock textbox it won't capture and display the input characters like we see in the examples here: https://www.noesisengine.com/xamltoy/09 ... dbdef89f8c. I even copied this textbox in to test, and it didn't work.
Once I can figure out how to get the inputs to register and display, my goal is to have the search work for my inventory items: I would make a string property for "SearchTextInput" on the my viewmodel and then I would create a two-way binding for the text property of the textbox, with a propertychanged update parameter so that each time the user changes what's typed in the textbox, it would update the data for SearchTextInput so that I can access that for logic to apply to the inventory listbox, etc.
2) When I try to customize the textbox by creating a new template, the default template unfortunately loses the display of the placeholder text and I can't seem to find where it is being bound under the hood as there is only the one textblock inside the content presenter.
Any input on how to resolve these two steps would be great!
1) I can't seem to capture any keyboard inputs into the textbox. Even with the unmodified stock textbox it won't capture and display the input characters like we see in the examples here: https://www.noesisengine.com/xamltoy/09 ... dbdef89f8c. I even copied this textbox in to test, and it didn't work.
Once I can figure out how to get the inputs to register and display, my goal is to have the search work for my inventory items: I would make a string property for "SearchTextInput" on the my viewmodel and then I would create a two-way binding for the text property of the textbox, with a propertychanged update parameter so that each time the user changes what's typed in the textbox, it would update the data for SearchTextInput so that I can access that for logic to apply to the inventory listbox, etc.
2) When I try to customize the textbox by creating a new template, the default template unfortunately loses the display of the placeholder text and I can't seem to find where it is being bound under the hood as there is only the one textblock inside the content presenter.
Any input on how to resolve these two steps would be great!