It seems that holding method does not work since 2015:
Win10 App - Holding & Releasing the map to manipulate an element on the interface
or simply I don't know how to use it, anyway I need to manage a user holding on PC or mobile of a map.
My map is like a navigator, it follows the user position while it is moving, but when user use gesture to see the map around I have to stop the .center position of the user pushpin.
But I cannot find a way to understand when user move the map. The docs tell to use the holding event
https://learn.microsoft.com/it-it/windows/uwp/maps-and-location/display-maps
but I've tried it on PC and my app doesnt enter in the holding event.
I've tried all the other events, only maptapped and actualcamerachanged works.
but I don't know how to difference from a user move or a map .center move from the app.
Any help?
Thanks!
MapHolding doesn't fire immediately on Pointer down. It fires on a press and long hold after a delay, and only if the map isn't moved. It's intended for things like displaying a context menu (like right-click).
The MapActualCameraChangingEventArgs for the ActualCameraChanging event should tell you if the map moved due to user interaction or due to being changed programmatically.
I resolved with a little of WinMerge and some try
you can find the FocusState.Pointer in sender when the user try to move the map, if not with the map.center you get a FocusState.Unfocused by the sender
private void Mappe_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args)
{
if (sender.FocusState == FocusState.Pointer)
{
}
}
Related
When I attach a scrollview to a function like this
textScroll.Scrolled += (sender, e) => { onScrolled(); };
Each time I scroll up or down, OnScrolled() is called multiple times. I know I can get the size of the content and compare it to the ScrollY value, obviously the ScrollY value changes each time, but as far as I can see I won't know when the last call happens (per user scroll).
I only want to call this once per scroll, failing that call it each time as is happening now, but only act when I know I'm on the last call.
Is this possible?
thanks
It is possible, but with a custom renderer for each platform.
On iOS: you will want to implement delegates for DecelerationEnded and WillEndDragging. The reason for also implementing DecelerationEnded is to allow for a fling by the user and waiting for the velocity to come to 0.
On Android it is a bit more complicated. Here is a native Android SO post I followed and translated into c# in a renderer. Works pretty well for me.
Android: Detect when ScrollView stops scrolling
After having both implemented, you can call to your Xamarin.Forms view in order to notify that the view has Stopped scrolling (i.e. final call)
We have a Xamarin app (Android) that at one stage opens up a web view (Webkit.Webview not Forms.Webview). This directs the user to a page on a third party site which has been set up for us.
Firstly - on certain input fields the keyboard which shows up is the wrong one - we are expecting a dismissable keyboard (i.e. "Done" in the bottom corner, not a "Submit"). I know this can be changed but not sure what is the correct way to do this. Does it have to be the metadata/text inputs on the web page that is changed? If so - what needs to be modified per text box entry on the html of the page? Just the type? i.e:
<input type="email">
Secondly, rather than wait for the third party to fix the page, is there a way we can force the webview to always open a certain keyboard type?
We have an option of intercepting the keyboard key presses and trying to dismiss the keyboard on return press at the minute. But would prefer not to put a hack in that intercepts every key press.
Appreciate the help, not sure what the way forward is here.
Thanks
From the comments: To your second question about forcing a keyboard button, you can check out this link which describes how to override OnCreateInputConnection to specify the Keyboard Enter Button type.
public class MyWebView : WebView {
...
public override IInputConnection OnCreateInputConnection (EditorInfo outAttrs) {
var inputConnection = base.OnCreateInputConnection (outAttrs);
// outAttrs.ImeOptions in Xamarin only allows ImeFlags but it also should allow ImeActions
outAttrs.ImeOptions = outAttrs.ImeOptions | (ImeFlags)ImeAction.Next;
return inputConnection;
}
}
That will not dismiss your keyboard when tapped though since it is meant to take the user to the next input. Hopefully someone else can come along and either provide a better answer or give a good way to dismiss the keyboard in this situation without hacking something together.
I want to detect whether user is interacting with Mouse or Finger in my WPF application based on that I want to change my UI(Changing the Context Menu style-more easy interact in touch).
Is there any class available in C# or any native methods are available to find that?
We have a couple of events like TouchDown, TouchUp, TouchEnter, TouchMove which will notify on each action user performs. Please visit below links for more.
http://blogs.msdn.com/b/llobo/archive/2009/12/07/wpf-touch-basics.aspx
http://msdn.microsoft.com/en-us/magazine/ff898416.aspx
Check the value of e.StylusDevice (MouseEventArgs). If null then it is mouse else you will get the instance of touch device. Hope it helps..
I have a published app in the windows phone marketplace, which I'm trying to port to Win 8. I'm using Windows 8 Release Preview and Visual Studio Express RC 2012 for Win 8 and the code is C#-XAML.
I have created a custom 6x7 calendar. The first 7 buttons are put into the first StackPanel , the next into another panel and so forth. So there are 6 StackPanels holding 42 buttons. All these StackPanels are put into a Grid for the easy positioning.
Every button has is associated with a Holding EventHandler named OnLongPress. So the problem I'm facing is that when a button is pressed, the OnLongPress function is being called twice. On debugging I found that first time, the Holding state is Started and the next time it is called, the Holding state id Completed. I cannot figure out why it is being called twice.
Is it because the event is bubbled up?? :(
private void OnLongPress(object sender, HoldingRoutedEventArgs e)
{
Button butClicked = (Button)sender;
int iNumClicked = Convert.ToInt32(butClicked.Content.ToString());
CycleManager pCycMan = CycleManager.Instance;
string iVal, jVal;
int iRow, jCol;
string butName = butClicked.Name;
iVal = butName.Substring(1, 1);
jVal = butName.Substring(2, 1);
iRow = Convert.ToInt32(iVal);
jCol = Convert.ToInt32(jVal);
DateTime dtSelDate = new DateTime(m_yearBuffer[iRow, jCol], m_monthBuffer[iRow, jCol], iNumClicked);
int trackingStatus = pCycMan.IsDateOkForHistory(dtSelDate);
// setting or resetting few colors based on few checks
}
It would be helpful if someone can shed some light since I'm new to Win 8 dev.
I have solved the issue holding event being called twice, once on handling state is started and once on completed by including the following check. I'm still not sure if it is the right method.
if (e.HoldingState == Windows.UI.Input.HoldingState.Started)
If you just want the event to fire only once when holding state is complete or cancel, try to use RightTapped.
Holding is intended for informational UI, but for interactions like displaying a context menu you should use RightTapped instead. You might handle Holding first to display a hint that a menu will appear, but to display the menu itself, use a RightTapped handler. See Touch interaction design or Guidelines for common user interactions for more info on how to use a Hold interaction in your app design.
http://msdn.microsoft.com/en-us/library/windows.ui.xaml.uielement.holding.aspx
RightTapped for a touch action results from processing an action that remains in one place for a certain amount of time. If it's a touch action, a Holding event from the same element always precedes this, but RightTapped won't fire until the touch point is released. If the time the pointer is pressed is too short and Tapped fires instead of Holding, or if the Hold action ends with HoldingState as Canceled, RightTapped won't fire.
i want to build a simple program which help you selecting pictures.
if you have lot of picture and you want to choose some of them then you see them 1 by 1 and when you see a picture you would lik to save on other folder on your pcyou just press a button ,lets say f5 and the program copy the phtot from the path you looking at to the destiny folder.
for that program i need to ask how to know if someone pressed f5 out of the form area and how to know in which path the user looking at.(i want to build it for myself atm so if its help i look with microsoft office picture manager)
about the clicking i search a little and get something named global clicking and hooks which i dont understand so much and about identify the path i have no idea .
tyvm for help:)
I'm not sure I follow the rest -- but if you want to capture the keypress event, simply add an event handler for KeyPress and determine if the pressed key is equal to the F5 button by using the Keys constants.
Here is a project on Code Project that does exactly what you need :)
http://www.codeproject.com/KB/cs/globalhook.aspx
The key press event wont work with the following (Link):
TAB
INSERT
DELETE
HOME
END
PAGE UP
PAGE DOWN
F1-F2
ALT
Arrow keys
Note: I think there is a typo on the page and the F1-F2 really should be F1-F12.
When you decide the key for your on key press event for the form area you are talking about it will look like this:
private void Form_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == [keypressvalue])
{
//do your copy logic
}
}
[keypressvalue] will be the code for F5 if you choose to use this. I have found a mix of values for this (i could not get my test keypress event to pick up the F5 event, hence my note above) so i recommend running the event once with a brake point, inspecting the code, then brake and update your code, then test your logic.
Like the rest i'm not really sure what you want your custom logic to do.
Clairifcation: I'm trying to understand your question, so what you want is: When in Microsoft Picture Manager when you press F5 you want the image that is currently being viewed to be moved to a particular directory? Now if you are writing your own picture viewer and move software then i think we can help if it is the above i'm not really sure you can do that.