relacad
Topic Author
Posts: 14
Joined: 28 May 2025, 18:22

TextBox: How to Capture Inputs from Users

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!
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: TextBox: How to Capture Inputs from Users

09 Jul 2025, 13:22

1) This is an integration issue right? Not a studio thing. Is your view correctly injecting KeyDown/Char/KeyUp events? Does the XAML work correctly in XamlPlayer

2) We are having a look at this right now
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: TextBox: How to Capture Inputs from Users

10 Jul 2025, 12:11

Ticket #4291 created for 2)
 
relacad
Topic Author
Posts: 14
Joined: 28 May 2025, 18:22

Re: TextBox: How to Capture Inputs from Users

10 Jul 2025, 22:22

Hey Jsantos,

1) I suspect you're right. This is all within play mode inside of studio. The textboxes work properly when I test them in isolation in xamltoy, so I'm thinking there must be something I need to do to preview/test the behaviour in studio before integrating in Unity. I was hoping to test my data-binding for user inputs in studio before trying to build it in Unity. I discovered I was able to select then copy & paste into the search bar, so that will work for testing the binding, but while running in play mode in studio, the textbox isn't capturing/displaying character inputs when selected. I'm guessing that's by design or that I need to enable/create some kind of injection handling in studio if I want to test it there?

2) Thanks! I appreciate it!
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: TextBox: How to Capture Inputs from Users

13 Jul 2025, 21:31

1) This seems to be a bug in Studio. Could you please attach a minimal XAML reproducing the issue?
 
relacad
Topic Author
Posts: 14
Joined: 28 May 2025, 18:22

Re: TextBox: How to Capture Inputs from Users

14 Jul 2025, 20:02

1) This seems to be a bug in Studio. Could you please attach a minimal XAML reproducing the issue?
Sure, please find the project as, which contains Page0.xaml, which is not capturing character inputs, but is capturing copy & paste, on Version 0.1.227 beta
TextBoxTest.zip
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: TextBox: How to Capture Inputs from Users

15 Jul 2025, 13:09

We already fixed (1) for the next version. Thanks for your feedback!
 
relacad
Topic Author
Posts: 14
Joined: 28 May 2025, 18:22

Re: TextBox: How to Capture Inputs from Users

15 Jul 2025, 21:09

We already fixed (1) for the next version. Thanks for your feedback!
Awesome! Can't wait for the next version :-) I'll marked it solved.

Who is online

Users browsing this forum: No registered users and 5 guests