How can I make a Windows Phone textblock lost focus? - windows-phone

As you know we can use method this.textblock1.focus() to get focus, but if I want to make textblock lost focus, is there any method exists?

Give focus to some other control.

textblock1.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

Related

Disable on-screen keyboard in certain textbox using WndProc

My app has a textbox.
At the mouse up even, the Windows on-screen keyboard is displayed.
I do not want to generally disable the on-screenkeyboard.
I would only like to disable this behaviour for this specific textbox.
How could I do this?
Thank you.

Disable navigation on FlipView

I would like to disable all navigation on my FlipView (scrolling horizontally) from user's input (e.g. mouse wheel and touch screen).
The only way the flipview is supposed to change its selected index is programatically, I have already removed the side buttons in the FlipView's style.
I tried changing some of the ScrollViewer's properties in its style but I can't manage to block everything. Anybody can hint me the correct and clean way to do this?
I found the solution by overriding the ControlTemplate and changing ManipulationMode in ItemsPresenter. Just place this code inside your FlipView:
<FlipView.Template>
<ControlTemplate>
<ItemsPresenter ManipulationMode="None"></ItemsPresenter>
</ControlTemplate>
</FlipView.Template>
In my opinion it shouldn't be that difficult to do something simple like disabling user interaction. There should be a property to do that.
You can set IsEnabled property of the FlipView to False.
Hope this help!

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

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.

Detecting a scroll event in GridView (Windows 8)

How do we detect a scrolling event in GridView (like ViewChanged on ScrollViewer) on somethig like the default GridView template sample app? I'd like to replicate the effect that the netflix App does on the left red strip.
I tried putting the GridView inside a scrollviewer, but I've been unsuccessful at stretching it to fill the screen for different resolutions.
Update: I intend to use this with VariableGrid control that's on NuGet - though it's not an official control, it inherits GridView
The best way to do this seems that you can read through the components of the control, and assign events to it. based on what's happening in this example
http://mikaelkoskinen.net/post/WinRT-XAML-Automatically-Scrolling-ListView-to-Bottom-and-Detecting-When-ListView-is-Scrolled.aspx
I grabbed access to the scrollbar, suing the VisualTreeExtensions and I could capture the event Scroll, just like in the example. I had to read the children when the Loaded event of the grid was fired.
There is a simpler way.
Edit a template of the GridView, and look inside the XAML to find a ScrollViewer which is a component of the GridView.
The ScrollViewer has a ViewChanged event that you can subscribe to. Now whenever the GridView is scrolled, this event will be fired.
Try ManipulationCompleted and PointerReleased events on GridView. This is just using keyboard mouse..

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?