xamarin.social is targeting framework 4.6.1
is there any update for xamarin.social is coming for .net standard 2.0 or suggest any alternative.
Handling the tap events on image in xamarin.forms?
Can you anyone Please help me on this? How to handle the tap events on xamarin.forms. even i gave numbertaps required=2 in xaml it s executing number of times.
my scenario is image is in xaml page and i gave number taps required is "2" when i click on 2 times with no time its executing many times.
how to set (no of taps to) 1 in tap command in mvvm xamarin forms?
i have given tap gesture to image .... when i tapped image multiple times then page is also opening multiple times....i want to open page for only one tap...i have already given no of taps=1...but not working..how to do???
ListView with MVVM - TapGestureRecognizer not working
Hi,
I'm trying to go the MVVM route and avoid doing stuff directly in the code-behind, I'm finding that trying to detect a row being clicked to invoke a command painful to implement. It would seem that there's no ItemSelected that takes a Command (but it's okay if I wanted to invoke an action in my code-behind), which is a shame, so I've tried to use the TapGestureRecognizer with no success...
XAML...
<ListView
CachingStrategy="RecycleElement"
ItemsSource="{Binding FilteredMessages}"
HasUnevenRows = "true"
SelectedItem = "{Binding SelectedMessage}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Scheduled}"/>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Message}"/>
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCommand}"></TapGestureRecognizer>
</Label.GestureRecognizers>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The View Model...
public ContactDetailViewModel()
{
...
TapCommand = new Command(HandleAction);
}
void HandleAction (object obj)
{
Console.WriteLine("***** DOESNT GET CALLED :-( *****");
}
I've tried to put the GestureRecognizers at different layers in the xaml (i.e. at the StackLayout, ViewCell and ListView), but none invoke my callback method, but it would appear that it's capturing the event, because the cell doesn't go grey; which is the default behaviour when I click the cell.
Any ideas what I'm overlooking here?
I could fallback to using an ItemSelected in the code-behind and delegate a call through to the ViewModel, but that's not clean.
I appreciate any insights.
Thanks,
Rob.
Is there a way to use GestureRecognizers in ViewCells while letting ListView handle the gestures?
When you select an item in a ListView, the ListView has handles the gestures and, in turn, the SelectedItem property changes.
When you add a gesture recognizer to a View (say, a Label) in a ViewCell, it then consumes the gesture and lets you handle it, however if you select an item with this gesture recognizer, the ListView essentially not know it was selected, and it's SelectedItem property will not change.
Is there a way to allow a gesture to be handled by both your gesture recognizer and the listview? I have tried making my gesture recognizer invoke a two-way binding to SelectedItem inside the pages ViewModel to manually emulate it, however that does not seem to be enough to mimic the original behaviour (it still thinks the last item selected was not the one with the gesture recognizer, so if you tap back on the previous one afterwards it won't handle it).
Any ideas?
Thank you for your time
[Material] how to gain access to `Toolbar` from custom renderer?
Based on @TheRealJasonSmith's gist on how to add Material design to your Forms.Android app, I've implemented the "Toolbar" instead of the "ActionBar".
I'm wondering how I might go about getting access to that View in order to set the NavigationIcon
to the Page.Icon
?
Right now I've got a custom renderer that is attempting to set the Toolbar NavigationIcon
like so, but toolbar is always null
[assembly: ExportRenderer(typeof(Page), typeof(Renderers.ExtendedPageRenderer))]
namespace Renderers
{
public class ExtendedPageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
if (Element != null && Element.Icon != null)
{
var iconId = ResourceManager.GetDrawableByName(Element.Icon.File);
var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
if (toolbar != null)
{
toolbar.SetNavigationIcon(iconId);
}
}
}
}
}
Saving game data to SQLite
I have 6 populated instances of a rather lengthy class (6 columns of the players stats in a score sheet). Can someone please tell me the best way to save the 6 instances to Sqlite when the game terminates and then use SQLite to repopulate the instances when the players load the saved game?
Set Values in Picker depending on User Input (Dynamically add items to Picker)
I am using Xamarin Forms. I am able bind values from the List<> to Picker using XAML. There are two pickers in my Registration Form. The requirement is that depending on the selection of item from the first Picker, I want to add items in the second picker. Is this possible? Any help would be appreciated!
EDIT: Example
In first picker, I have A, B, C, D.
If user selects A, then second picker must display A1, A2, A3.
If user selects B, then second picker must display B1, B2, B3.
If user selects C, then second picker must display C1, C2, C3.
If user selects D, then second picker must display D1, D2, D3.
All the above values A, B, C, D and A1 A2,.... etc will come from list or web API.(no issues with this part. It's working)
Customized Popup Page in Xamarin Forms
Hi ,
We need to implement the Popup screen with user inputs (Entry,Picker, Date Picker, Time Picker) controls.
In Existing Xamarin Android application , we used "AlertDialog.Builder" to use customized Layout.
Kindly suggest on how to acheive the same with Xamarin.Forms?
How to add CarouselView with modeling content inside a CarouselPage
Hi,
I need to add multiple CarouselView with modelling data inside a CarouselPage, Kindly help me to achieve this,
Any lead to it will be helpful.
Thanks in advance
How to implement Fused Location Provider in Xamarin Forms?
Hi,
I am stuck in implementing Fused Location Provider (as explained here) to find indoor Geo-Coordinates. At a very first place it gives the following error:
error CS0103: The name 'LocationServices' does not exist in the current context
Can you please help with this error or any other suggestion for getting the indoor locations using Xamari.Forms? Thanks
RSA Encryption
Hi,
Please help me to encrypt string(password) in Xamarin using RSA algorithm. I am using following code in Android native. Please help me to port this in Xamarin,
byte[] keyBytes = Base64.decode(key.getBytes("utf-8"), Base64.DEFAULT);
X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(spec);
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] encryptedBytes = cipher.doFinal(plain.getBytes());
encrypted = Base64.encodeToString(encryptedBytes, Base64.NO_WRAP);
Thanks...
Why is idle HEAP always the same size regardless of maximum available?
After checking my app on multiple Android devices, I've noticed something odd with respect to he available heap space.
One device might have a max of 256. Another a max of 512. If I don't set largeheap to true then it will be 128.
Yet regardless the size of the heap the AVAILABLE heap is always 15mb when idle.
This is not a static value. I can see it rise and fall with work being done. The available being returned seems accurate because if I don't take precautions when scanning and drive it down to <2mb then it will throw an OOM exception stating it tried to allocate 3mb with only 1.4 available-and the amount the exception said was available matches my calculated amount.
So that's where I am confused. How does the same app which presumably has the same base footprint never get more available heap regardless of largeheap or device? More importantly - How can I use that available heap? Its silly that I'm going OOM when I have 512 total and not using any of it.
I tend to beleive these calculations are right because they change correctly when I change devices or turn of LargeHeap; but I'll provide them anyway in case someone knows a better way.
//This is running from the Droid project and returning the value to the PCL
/// <summary>Return in MB
///
/// </summary>
/// <returns></returns>
public override decimal GetTotalHeap()
{
Java.Lang.Runtime runtime = Java.Lang.Runtime.GetRuntime();
long maxHeapSizeInMB = runtime.MaxMemory() / 1048576L;
return maxHeapSizeInMB;
}
public override decimal GetAvailHeap()
{
Java.Lang.Runtime runtime = Java.Lang.Runtime.GetRuntime();
var aval = runtime.FreeMemory();
return aval / 1048576L;
}
Select an item is MasterDetail page by default
Hi,
I have just created a new MD page in C# by using Visual Studio (so it created the templates for me)
and while I can navigate to different pages by selecting an option on the left, I want the first page shown to the user to be the first item of the list.
How can I do that?
Parts of RelativeLayout not showing with TranslateX
I'm creating a custom ListView
that is a StackLayout (list) containing a bunch of RelativeLayouts (the list items). I want to add the ability to swipe the list items to show more options. I need to do this custom because the list items are not uniform at all and the list must look the same on iOS and Android.
I have 2 solutions that each have a problem. Here is how I add the extra options to my RelativeLayout. Notice they go beyond the bounds of the RelativeLayout.
{
trashLayout,
Constraint.RelativeToParent(parent => parent.Width ),
Constraint.Constant(0),
Constraint.Constant(80),
Constraint.Constant(80)
}
First I added the RelativeLayout to a ScrollView and everything shows up fine, the problem is I don't want the user to be able to scroll the list item, I want them to swipe it to show more options (using ScrollToAsync). So is there a way to disable scroll on a ScrollView? I know that sounds silly..
So then I tried removing the ScrollView and just having the RelativeLayout. The swiping works great now, however the overflow of the view (the additional options) are now not showing when I do TranslateTo to the view, as can be seen in the pic.
How do I get the entire view to render so using TranslateTo will show the options? Or how can I disable the scrolling of a ScrollView?
Thanks.
Any tools or libs for displaying an offline map using local vector mbtiles?
Are there any tools or libs for displaying an offline map using local vector mbtiles file stored on device?
(I use mbtiles from openmaptiles.com.)
I've tried tried MapsUI but it only support raster tile.
Any suggestion?
Thanks
Searchbar in Navigation bar Or TabbedPage
Hi, I was having trouble trying to get a searchbar inside the navigation bar. Then i read it wasn't possible because it only accepts ToolBarItems.
So now im trying to put the searchbar at the top of a tabbedpage where the navigation bar was. But it wont let me put anything other than a page in the TabbedPage.
<SearchBar Placeholder="Search"/>
<TabbedPage.Children>
<custom:ContactsTab Title="Contacts" Icon="contacts_icon.png"/>
<custom:ConversationsTab Title="Conversations" Icon="conversations_icon.png"/>
</TabbedPage.Children>
Xamarin Forms QR code scanner blank screen
I have a Xamarin Forms 2.0 application that uses ZXing.Net.Mobile and ZXing.Net.Mobile.Forms version 2.0.3.1. I'm trying to build a simple QR code scanner, but whenever I launch the ZXingScannerPage on Android I can see the default overlay (with the text and the red line) but I don't see the output of the camera so I can't actually scan anything. I have already listed the Camera permission in my AndroidManifest:
I tried the sample code from the readme: https://github.com/Redth/ZXing.Net.Mobile as well as from their Samples/Forms project. I now have this code:
`private async void OnScanQrClicked(object sender, EventArgs e)
{
_scannerPage = new ZXingScannerPage();
_scannerPage.OnScanResult += HandleScanResult;
await Navigation.PushAsync(_scannerPage);
}
private void HandleScanResult(Result result)
{
_scannerPage.IsScanning = false;
Device.BeginInvokeOnMainThread(() =>
{
Navigation.PopAsync();
DisplayAlert("Scanned code", result.Text, "OK");
});
}`
Some more specs: I'm running Android 5.1 on a Moto G (v1).
Why am I not seeing the output of the camera?
How can I create a new PDF in Xamarin.forms? / ¿Como puedo crear un nuevo PDF en Xamarin.forms?
I am developing a new App which when the user complete all his tasks he has to press a button to confirm the realized activity, after that the App have to create a PDF which will be sended by e-mail.
My problem is when I want to create the PDF. I found a lot of libraries on internet but none of them is working for me.
Can someone tell me which one is the easiest to use and give me an example?
Thanks!
Estoy desarrollando una nueva App en la que el usuario al finalizar todas sus tareas debe apretar un botón para confirmar la actividad realizada, luego de esto se generará un PDF el cual será enviado por e-mail.
El problema lo tengo cuando quiero crear el PDF ya que busqué muchas librerías por internet pero ninguna me está funcionando.
Alguien podría decirme cual es la mas sencilla de usar y pasarme algun ejemplo?
Gracias!
Is there a Clipboard plug-in/component for Xamarin.Forms?
I need to implement Copy to Clipboard within my app. Is there a component/plug-in to support this, or am I back to writing more DependencyServices?
Thanks,
John H.