UWP ListView in touch mode - windows-runtime

I have this ListView in a Windows 10 project:
<ListView ItemsSource="{x:Bind ViewModel.ItemsList, Mode=TwoWay, Converter={StaticResource BindableSourceConverter}}"
ScrollViewer.HorizontalScrollMode="Disabled"
ScrollViewer.VerticalScrollMode="Disabled"
RelativePanel.Below="pageHeader"
CanReorderItems="True"
SelectionMode="None"
CanDragItems="True"
AllowDrop="True"
CanDrag="True" />
and i need to allow the user to reorder the ListView.
Using mouse everything works fine, but using the touch, i need to wait one second before that i'm able to move the items around.
Any idea on how to fix that?

There isn't any, if you don't wait one second internal ScrollViewer thinks you do scroll action. Since it can't know your intention for sure, it can't know the difference.
If you don't need scroll action, consider not using ListView.

Related

Create a scrollable non editable text display

I have very little experience with flex/actionscript3/mobile developement, but I'm currently working on a problem with an app, and find myself somewhat lost. In a legacy app I'm currently making modifcations to, we were previously using adobe Air 16, Flex 4.6. However, sometime ago an update was made to use Air 23 and Flex 4.15 instead.
Since then a couple of issues have come up, most notably a display we used is not longer working.
Previously we were using the following to display some information pulled from a log file for viewing by testers. The contents are added via the controller when the view is loaded up. That isn't included as it isn't particular important(at least I don't think it is).
<s:VGroup id="logPanel" horizontalAlign="center" width="100%" height="100%" paddingTop="15" paddingBottom="15" paddingLeft="15" paddingRight="15" gap="15">
<s:TextArea id="logContents" width="100%" height="100%" editable="false" text="Opening file...">
</s:TextArea>
</s:VGroup>
Previoulsy using the editable tag was enough to prevent the keyboard from popping up, and allow the mobile user to scroll through the text area via touching.
However, after updating this doesn't seem to be the case. In newer version the keyboard pops up and I can't seem to find a way to implement scrolling, and prevent the soft keyboard from appearing. It looks like the editable field is respected(as editing is enabled), but the prevent the soft keyboard via that tag isn't. I can disabled the soft keyboard via adding event listeners for a variety of Mouse events, but this doesn't seem ideal, and also doesn't help with scrolling.
Is their a simple way to get the functionality I want with this text area, or do I need to be using a different component for this entirely. After spending time trying to research this I keep coming back to text areas as the component I want, but as I mentioned getting the desired behavior is difficult, and I'm fairly new this language as a whole.
If I set enabled to false I am able to prevent the keyboard from appearing, but then I don't seem to be able to add event listeners to mouse inputs which I would need to manually implement scrolling.
The reason I was stumped was because I was being dumb. The text area doesn't seem to be able to behave the way the original authors intended anymore. However, the RichEditableText component was able to have the functionality I needed. Switched to the following game all the desired functionality. Had I not been so slow in going through documentation I might have found this sooner.
<s:VGroup id="contentPanel" horizontalAlign="center" width="100%" height="100%" paddingTop="15" paddingBottom="15" paddingLeft="15" paddingRight="15" gap="15">
<s:Scroller width="100%" height="80%">
<s:RichEditableText id="contents" percentWidth="100" percentHeight="100" editable="false" selectable="false">
</s:RichEditableText>
</s:Scroller>
</s:VGroup>

Suggestions for a Flipview with Pages inside (Windows 8.1 app)

I'm trying to create an app which shows a different page on swiping left or right.
I'm using the flipview control and loading it with Page class objects.
It works well, but when I select a textbox inside, the control recieving the focus is the flipview instead of the textbox, and then the keyboard covers it.
My question is, how I should implement his UI?
The actual structure is something like (this is not real code, but the simpliest way to show the structure)
<Page>
<FlipView> <---- This gets the focus instead of the textbox
<SetupPage>
<TextBox1 /> <--- This textbox is clicked and shows the keyboard
</SetupPage>
<AnalyzePage>
<TextBox2 />
</AnalyzePage>
</Flipview>
</Page>
I've tried using FlipViewItem around the pages, and also trying to override the focus logic of the flipview. I haven't suceeded in any case.
Thanks!

WinRT: Right-Click works for selecting items. Swipe Gesture doesn't

I feel like I'm missing something obvious. I have an application which uses the 'IsSelected' property of GridViewItem to indicate that an item has been selected. When I'm using the application on a desktop computer (no touch devices) and I right-click on the item, it becomes selected. Take the same program and put it on a Surface and I can find no gestures that will select it. Swipe-down, press-and-hold; nothing seems to do the work that the Right-Click does on the desktop.
Anyone have any ideas what might be missing?
OK, got the answer and it's not pretty. In my code, I had attempted to subclass the GridView with my own control called ContentView. In XAML there is no subclassing of standard controls (you can't use the 'BasedOn' to pick up the style of built in controls) so my ContentView was not picking up the styling of a standard GridView. However, after pulling apart the standard style I've discovered the two critical features are:
IsSwipeEnabled - Must be set to true for swiping to work on the item.
ScrollViewer.VerticalScrollMode - Must be disabled so the scroll viewer doesn't try to interpret the swipe motion as a command to scroll downward.
After that, swiping to Right-Click works easy as pie.
I get what you are asking. It seems counterintuitive, huh? In this situation, my preference is to enable item clicking and use item clicking to set the selected item. If find this to be the most intuitive for users. Start with this XAML:
<GridView IsItemClickEnabled="True" ItemClick="GridView_ItemClick" />
And then simply do this:
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
var grid = sender as GridView;
if (grid.SelectedItems.Contains(e.ClickedItem))
grid.SelectedItems.Remove(e.ClickedItem);
else
grid.SelectedItems.Add(e.ClickedItem);
}
It should work for SelectionMode Single and Multiple just fine.
Does that make sense?
// Jerry

Disable the swap in WP8

I'm developing windows phone 8 application.
How I can disable the swap between the items in the pivot page ? since I disabled the IsHitTestVisible property to do that.
But When I used it ; controls in the item page doesn't accept input from user?
How I can disable the swap ? and allow the input from the user in the same time ?
In order to stop the Pivot on WP8 for switching PivotItems, use the new Pivot.IsLocked=true property. Read more about it here # http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.controls.pivot.islocked(v=vs.105).aspx
For example, this code snippet shows how to use Pivot.IsLocked on WP8:
<phone:Pivot IsLocked="True">
<phone:PivotItem Header="Foo">
<TextBox />
</phone:PivotItem>
<phone:PivotItem Content="Bar" Header="Bar" />
<phone:PivotItem Content="Baz" Header="Baz" />
</phone:Pivot>
When you run this code snippet you can see the Pivot only shows the first PivotItem but you can still interact with it (which isn't possible if you simply set IsEnabled=False).
For WP7, use there's a LockablePivot in the Windows Phone toolkit that support this same property. Read more about it here # http://www.windowsphonegeek.com/articles/Windows-Phone-Toolkit-LockablePivot-in-depth

setFocus in Flex

I'm Using following code in flex4 mxml That works fine.
<mx:Button label="Set focus to Username"
click="focusManager.setFocus(username);" />
How to use the same in Action script I mean creation complete event of an application without using button.
That is I have login panel in application While page loads the
username field should focused having cursor in it.
Can any one help me?
The issue is that within your application the TextInput has focus, but within the HTML page your Flex application does not. So basically the only extra step you need is to give the Flex app focus. There's only one way to achieve this: through JavaScript. And you should do it after the application was loaded.
The guys at Farrata wrote a very good example on how to do this, so I'm just going to point you there: http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components