Overridding a universal app's textbox enter style - windows-10-universal

I'm trying to create a universal Windows 10 app.
I have this textbox, that should be invisible. The user must simply be able to enter text at the point.
The only thing I have done is set the background equal to the app's background and no border.
The result is ok, but when I enter the textbox, it becomes white, like a normal textbox.
Anyone who knows how to fix this. I want the textbox to remain the same.
Thanks in advance
Kind regards

You have to create a new Style for your textbox. It will overwrite the default template and behaviour or the default TextBox. Here is the default template: https://msdn.microsoft.com/en-us/library/windows/apps/mt299154.aspx
And here is code sample: https://stackoverflow.com/a/24432861/1279342

Related

DropDownStyle set to DropDownList looks disabled but isn't?

It seems that the Windows 10 style of Combobox looks disabled when I change it's DropDownStyle to DropDownList.
On the left is the Combobox before any user interaction. On the right is when a user clicks on it to open it.
Now, I don't like changing default design to something the user might not expect but to me the default design makes it look disabled and might confuse the user.
I've tried setting the control's BackColor to white but there was no change.
I want the behavior of DropDownList where the user can only pick from the options available and not write in a new option but the look of DropDown (a plain white background).
You can change the FlatStyle property and check which style is more desired.
It seems the Flat style is the style you are looking for. (based on your comment)
Flat: The control appears flat.
Popup: A control appears flat until the mouse pointer moves over it, at which point it appears three-dimensional.
Standard: The control appears three-dimensional.
System: The appearance of the control is determined by the user's operating system.
Also in the worst case you can set DrawMode to be owner draw and draw combo box yourself using DrawItem and MeasureItem events.

TextBox doesnt allow user to type

Hello everyone what I'm trying is in wpf to make that user cant type in textbox. I know there is way just to make it isEnabled = False but if i use it my textbox gets grey color and i cant make it without background! So is there anyway to forbid user entering any char in textbox or any other way? Please help
Use the TextBox.IsReadOnly property: http://msdn.microsoft.com/en-us/library/ms753374.aspx
Did you want to dynamically change when the textbox is editable or is it always going to be un-editable? You might consider using a label instead if this is the case. If its dynamic you probably want the backcolor to change to let the user know this is the case.

How to get an existing property from style

I'm developing a WPF project where I need to validate textboxes on code-behind and then change the border color of those textboxes to some unknown color defined by the user configuration; the problem is that to overwrite the MouseOver effect I would need to set the value from XAML directly via ControlTemplate or Style.
Is there a way to get the current value assigned to the TextBox from XAML? Maybe binding it to itself?
I will appreciate any help you can give.
When validating a TextBox, or any control for that matter, it's common to use an adorner to display the validation error (in your case, setting the border color). You can have a look at an example here.
Using this method, you don't actually change the TextBox's border, but create a new visual layer on top of the TextBox that draws the new border around it. This is pretty much the way validations should be done in WPF, and it also solves your problem of having to deal with changing the TextBox's border value back and forth.

Labeled text box

i am trying to write a control template where i want a label for text box on top of the textbox. So i invite your suggestions for how to achieve this.
so far i did that using a stack pannel with vertical orientation and then added textblock and text box. Like wise i created 45 stackpannels. So i dont want to go like that. instaed i want to write a control template where i can have label and text box and then set label value and text box value.
my:CustomControl labelText="First Name:" TextBoxText="john Doe" />
any ideas are greatly appreciated.
Thanks.
You can make a UserControl with DependencyProperties for Text and Label, put your StackPanel in it, and bind the label and textbox to the dependency properties.
Make sure the Text property has FrameworkPropertyMetadata.BindsTwoWayByDefault
Have a look at the Silverlight Toolkit
It includes both HeaderedContentControl and DataField controls. The DataField is mainly for use with DataForm, but as far as I know, you can use it any way you like. The HeaderedContentControl I haven't tried myself, but it could be just what you are looking for.

windows forms: textbox with history

does anyone know about a windows forms control that acts like the address bar of a browser?
it is just like a textbox, but to the right there is a dropdown menu that shows the history of previously entered text.
thanks a lot!
Look at properties "AutoCompleteCustomSource", "AutoCompleteMode" and "AutoCompletesource" on TextBox class.
You can use a ComboBox for this. Just add the previous entries to the item list. If what you actually want is AutoComplete, the WinForms TextBox control supports that natively.

Resources