Elastic property with windows phone slider - xaml

I have a slider in windows phone as shown in figure. When I swipe the slider it's working. But what I want is, if I swipe the slider and leave it in the middle without reaching the end of the slider - it should return back to the beginning like elastic. If it was swiped to the end then it should navigate to the next page. Why I am using slider is, I need to control a text's opacity with animation. How to do this task?

I would use VisualStates to provide the animation, then you don't have to worry about the physics of it. I have created a similar scenario for a notification style Windows Phone effect, you know how you can swipe a notification off to the right. Basically it would be something like this:
OnManipulationStarted VisualStateManager.GoToState for OpenBegin or ClosedBegin depending on the state
OnManipulationDelta you can check e.Delta.X and if < 0 its moving left otherwise it's moving right or just check the position OnManipulationCompleted
After you know what the state call VisualStateManager.GoToState for OpenEnd or ClosedEnd and it will animate back to the specified location.
Add a comment if you need more help/code

Related

What's the equivalent of mouseenter and mouseleave event in react-native

I am trying to develop an app in React-Native, and I need to know that while you're swiping your finger in the screen and if you are on top of a component then to change color (basically just like we do with buttons on hover). onPress method does not work, since you may press out of it in the beginning then while you're swiping you might be on top of that (button), and only then I need to change the color of it.
So I need something like mouseeneter and mouseleave events on the web.
I also tried to add onStartShouldSetResponder, onMoveShouldSetResponder, onResponderMove, onResponderRelease referencing to: https://facebook.github.io/react-native/docs/gesture-responder-system , but that doesn't seem to work. That's because in style I'm working with position: absolute and its not working properly.

update KeyboardAvoidingView after a layout change

I have a form in my app that has a floating bar with buttons that animates into the view at the bottom of the window when the user makes any change to any of the data in the form. I have this bar rendering relative to the height of the window so it knows when the keyboard is open or closed and will attach to wherever the bottom of the view window is at any give time.
The issue I have is the form is wrapped in a KeyboardAvoidingView around the form with a behavior of padding and this all works great, however when I make my change and my floating button bar comes up, because the input is at the bottom of the window the bar now covers up the input I'm typing in.
I haven't been able to find a way to fix this yet. I tried disabling the KeyboardAvoidingView I assume that maybe I need to somehow tell the view about this bar that's covering up part of the view but I'm not sure how I do that.
here is a snapshot of what this looks like for reference...

React native scroll over interactive content

I watched this presentation and there's a section on how to build an IOS Maps like UI. When dragging from the bottom to top, it drags to the top, and after it reaches the top, it continues scrolling up. Also, when scrolling down, when it reached the top content of the ScrollView, it continues to drag down.
It is suggested that it can be done using ScrollView by adding an empty transparent cell as the first element on the ScrollView. I have tried implementing the same which can be found in this snack. In my case, instead of Maps, I am using another ScrollView.
But the problem is that the first element (transparent element) does not allow to interact with the First ScrollView elements. I have tried with pointerEvents inside the first transparent view and even in its parent ScrollView. But this does not help. Has anyone tried implementing this kind of use case with react-native? All I found was this library, but I think it's not maintained properly.
you need to set the z-index of the transparent view to send it under/behind the interactive content, here is a good resource:
https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
Edit: Actually I could not accomplish it, it seems like everything inside a scrollview will always be behind or in front of other elements, it seems like you can't have part of the scrollview behind something else and another part in front of something else.

Relative layout for Windows Phone Application using XAML C#

I am creating Windows phone app and in this app i need to deal with webview control and custom keyboards. I need to use my custom views as keyboard where there is system keyboard is used which is ok but the problem is how do i achieve the Relative layout. Currently in app i have a grid in the page and with 2 rows and I have set the height of first row to "*" and the second row height to 0. In first row there is webiew and in second row there is keyboard. So when the custom keyboard is up the height of second row is changed from 0 to some value so it appears with keyboard but due to this the height of first row decreases but what i want is that the keyboard should overlap the webview say 6:4 ratio. I want the height of the webview should remain same and the custom keyboard should overlap it.
Thank you!
Canvas control can be used for such requirement that you have.Please follow this link
https://msdn.microsoft.com/en-in/library/windows/apps/jj207042(v=vs.105).aspx
Happy Coding :)

Is there a way to detect if a pen is in proximity to the screen in WinRT

I want to be able to detect if I have a pen close to the screen or not.
I would like for example to show a different appbar if I open it with a pen.
Also I would like to show other things on the screen when I hold a pen close to it (not necessarily touching it).
/Jimmy
When a pen or finger is near the screen, you will get a PointerEntered event. The PointerPressed event fires when the pen or finger makes contact. If the hardware does not support proximity, then the PointerEntered does not fire until contact is made, and it will be followed immediately by a PointerPressed.
I figured it out.
I listen to the PointerEntered-event and PointerExited-event and then sets a variable that I can check in the appbar_opened-event.
Works great.
/Jimmy