How to style a PhoneTextBox in windows phone 8? - xaml

I need to style a PhoneTextBox ("clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit")
<toolkit:PhoneTextBox x:Name="txtName" InputScope="Text" PlaceholderText="name"/>
I am using PlaceHolderText instead of Hint property. I was able to find default styles for applied for Hint. But not for PlaceholderText. Please guide me.

PhoneTextBox doesn't have PlaceholderText property. It exists on TextBox for Windows Runtime. The similar property for PhoneTextBox is Hint, which I currently suggest you to use.
If you need to style\template PhoneTextBox control, you can always find original style in Windows Phone Toolkit source code (Generic.xaml).

Related

How many kinds of built-in VisualState are there in UWP?

For me, the known VisualStates are:
Pressed
Focused
UnFocused
PointerOver
but I want to know all the built-in VisualStates, and I have searched for a long time and still can't find the relevant information, does anyone know where I can find such information?
How many kinds of built-in VisualState are there in UWP?
It's different with Xamarin Visual State Manager defines one visual state group named "CommonStates" with the following visual states:
"Normal"
"Disabled"
"Focused"
"Selected".
In UWP platform, it does not contain such default state. it is useful because such a VisualState will use whatever values are present in the default template. Each attribute should specify the state's x:Name attribute, which is the stateName value a control consumer would pass in a GoToState call to use that visual state. For more detail please refer to official document.

Windows 8.1 Universal DatePicker styling

I am struggling to find a way to style the appearance of the Windows 8.1 Universal DatePicker. I would like to remove the borders of the input control (except the bottom border).
With a combobox or textbox setting the BorderThickness = "0 0 0 1" achieves the desired effect. This however doesn't make any impact on the datepicker.
Does this need to be done through the use of Control Templates and if so, where can one find reference to which properties can be changed to achieve the desired effect? Or is there a simpler way of getting it done?
Thanks in advance.
I came right by doing the following:
Started new project (blank universal 8.1)
Added DatePicker control to a form.
Extracted the template by 'Edit Template' & 'Edit a copy'
The template is then added to the app.xaml
Edit the styling as needed there.
The styling I needed was done on the FlyoutButton BorderThickness="0 0 0 1"

VB control styles change for unknown reason and cannot change back

For some reason while I program in Microsoft Visual Basic 2010 Express OR VS Express for Desktop my controls seem to change style for an unknown reason.
This screenshot is in the DESIGN part of my programming:
And here is when I actually run the program:
I don't understand how it can change like that, I've tried changed properties on all the controls, but they just keep changing to whatever style that is...
I can update with more screenshots if need be.
Thanks
Answer given via a comment:
Using Application.EnableVisualStyles() Fixes the whole thing.
Thanks to #Plutonix for the answer!

Looking for a simple rich-text editor usable from VBA

I'd like to allow my users to enter rich text (with bold, italic & underline, but probably nothing more than that) in an entry box on a VBA userform.
I don't want the user to have to install anything, so I need this to be something that leverages what Office or Windows already provide. The obvious candidate is the Windows built-in Rich Edit control.
I did a quick test and verified that I could create a window of this type from VBA, but what it then lacks is all the UI, etc. I could really use a leg-up as to how I then turn this into something usable.
I'm happy to consider alternative controls, so long as they're guaranteed to require no installation (other than as part of the Excel file containing the rest of my VBA code). It needs to work on Windows XP and up, and Office 2003 and up.
You could just try making a simple UI yourself. Add a command button to the form that will bold the selected text in the rich edit control. Or add a command button that will italicize or copy or paste. Your imagination is your limit.
I was checking Rich Edit Version 1.0 in Excel 2010, and I could access the text in the control.
For anyone searching for this still. As Gary McGill stated, "Microsoft InkEdit Control" is your best option.
Use the link below for a reference on the variables it can use:
https://www.thevbprogrammer.com/Ch10/10-06-RichTextBox.htm
With the Toolbox window open in Excel's Visual Basic editor, select Tools->Additional Controls from the menu. Check the box next to MSREdit Class. This will add the rich text control to your toolbox. From there you can add it to a UserForm.
I tested this control in both Office 2003 on Windows XP and Office 2010 on Windows 7. It looks like you'll still need to provide the UI for allowing the user to toggle bold, italics and underline.
It does accept a paste (via Ctrl+V) of some rich text that I copied from Word, but I couldn't figure out how to make it switch font formating while typing text into the control.
Putting this here just to rule it out...
It seems that the "Microsoft InkEdit Control", which is available from "Additional Controls" on the toolbox, is a superset of the Rich Text Edit control (as the name suggests, it also supports Ink).
It's hard to tell whether this is widely installed - it is on my XP/2003 machine, but not on my 2K/2K machine. (I've seen it said that it's installed with Vista and Win7, but clearly there are earlier versions too).
Anyway, I'm ruling this out because using the control results in a message at runtime to the effect that the ActiveX control is "unsafe" (presumably related to the well-known issue with the Rich Text Control itself).

Problem with TabControl alignment in VB.NET

I'm having a weird behaviour with a left-aligned TabControl in VB.NET. Screenshot:
What I wanted was to have the tabs literally the same way they would be if rotated 90 degrees to the left.
Does it have something to do with the fact I'm not (god forbid) using the standard XP theme? Any solution to just make it work? (Even if it's hard, but I don't want a control that has a contrasting style, I want the program looking consistent)
Thanks!
Happy ending:
Ok, I solved the issue. If someone else has the same problem, use this control. It's free under MIT license. Screenshot by the author:
Note that the author made two controls. My advice: the second one has incorrect support for cleartype (It rotates after subpixel rendering), but it's easier to use, and has better padding control. Go for it! =)
EDIT
If you use C++ and need it for that, there's an approach. Picture of the result:
alt text http://www.codeguru.com/dbfiles/get_image.php?id=6385&lbl=CXPTABCTRL_GIF&ds=20040309
The author was very descriptive on how he did it, which is good, example:
(source: codeguru.com)
This is the link to the article.
Another very good approach is SkyBound's multi-purpose VisualStyles component. Seems that the binaries are free but the source is not, very fair deal. I'll check it out later, but if you need some visualstyles bug fixing, it seems like a choice.
(source: skybound.ca)
from the authors:
first and foremost, it quashes XP
theme bugs, silently, efficiently and
automatically. But it also provides a
simple set of classes which you can
use to draw your own controls using
the Windows XP Theme API.
Check this. and more from the author.
Problem solved!! =D
Yes, it is a bug in the visual styles renderer for the tab control. Looks like you already found a replacement. Another low-impact approach is to selectively disable visual styles for the control. It will revert back to battle-ship gray, correctly drawing vertical tabs. Tab page content will still render properly.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class FixedTabControl : TabControl {
[DllImportAttribute("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
protected override void OnHandleCreated(EventArgs e) {
SetWindowTheme(this.Handle, "", "");
base.OnHandleCreated(e);
}
}