How to create a display mode and edit mode in a Metro App? - windows-8

What is the best approach to change TextBlocks to TextBoxes after clicking on Edit button for a Windows 8 Store App? This is something similar to an iOS app that after clicking on an Edit button editable fields become TextBoxes and you can then change data.

You don't need to use TextBlock just use TextBox with IsReadOnly property.
on button click mark the IsReadOnly="True"

I think you want the IsReadOnly property. IsReadOnly=true; when you don't want to let them edit the textbox, IsReadOnly=false; when you want to let them edit it.

Related

OSX: Move keyboard focus between textfields and buttons using tab key

I am trying to toggle between textfields and buttons on my view using keyboard's tab button. The switching between textfields work but it does not switch between buttons. The view is shown as below.I did not find enough resources online to proceed further. Does anyone know how to resolve this?
There is nothing you can do with that issue.
It turns out that in the System Preferences > Keyboard > Shortcuts there is a checkbox, where you can change behaviour of the whole system:
To move keyboard focus only between text boxes and lists
To move keyboard between any of controls
And by default first checkbox is pressed.
As an addition. By default, NSWindow assigns an initial first responder and constructs a key view loop with the objects it finds. You can also change key view loop by calling this method: setNextKeyView.
For example,
[firstTextBox setNextKeyView:secondTextBox];
[secondTextBox setNextKeyView:secondButton];
[secondButton setNextKeyView:firstButton];
[firstButton setNextKeyView:firstTextBox];
This means that for users who expect moving control focus through all controls, this will work. And for those who have disabled this feature in settings, this won't work.
You can right-click on text field, drag "nextKeyView" and drop on another text field that you want to focus next when user press tab. Look like my picture below:
To add to #mjonka's answer, To move focus between controls is dependent on user's keyboard-shortcuts settings. What could be alternate solution is to just selecting your desired action button in your xib file and setting "Key Equivalent" value field to "enter" key in Attributes inspector as shown below. Same thing can be done for cancel button by setting "Key Equivalent" value to "Esc" key.

Change Foreground of ReadOnly TextBox

In my Windows Phone App I want to have a TextBox which must be readOnly, but this makes its Foreground color look grayish, I want the Foreground color to be black, Is that possible?
Or how else can I have a textblock with black font, but not editable by the user?
You can change the Style of your TextBox for the disabled state.
To achieve this more easily, you can open your .xaml document in Expression Blend, Right Click in your TextBox -> Edit Template... -> Edit a Copy.
Then you choose the name you want for your Style.
After that search for the States Tab, and click it. After that choose the disabled state.
Then you can edit the TextBox to be whatever you like for the disabled state.
Also you can just set TextBox Style to null, and set Foreground as usual.

nextKeyView is not working

I have developed an application, which has one tableview and 4 textfields.
When I run the app, the control is not going orderwise by giving TAB. For that I set initialResponder as tableView, then connected tableview's nextKeyView to textfield, correspondingly I had given connection for rest of the fields. But still the control is not going orderwise.
What is the problem? Did I missed something? Or is there is other way to do it?
Do you have System Preferences > Keyboard > Shortcuts > Full Keyboard Access set to "All controls"? If it is set to "Text boxes and lists only" then tabbing may not move focus between your controls.
Make sure the window's Auto Recalculates View Loop is unchecked in the inspector.
Then play with ctrl+F7, which toggles how the tab key works system wide. One mode tabs from text field to text field, the other tabs to all controls.

How to create toggle buttons in Windows 8?

I need to create a group of 5 buttons. Only one can be pressed, like Radio Button, but I do not want to show the circle. I would like to use the button look.
Somebody do know which is the best way to do it?
I have found for WPF:
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" />
but it does not work for Windows 8.
Thank you
Is this a group of actual buttons with an action assigned to the click event of each, or are you just trying to remove the circle form a RadioButton type control?
Please note that the user will likely expect a RadioButton control to look and feel like a RadioButton. Changing this just for the sake of it may not be a good idea, but if you want to go ahead with it you could try one of the following options.
1) Edit the template for a radiobutton control to hide the selcetion circle. (I don't know if that's even possible in all honesty, but in theory, it should be)
or
2) Emulate the behaviour with a ListView with SelctionMode set to "Single"
Things get a little more complicated if you want to handle click events on each "button", but it is not impossible. In your ItemTemplate, add a button (presumable with a style of "TextButtonStyle") and set the event handler of the Click event to check which button was pressed and act accordingly.
There is a control called ToggleButton, why don't you use that?

Glossy Button in VB.Net?

How to make glossy button in Vb.Net?
or
how change button background on mouseover?
If you are using WinForms, you usually achieve this by creating a new class inheriting from System.Windows.Forms.ButtonBase.
From there, overwrite OnMouseEnter, OnMouseLeave, and OnPaint to draw a button to your specifications.
hope my reply helps you
Select the button
Go to its properties and change the button style to FLAT
In the same property widow now select FLAT SETTINGS
And you can see color to appear when clicked or hover on it...