I have 2 questions about Winphone 8 UI Control:
How to make textbox non-editable with a color not gray-color?
If I have scrollview, there are many textbox inside, when I set foreground for one of this, I want to scrolllview auto scroll to this position(that item is out of view) to visible this item? (like listview)
Thank you.
To make the textbox non-editable give the IsReadOnly property as true.
XAML:
<TextBox
IsReadOnly="True"
>
The user may not modify the contents of this TextBox.
</TextBox>
Related
I have a navigation menu that on a desktop browser uses a hover event that expands a collapsed menu. It works fine on Desktop.
The problem is that on the iPad it appears like the wrong menu item is tapped.
Steps to reproduce:
Put iPad in horizontal mode
Go to http://qaphppos.blastohosting.com/PHP-Point-Of-Sale/
username: admin
password: 12345678
Click Sales on the left side
Try to click any other item on the left side and you will see that your click doesn't translate to the right menu item.
Is this a bug in iOS 8 or is this something that I can even fix? I wouldn't mind if they had to tap twice (once to open menu and once to select); but I am not sure how to do this.
I think the problem is that you are setting focus with JavaScript on the textbox labelled “enter item name or scan”. So your first tap is losing focus for the textbox, and the second actually select the menu.
After entering sales:
Try tapping on a black space. You will see the textbox lose focus.
Try tapping on the menu items, they will work.
As Joe mentioned problem is in setting focus on the textbox labelled "enter item name or scan barcode".
But I wan't to mention that your textbox is not getting exact focus, it is looking like textbox is in focus but it's not, because if textbox is in full focus then device keypad should open automatically as soon as textbox gets focus.
I think css class for textbox focus is setting but textbox is not getting focus.
I want to add an icon and another textblock to my data template when the item in longListSelector is tapped. Also, when another item is tapped, I want to remove this icon and textblock from previously selected item and expand new selected item. How can I achieve that?
Options 1 (Modify it through Code-Behind)
You can modify my ListBox collapse code to do what you want : ListBox Collapse. You need to change the Border to a <Grid> then loop through the .Children to hide/show the extra textblock and icon. Always save the reference to the current SelectedItem so when the SelectionChanged event fires you can hide the previous selection and then show the newer Selected Item.
Option 2: Create An ItemControl you can use as part of the Item.DataTemplate of the LongListSelector
Using this method, you want to create your own VisualState (Selected, NotSelected.. or whatever you want).
In the Selected (StoryBoard) you change the extra Textblock/Icon's Visibility to Visible.
In the NotSelected (StoryBoard) you change the extra Textblock/Icon's Visibility to Collapse.
Then when the SelectionChanged Event on the LongListSelector, loop through your ItemSources and compare it to the SelectedItem.
If the current item is the SelectedItem then VisualStateManager.GoToState(your_control, "Selected") else VisualStateManager.GoToState(your_control, "NotSelected")
This will complete the whole interaction that you want.
I have a stackpanel a TextBlock. When i tap on it,I want to display a couple of text boxes right below TextBlock and within the stack panel. And when I tap on TextBlock again the textboxes should not be visible. How can I accompalish this by just using XAML?
By just using XAML and nothing else, you can't. You have to have either a code behind or a view model bound to the page.
Add all textboxes to the StackPanel and set their Visibility to Collapsed. Also give each one a name using the x:Name property. As for your TextBlock, set IsHitTestVisible to true and add Tap handler. In the tap handler change the visibility of the previously added and named TextBoxes.
In case you want to use MVVM, bind visibility to some bool value and add converter from bool to visibility. Also add an event to command trigger to the text block element and handle it in your view model - there you will toggle the same bool property that all those text boxes are bound to.
What properties will make the Popup control Shows exactly over the mouse (On real device above the finger position on the screen while touching) in a windows phone application?
The xaml used is
<Grid Grid.Row="2">
<phone:WebBrowser IsScriptEnabled="True" MouseMove="mainBrowserControl_MouseMove" x:Name="mainBrowserControl" />
<Popup Name="ActionMenus" IsOpen="False">
<StackPanel Orientation="Horizontal" Background="Black" >
<Button Name="btnA1" Click="btnAq_Click">Annotation</Button>
<Button Name="btnHq" Click="btnHq_Click">Highlight</Button>
</Popup>
</Grid>
And the code i used for showing Popup is
private void mainBrowserControl_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
ActionMenus.IsOpen = true;
}
But the position of the Popup is on the top of Grid . How can i make it exactly above the mousepointer (or where the user touched on the screen)
In WPF Popup i can see some more properties like Placement and if we use Placement="Mouse" the popup will shown exactly over Mouse , But this property is missing in Windows phone
As you have not made any Rows in your Grid, any element added to the Grid will be placed on top of all other elements.
In order to place the popup where you want it, you must find out where the user tapped. It can be found in the MouseEventArgs input to the method:
http://msdn.microsoft.com/en-us/library/system.windows.input.mouseeventargs.getposition(v=vs.110).aspx
Then place the ActionMenus accordingly.
At first, if you want to popup show up anywhere on the page you should:
1) Create second grid, that won't have any rows, or columns over your content (with Horizontal and Vertical aligments set to Stretch) - it will be your placing field that will take the whole page.
OR
2) Add to a popup Grid.Row and Grid.Column spans.
Next:
As emedbo said you should catch MouseDown event and get the MouseEventArgs coordinates. And then you can do:
If you selected method 1:
Popup pop = new Popup();
pop.Margin = new Thikness (X,Y,0,0) // To set margin left and top to show popups left top corner under the finger.
Grid.Children.Add(pop);
//Syntax maybe little incorrect, because i'm writting this from my mind
If you selected method 2:
Popup pop = new Popup();
pop.Margin = new Thikness (X,Y,0,0) // To set margin left and top to show popups left top corner under the finger.
pop.*** //Here must be added Rowspan and Columnspan of the parent container
Grid.Children.Add(pop);
//Syntax maybe little incorrect, because i'm writting this from my mind
I am trying to set the softKeyboardType to email but when ever i use skinClass="spark.skins.mobile.TextAreaSkin" it doesn't change it but when i take off skinClass="spark.skins.mobile.TextAreaSkin" it does work. The problem is i need the skinClass="spark.skins.mobile.TextAreaSkin" class to allow my application so scroll with out it the text does not stay with in the bounds of the text input boxes. Has anyone seen this problem or another fix the the scrolling problem?
Code examples
<s:TextInput softKeyboardType="email" id="id1" width="100%" skinClass="spark.skins.mobile.TextInputSkin" />
<s:TextArea softKeyboardType="email" id="id2" height="400" width="100%" skinClass="spark.skins.mobile.TextAreaSkin" />
Thank for the help,
Justin
I've checked mobiletheme default.css in flex 4.6 sdk
adobe is using different skins for TextInput and TextArea components
TextArea
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextAreaSkin");
}
TextInput
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextInputSkin");
}
so I think you should use StageTextAreaSkin or StageTextInputSkin as a skinClass for corresponding components
softKeyboardType will work in this case but text position problem will stay, I think you will need to change/fix StageTextAreaSkin or StageTextInputSkin sources for your scrolling
Confronted with this issue, I came up with a workaround which worked in my case.
Use default skin, set your softKeyboardType.
While doing layout for your screen, create a section which contains the uppermost part of your screen and which you can easily collaps or toggle its includeInLayout property, so when you do that, it will make your TextInput or TextArea to appear over the keyboard, bypassing the scroller for that purpose.
Then, when your field receives focus, in focusIn handler, you collaps or toggle this section. This does two good things: first, it lifts your field over the keyboard, and second, it removes focus from your field (at least in my case it did, not sure 100%, if it doesn't, then shift focus manually). This is good because when you set focus on your field once again (yourfield.setFocus()), the cursor will appear where you want it, within the bounds of your field.
Once done typing, you restore top section to its original state from focusOut or softKeyboardDeactivate handlers.
Hope this helps...
seems like it's flex 4.6 bug
http://forums.adobe.com/message/4122095