Add "X" button at the end of a TextBox - xaml

My question is the opposite of this one (Remove "X" button at the end of a TextBox).
I have a vanilla TextBox (with TextWrapping set to NoWrap), but I'm not seeing the clear cross delete button.
This is a store/universal/winrt app, so it's a Windows.UI.Xaml.Controls.TextBox.
I haven't got any overrides for the default template in App.xaml either.
Any ideas?

If you can afford it, you can use Telerik UI for Windows Phone. It has a textbox control with a built in clear button.
Other route would be implementing your own user control. It should be rather easy.

Related

Set backgroundcolor of every form in vb.net

How can I set the BackColor of every form that exists in my vb.net (fw 4.7.2) project?
And yes, I could do
Form1.BackColor = ...
Form2.BackColor = ...
......
but that would be too messy then.
Open one of your forms in the designer, any form, doesn't matter
Click the form background
In the property grid, at the top, go to (Application Settings) then click the dots button in (Property Binding), find BackColor in the list of proeprties, click the dropdown next to it and click New at the bottom
Call your setting ThemeColor, pick the color you want for the light theme, such as White
OK everything
Open the designer for another form, go Application Settings/Property Binding again. This time don't click New, just bind BackColor to the existing ThemeColor setting
Repeat for all forms in your app
Add a button to the "Settings" form (or wherever you want to offer a toggle for the theme), and in its click handler write:
My.Settings.ThemeColor = Color.White
Add another button to the form, make its click handler set Color.Black
Run the application. Open one or more forms, including the settings form. Click one of the buttons to change the setting. All forms change color
You could:
For Each f as Form in Application.OpenForms
f.BackColor = Color.Red
Next f
at any point after you've opened a boatload of forms
.. or you'd just set the back color in the designer if you were designing a form and you wanted every form instance of that form that you created be red as soon as it was shown
I would have said you could create a class:
Public Class ColoredForm
Inherits Form
Public Sub New()
Me.BackColor = Color.Red
End Sub
End Class
And then in every form you add, open the designer and change the code so that it Inherits this form instead; but it's messing with the designer files (not everyone wants to do it, and changes could be lost if they were regenerated) and isn't actually any different to just.. setting the back color in the designer property grid. If you have some more involved behavior you want all your forms to adopt then consider an inheritance, but if it's as trivial as setting the BackColor, just do it in each form as a design time thing (If you have a lot of forms, can use find/replace for it)

Triggering Visual Basic Keydown events without a specific function

I'm building on top of code that a previous developer has left me, and he left something that intrigued me quite a bit.
Basically on his menus, he has a TextBox to take in user input and a button next to it to submit the value of the TextBox (for example if the user wanted to select option 1, he would input 1 into the TextBox and click the button). However, the user could also press the Enter key while focusing the TextBox, and it would be treated as the submit button was clicked.
Now this is simple enough to do, but when I check the VB code behind the menu, there's no TextBox_Keydown(...) Handles TextBox.Keydown function anywhere, only the button click event. How is he doing this? He has several menus that are similar and I can't figure out how.
A standard dialog box, if not told to act otherwise, enter does default command button and escape does cancel. In VB look at the properties Default for the command button.
I discovered how he was doing it. He basically mapped the AcceptButton and CancelButton properties of the entire Windows Form to various button functions.

Checkbox with image and autosize

In Word 2012 I have seen the following checkbox:
I am wondering if this checkbox is a .NET control with an image assigned to it (with property "imagealign" being middle right) or if this is a custom solution by MS for their Office GUIs.
I can reproduce the appearance, but I am unable to easily check if the user clicks the checkbox (and wants to change its state) or the info button and wants to show the tooltip.
Also, I have to add some spaces at the end of the checkbox text, else the image is under the text if the checkbox autosize property is set to True.
I would tend to think that the checkbox is a custom solution by MS or perhaps the image is a separate control.
Does anybody know more about this?
I think you are looking for
Checkbox.AutoSize = False
CheckBox.Image = "Your Image"
CheckBox.ImageAlign = MiddleRight
But this way you won't be able to distinguish if the user clicks the checkbox or the info button to show the tooltip.
As far as I know, there is no control available at .NET which allows this behavior, so I suppose they are using separate controls.
I think you'll need to use a PictureBox near the CheckBox and then use CheckBox_CheckedChanged and PictureBox_Click events to do whatever you want on each case.

vb.net How to make a DropDownList with readonly appearance

I am developing desktop application using vb.net and vs2008.
I have a DropDownList that I don't want it interact with use when the info is locked.
But if I disable it, it is greyed out and the text is not easy to read.
Is there any way to make radiobutton like readonly textbox?
I want text of the DropDownList looks black and itself is not clickable.
The above shows a disabled DropDownList with greyed out text and a readonly textbox
Try this:
Enable="false"
Place it within your <asp:DropDownList> tag.
I recently encountered a similar issue. My solution was to remove all other values of the DropDownList except the one that is selected. This will keep the text as black as opposed to grey. Users will be able see the existing value and click it but will not be able to change it.
Hope this helps.
No, you can't use CSS in a desktop app. When you disable the dropdownlist by setting Disabled=true; or Enabled=false (whatever the case is), you can also change the Font properties to make it easier to read. You can set other properties such as Border, BorderStyle, etc, etc.
Keep the control enabled. In the GOTFOCUS event, use SENDKEYS to send a {tab} to the form. the user will not be able to change it! By the way, workt for ALL controls, that a user can focus.

Form for Telerik RadRibbonBar?

I got the Telerik RadRibbonBar for free with the Express edition of vb a while back, but it did not come with any sort of form. It also, unfortunately, has the control buttons there automatically. How would I create a form which is resizable, and works like a standard winform, but doesn't have the top bar?
I tried:
FormBorderStyle = Sizable
Text = Nothing
ControlBox = False
Unfortunately, when you maximize the window, it goes in front of the taskbar...and it has an ugly border when it isn't maximized.
How can I:
Change border color?
Make it so it does not go in front of the taskbar?
Thanks for the help! I'm surprised there is not some sort of form already made for this.
Telerik comes with a "Telerik.WinControls.UI.RadRibbonForm"
You have to add a RadRibbonForm Instead of a Standar Form.