How to add tilt effect to LongListSelector? - button

I'm developing a Windows Phone 8 application. In this, I want to add tilt-effect to all my controls (Button, LongListSelector, etc). Could you please tell me how to add tilt effect in Windows Phone 8 Application controls?

Try putting TiltEffect.IsTiltEnabled="true" in the Longlistselector.
<toolkit:LongListSelector Name="resultList" Grid.Row="1"
DataContext="{StaticResource viewModel}"
ItemTemplate="{StaticResource ResultItemTemplate}"
ItemsSource="{Binding TwitterCollection}"
ListFooter="{Binding}"
TiltEffect.IsTiltEnabled="true"/>
Add this in the constructor of the cs page of your xaml.
TiltEffect.TiltableItems.Add( typeof( LongListSelector ) );
This will work.

Please do a little more research yourself, a simple Google-search got me this:
Control tilt effect for Windows Phone
And from that article, you can go to:
How to use the control tilt effect for Windows Phone

Related

How tell command (on page) which control was pressed?

i have a big knot in my brain.
The current Situation is the following:
in my xamarin Forems App i have on some Pages a UserControl (House) witch Contains multiple Controls (Floor) and this has also multiple Controls (Rooms) in it.
This is all working perfectly and i have coll control for each room over a HouseControler Class
On my RoomControl i have:
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={x:Reference Root}, Path=RoomTappedCommand}" />
</Grid.GestureRecognizers>
this is totally perfekt. and i got my command perfectly fired in the Breakpoint.
But what i want to acheve is to open nut just an alert but a custom Popup with a Navigation from the current Page with the Informations of the Tapped Room.
So in need do pass somehow the informations from the RoomControl up to the Page. But i dont know how.
i would love to read some tipps.
Thank you Guys =)
you can always get a reference to the currently active page using App.Current.MainPage. To display an alert, for example
App.Current.MainPage.DisplayAlert(...);

How to change the cancel icon in Xamarin Forms Shell SearchHandler

I have a Xamarin Forms Shell app where I have implemented the Shell SearchHandler. The cancel button shows a book image.
This only occurs on iOS - on Android, there is no cancel button.
My xaml looks like this:
<Shell.SearchHandler>
<controls:RouteSearchHandler
x:Name="RouteSearch"
BackgroundColor="White"
ClearPlaceholderCommand="{Binding ClearSearch}"
ClearPlaceholderIcon="{StaticResource Cancel}"
DisplayMemberName="Street1"
SearchBoxVisibility="{Binding TopSearchVisibility, Converter={StaticResource visibleConvert}}"
ShowsResults="True" />
</Shell.SearchHandler>
How do I change the cancel icon from a book to another fonticon or image?
It seems a potential issue , the team set a default(book) icon on Clear button.
Workaround
You can prepare a small/transparent image and place it in Resources folder in iOS project , and set ClearPlaceholderIcon with it, then the problem should be solved .
And Feel free to file the feature request on github :https://github.com/xamarin/Xamarin.Forms/issues.

Xamarin.Forms: prevent resize when keyboard appear on a specific entry

I have set Window.SetSoftInputMode on AdjustResize in Android native project. However, only when a specific entry gets focus, I need to disable both page resize and scroll when keyboard is showed. How can I do this?
Do you want to set the Soft Keyboard Input Mode on Android device on xamarin form app?
If yes, you can set the Application.WindowSoftInputModeAdjust attached property to a value of the WindowSoftInputModeAdjust enumeration:
<Application ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:Application.WindowSoftInputModeAdjust="Resize">
...
</Application>
Alternatively, it can be consumed from C# using the fluent API:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
...
App.Current.On<Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
For more, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/android/soft-keyboard-input-mode .

Numeric UpDown Control for Xamarin Forms

Can any one Please provide Numeric UpDown Control demo with Xamarin Forms
Does this control Available in Xamarin Forms?
thanks
Prashanth
See edit #2.
No there is not a spinner control out-of-the-box. If you do not want to get creative, you could use the Picker control and insert predefined values into it. Picker info here.
Otherwise it would be pretty trivial to create an up and down Button and an Entry or Label. Clicking the up Button increments a number in the Entry or Label. Clicking the down Button decrements a number in the Entry or Label.
*Edit: Just happened to land on Syncfusion's NumericUpDown control which does want you want. You can also get a free community license for the control if you are a lone developer or a group of 5 or fewer people. Community License info here
*Edit #2: Was looking through the Xamarin Views list page here and saw that actually do have a Stepper control now!
You can use Stepper for this:
XAML
<Stepper Value="5"
Minimum="0"
Maximum="10"
Increment="0.1"
HorizontalOptions="LayoutOptions.Center"
VerticalOptions="LayoutOptions.CenterAndExpand"
ValueChanged="OnValueChanged" />
C#
void OnValueChanged(object sender, ValueChangedEventArgs e) {
lbldisp.Text = String.Format("Stepper value is {0:F1}", e.NewValue);
}
https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.stepper?view=xamarin-forms
maybe this could help. you might want to write a custom render for putting that textBox in between the -/+ buttons but sure if you can use as it is, it works fine.

No Property of name Image found for Button on Windows Phone

I'm getting an issue I don't understand. I have a Button with an image defined with the following code :
<Button Image="SearchFilterIcon.png"
Grid.Row="0"
Grid.Column="1"
Clicked="OnButtonFilterClicked" />
This works well on Android. The image is displayed on my button but when I launch the Windows Phone application, I get a XamlParseException which says that : No Property of name Image found.
How is it possible? The Button widget isn't the same on Android and Windows Phone?
If you do the following:-
Button objButton1 = new Button();
objButton1.Image = (FileImageSource)ImageSource.FromFile("testImage1.png");
objStackLayout.Children.Add(objButton1);
this.Content = objStackLayout;
Then it will work (via code-behind).
The Button control always had the Image property, even in Xamarin.Forms v1.2.2x, so this is not a new property introduced and nothing to do with having the latest packages installed.
As a workaround perhaps you should consider giving the XAML Button a x:Name as in:-
<Button x:Name="myButton1"/>
And then assign the image from code-behind:-
myButton1.Image = (FileImageSource)ImageSource.FromFile("testImage1.png");
Update 1
This was a case of very old libraries being used (v1.0.6186). Once the project is reupdated to the latest binaries for v1.2.3x, then this works fine.
The Button.Image is available on WP, just as it is on iOS and Android. You probably don't have the latest nuget (1.2.3) installed for WP, or you have multiple versions installed.
The buttons in XAML for Windows Phone simply do not provide an Image property. Thus, you cannot add an image to the button as the API doesn't support this. What you have to do is to create a control template that contains the text and the image.
Button documentation
Try some like:
<Button Click="OnButtonFilterClicked">
<Button.Background>
<ImageBrush Stretch="Fill" ImageSource="/SearchFilterIcon.png"/>
</Button.Background>
</Button>
instead of "Clicked" and "image" properties.

Resources