Image "look like press down" when single tap - windows-phone-7

After created an image with Tap gesture, when "tap" on the image, it does fire up the "GestureListener_Tap". However, the user experience is bad since when user tap on the image, the image won't "indent down" or look like pressing down...
Anyone know how to do that please?
<Image Source="images/Forex 1 Icons_62.png" Stretch="None" Margin="0,500,0,0">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener Tap="GestureListener_Tap" />
</toolkit:GestureService.GestureListener>
</Image>

I'm just guessing newer used an Image as a Button, most of the time i wrapped the image inside a button and then you get the Effects because it is a button. Maybe you would have to add the to the Image an Effect for example the toolkit:TiltEffect.IsTiltEnabled or you need to do it the hard way and create New States for the Image and change the state if the user Taps the image manually.

Related

UWP touch TappedEvent works only inside TextBlock

I'm trying to test touchscreen of a tablet (Surface) and therefore I'm developing an app that is able to detect tap event and tell its coordinates.
I made a tap event handler to main Grid in MainPage and wrote this to MainPage.xaml.cs:
outputText.Text = e.GetPosition(this).X.ToString() + "\t";
outputText.Text += e.GetPosition(this).Y.ToString();
outputText is just a TextBlock to output coordinates.
This code should give its coordinates based on Grid, but it only gives coordinates if I touch it within TextBlock area.
How does this Tapped event handler work in a way that it only detects tap events inside TextBlock and not from entire screen (app runs in fullscreen mode)?
My MainPage.xaml looks like this:
<Grid Tapped="Grid_Tapped" PointerPressed="Grid_PointerPressed">
<TextBlock x:Name="outputText" HorizontalAlignment="Left" Height="62" Margin="806,374,0,0" Text="TextBlock" TextWrapping="Wrap" VerticalAlignment="Top" Width="182"/>
</Grid>
The problem is that the Grid.Background is null, so the tap events pass through it. The only place where the Grid has any actual "surface" is the TextBlock, which is exactly what you are seeing.
You will have to set the background to any other value like Transparent. This way it will handle the events properly.

Nativerscript tap area

In my nativescript app I noticed that sometimes the tap does not trigger right a way. I have to tap several times to trigger the event. This happens on both, android and ios.
How can I increase the tap hot zone? What else could be causing this to happen?
Thank you.
P.S. I tried increasing the padding of the element whose tap event I am capturing, but that did not seem to help.
I often increase the height and width of the view that have the tap event. You can give it a try.
There are a few factors at play here.
First, when you intercept a page-level event in NativeScript it seems to stop events from other widgets from firing. For example, if you tap on a text field but have a page-level listener for tap events, the tap on the TextField will be intercepted by the page-level listener.
Second, Double-tapping seems to exploit a timing issue in events, allowing the tap event to bubble up to the next listening widget.
Finally, when you have padding on the element you're trying to tap, the tap does not register on the padded areas. It will appear that you can only tap in the middle of the widget (inside of the padded area). In my case, the TextField on which I had padding had to be tapped directly in the vertical center (and that was with a padding of 5px).
To test it, try removing the padding from the element and see if the tapping works normally again.
I was able to create a very smooth / natural experience with the software keyboard by doing the following:
Wrap the TextField in a StackLayout and putting padding on the StackLayout instead of the widget
Add the page-level listener that dismisses the software keyboard ONLY when the textfield is tapped, and remove it once that listener is fired.
ex: XML file
<StackLayout id="loginFieldWrapper" padding="5 5 5 5">
<TextView hint="Enter Login ID" id="loginField" keyboardType="number" returnKeyType="done" returnPress="{{hideKeyboard}}" />
</StackLayout>
Backing javascript file
loginField.on(gestures.GestureTypes.tap, function(args) {
page.on(gestures.GestureTypes.tap, function (args) {
loginField.dismissSoftInput();
page.off(gestures.GestureTypes.tap);
});
});
Wrap the item inside some layout to increase the clickable area
<StackLayout (tap)="select(param)">
<Label text="{{description}}" textWrap="true" marginTop="40px" marginBottom="40px">
</Label>
</StackLayout>

How to animate the movement of a button between 2 positions in xaml, UWP

I have two buttons. One is an edit button that when clicked allows the editing of other objects on the page. My hope is to have the second button appear only once this "edit state" has been initiated. That part isn't very difficult. However, I don't want to just alter the 1st button's alignment from right to left to make space for the 2nd button (a cancel button) to the 1st button's right - I want to animate this movement, as if to make it appear that the moving of the 1st button to the left, is uncovering the 2nd button.
I've been searching for hours trying to find out how to do this, and there's a multitude of options for WPF, but not many solutions for UWP applications.
So far, I've found this:
<Button x:Name="EoIdButton" Grid.Row="0" Grid.Column="2" view:EventHandlers.Attach="Click" BorderBrush="DarkGray" FontFamily="Segoe MDL2 Assets" Content="{Binding EoIdButtonContent, Mode=TwoWay, Converter={StaticResource SegoeConverter}}" Style="{StaticResource CircleButtonStyle}" Visibility="{Binding EoVis, Mode=TwoWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<interactivity:Interaction.Behaviors>
<core:DataTriggerBehavior Binding="{Binding SomeProperty, Mode=TwoWay}">
<core:ChangePropertyAction></core:ChangePropertyAction>
</core:DataTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
So, while I can change a property using this, I don't see how to create an animation. My guess, based on my searching would be to use a Storyboard, but again, most of the solutions I've found pertain to WPF and/or don't work because the scenario is too different. If someone has a solution for this, it'd be great.
For additionaly clarity
I have button 1:
(EditButton)
When (EditButton) is clicked, I want edit button to rendertransform/animate left and the result to look like so:
(EditButton)(CancelButton)
When either edit button or cancel button are clicked, I want it to return to the original state

Bing map rotation in windows phone pivot

I have a trouble when try to rotate MapBase. As far as I didn't find a way to rotate content inside map(i mean tiles). I made a rotation transform with map itself and put it in square to emulate a rectangual viewport.
The problem is the map corner flows over corner of square while rotating and what worst it moves over pivot items titles and I don't know how to bring it to the bottom.
Is there any workaround of that? Or may be other way to rotate the map content?
UPDATE
XAML CODE
here is my code
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<controls:PivotItem Header="first">
<Grid d:LayoutOverrides="Height" Margin="-44,-30,44,30">
<Microsoft_Phone_Controls_Maps:Map Margin="-18,-72,2,76" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
<Microsoft_Phone_Controls_Maps:Map.RenderTransform>
<CompositeTransform Rotation="36.01"/>
</Microsoft_Phone_Controls_Maps:Map.RenderTransform>
</Microsoft_Phone_Controls_Maps:Map>
<Rectangle Fill="#FFF4F4F5" Height="54" Margin="-14,-42,0,0" Stroke="Black" VerticalAlignment="Top"/>
</Grid>
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem Header="second">
</controls:PivotItem>
</controls:Pivot>
</Grid>
In the example is on the top of map, but map is on the top of Pivot headers and even application title is on the back of map corner...
And If you Load another page in "Paysage Orientation" when you rotate your phone ? (It's maybe a temporaly solution... ) but you want to reaload your map with good dimension.
It's not a good idea to use a Map Control inside a Pivot if gesture interaction is enabled.
Don’t use Slider, ToggleButton, or Map controls in a Pivot control. Don’t use controls that can pan or scroll inside a Pivot control. For example, if you put a Map control inside a Pivot control it might be difficult to use the Pivot control. The gesture input gets confused. The solution is to navigate to a subpage with controls that require gesture input. You can place a map in a pivot page as long as the map isn’t enabled for gesture interaction. You could overlay a button that would activate the map. Pressing the button would actually navigate to a separate page with just the Map control on it. The user could then press the Back button to go back to the Pivot control.
http://msdn.microsoft.com/en-us/library/windowsphone/design/hh202919%28v=vs.105%29.aspx

Changing click behaviour

When a Button having Content / Text 'ClickMe' is clicked, 'ClickMe' text is automatically arranged to foreground of the button.
But when user clicks the button having image on its background, background image becomes invisible & the foreground of button looks fully white.
Can we see the image on foreground instead of white color.
Is there any chance to change the foreground effect of the button when user clicks on button?
My Code "Button Height="128" HorizontalAlignment="Left" Margin="307,138,0,0" Name="button2" VerticalAlignment="Top" Width="150" BorderThickness="1">
"Button.Background>
ImageBrush ImageSource="/WinApp;component/Icons/camerabtn.png" />
/Button.Background>
/Button>"
Thanks in advance to all.
To do this you need to change the style of the button.
Easiest way to do that is in Expression Blend.
See this answer:
Windows Phone 7 (WP7) Change a button's background color on click
As Mick suggests, it would help to see some code for what you're trying to do, however, it sounds like you may have a change in a value (such as margin) in the Normal and Pressed states of the button resulting in the behavior you are seeing.

Resources