Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Button click to navigate to existing page in SQLite database

$
0
0

I have an SQLite database in my app and want to navigate to a specific page by clicking the button (retrieving it from the database). I have GetPageAsync method in my database:

public Task<List<ArtistPageModel>> GetPageAsync(string keyword)
        {
            return database.Table<ArtistPageModel>().Where(i => i.Name == keyword).ToListAsync();
        }

And ButtonClicked on page where it should be done:

private async void Button_Clicked(object sender, EventArgs e)
    {
        var keyword = "Text";
        var page = await App.Database.GetPageAsync(keyword);
        await Navigation.PushAsync(page);
    }

I know this is wrong but I don't have any other solution because I'm just starting with it. Any help would be appreciated.


Is it possible to detect a long tap on a CollectionView item?

$
0
0

I started using the new CollectionView, but I can't figure out how to detect a long tap (and execute a command) on an item in the CollectionView.
So far I've been using the Syncfusion SfListView which comes with a HoldCommand, but i'd like to start using the CollectionView and I need to have that same feature.

Thanks in advance if someone can provide a simple example.

How to Change Shell Tabar Font to small letter.

Is it possible to use EventListener from Android through Interface in main App?

$
0
0

I tried to make it work modifying the official example (from docs.microsoft.com: the path: /en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction), but seems like interface demands a value to return and the following doesn't work:
public interface IRetrieveDataService
{
RetrieveData();
}

The EventListner I'd like to use through Interface is described in this video from youtube.com: the path: /watch?v=OC-dy3YFLoo
Source code is in the video's description.

Sorry for paths, I can't post links yet :(

How can I get a list when I click on the button to navigate another page?

$
0
0

I am making a clone of Facebook (social network) that a publication has its list of comments
according to the id of the publication, I click on the button and get a list of comments on the publication.

Picker Title problem

$
0
0

Hey,

XF novice here.

How can I change Picker's Title property outside the window or above the default line (according to the Item selected)
but not so that it modifies the title within the popup window ?

To illustrate

I pick Satellite as an item

Which then gives me

after closing the pop-up window.
~~~~
I need a bindable subtitle of sort.

Rg.Plugins.Popup - Move animation not working

$
0
0

Hello,

I want to create a simple popup sliding from the bottom of the screen using Rg.Plugins.Popup. Here is my code for the popup page:

<?xml version="1.0" encoding="utf-8" ?>
<rgPages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:rgPages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
             xmlns:rgAnimations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
             mc:Ignorable="d"
             x:Class="App1.MyPopupPage">
    <rgPages:PopupPage.Animation>
        <rgAnimations:MoveAnimation PositionIn="Bottom" PositionOut="Bottom"
                                    DurationIn="2400" DurationOut="2300"
                                    />
    </rgPages:PopupPage.Animation>
    <StackLayout Margin="12"
                 Padding="24"
                 BackgroundColor="White"
                 HorizontalOptions="Center"
                 VerticalOptions="Center">
        <StackLayout>
            <Label Text="Login" />
            <Entry FontSize="30"
                   Text="username@email.com" />
        </StackLayout>
        <StackLayout>
            <Label Text="Password" />
            <Entry FontSize="30"
                   IsPassword="True"
                   Text="password123" />
        </StackLayout>
        <Button BackgroundColor="DodgerBlue"
                FontSize="30"
                Text="Login"
                TextColor="White" />
    </StackLayout>
</rgPages:PopupPage>

However, this is not working. Popup is just abruptly appearing in the center of the screen. It is not sliding from the bottom. Is it a bug in this plugin or maybe I am doing something wrong?

I am working on Android. I have uploaded the full project as an attachment.

I will be very glad for any help with this problem.

Return value from PushModalAsync

$
0
0

I have a few pages that I'd like to call like functions. As in, I'd like to show the page modally, then do something with a result.

Because awaiting PushModalAsync doesn't actually block until popped, i'm using messagecenter to subscript for the result. It seems kinda clunky. Is there a more elegant way to do this?

        // what I think I have to do:
        async Task TakePicture()
        {
            MessagingCenter.Subscribe<CameraPageViewModel, ImageSource>(this, "CameraImage", async (sender, imageSource) =>
            {
                ImageSource = imageSource;
            });
            await ViewModelNavigation.PushModalAsync(new CameraPageViewModel()); // This returns right away
        }

        // what I wish I could do:
        async Task TakePicture()
        {
            var cameraPage = new CameraPageViewModel();
            await ViewModelNavigation.PushModalAsync(cameraPage); // In my imagination, this blocks until Popped
            ImageSource = cameraPage.Image;
        }

PDF is not opened in iOS 13

$
0
0

I am using the following code to open the PDF file in Xamarin.Forms iOS platform. The below code is working fine before updating the Xcode version 11.2, after the update, the PDF document is not viewed, it shows the PDF name and format only in the viewer. Can you please anyone let me know why the PDF is not opened in iOS latest version (13.2).


public class PreviewControllerDS : QLPreviewControllerDataSource { private QLPreviewItem _item; public PreviewControllerDS(QLPreviewItem item) { _item = item; } public override nint PreviewItemCount(QLPreviewController controller) { return 1; } public override IQLPreviewItem GetPreviewItem(QLPreviewController controller, nint index) { return _item; } } public class QLPreviewItemBundle : QLPreviewItem { string _fileName, _filePath; public QLPreviewItemBundle(string fileName, string filePath) { _fileName = fileName; _filePath = filePath; } public override string ItemTitle { get { return _fileName; } } public override NSUrl ItemUrl { get { var documents = NSBundle.MainBundle.BundlePath; var lib = Path.Combine(documents, _filePath); var url = NSUrl.FromFilename(lib); return url; } } }

Finally, write the PDF file to the file system and call it like below.


string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string filePath = Path.Combine(path, filename); FileStream fileStream = File.Open(filePath, FileMode.Create); stream.Position = 0; stream.CopyTo(fileStream); fileStream.Flush(); fileStream.Close(); QLPreviewController qlPreviewController = new QLPreviewController(); QLPreviewItem item = new QLPreviewItemBundle(filename, filePath); qlPreviewController.DataSource = new PreviewControllerDS(item); UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(qlPreviewController, true, null);

Getting error "Could not load the framework 'libsswiftCore.dylib'" not found.

$
0
0

I just updated Xcode to 11.2.1 and Xamarin forms to 4.3 latest. When I try to debug I get this error. error HE0003: Could not load the framework 'libswiftCore.dylib' (path: /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib): not found.

Moved: total value i want to in point plz help me i have tired

Slow graphic performance in a ContentPage when navigated through 3-4 views

$
0
0

I'm developing an application which has 6-7 pages. I noticed that when it has already been navigated between 2-3 pages, the performance is kinda awful on old devices.

Let's say I have this Navigation:

Page 1 -> Page 2 -> Page 3 -> Page 4

What I'm saying is that in that point, the performance of the Page 4 is bad (animations are not fluid, listview scroll is awful...). However, if I set the page 4 my first page (without having to navigate through the others), it is working as expected. I guess it is normal to lose some performance by the other way, but I don't know if I'm doing something wrong because it works too bad.

I'm using the prism navigation service, and I'm navigating by calling the NavigateAsync method with the name of the content pages, and setting the property to modal. My knowledge of the navigation in Xamarin Forms is basic (and even more with Prism) and I would like to know if I'm missing something.

I also noticed with the View Hierarchy, that when I navigate to the Page 4, there are all the other pages rendered too. Is this a normal behavior?

Thanks in advance.

XAML components are not appearing in the intellisense in .cs file after XF 4.3 upgrade?

$
0
0

In the ContentPages created after upgrade to XF 4.x, the XAML components are not shown in the intellisence in the .cs file. The XAML headers are different in the old and new ones. Is that a reason?

The old header:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:ToDoPlus"
             x:Class="MyProject.MyPage">

The new header:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="MyProject.MyPage">

Unable to add a LaunchScreen.Storyboard to a new XF app.

$
0
0

Hi Dear Reader, I have created a simple XF project in VS 2019 - latest upgrades, with Xamarin Forms (latest stable) using a Blank template. When I tried to add a LauncScreen.storyboard (becasue none was created in the template) I got the messages below.
When I created a new Tabbed project (including UWP) it created a LaunchScreen.storyboard, but when I double clicked it, the editor was opened but I got a similar set of errors.

Any ideas as to what is wrong with my installation?
Where can I find a site that has current instructions for creating a Launch screen in Xamarin Forms - iOS?
Thanks!
Will

System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> MonoTouch.Design.Client.InvalidSessionException: Error in the application.
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest(CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 235
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest[TResponse](CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 252
at MonoTouch.Design.Client.ServerProcessConnection.CreateSession() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 111
at MonoTouch.Design.Client.ServerProcessConnection.b__28_0() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 116
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task1.get_Result() at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass289_11.b__1(Task1 t) in E:\A\_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 2073 at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass289_01.<EnsureSession>b__0() in E:\A\_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 2139 at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MonoTouch.Design.Client.IPhoneDesignerSession.d__191.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 748
--- End of stack trace from previous location where exception was thrown ---
at MonoTouch.Design.Client.IPhoneDesignerSession.d__191.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 755
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MonoTouch.Design.Client.IPhoneDesignerSession.d__190.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 733
--- End of stack trace from previous location where exception was thrown ---
at MonoTouch.Design.Client.IPhoneDesignerSession.d__190.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 741
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at MonoTouch.Design.Client.IPhoneDesignerSession.d__186.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 622
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MonoTouch.Design.Tasks.d__1.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Shared\TaskExtensions.cs:line 28
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MonoTouch.Design.Client.IPhoneDesignerSession.d__185.MoveNext() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 574
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> MonoTouch.Design.Client.InvalidSessionException: Error in the application.
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest(CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 235
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest[TResponse](CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 252
at MonoTouch.Design.Client.ServerProcessConnection.CreateSession() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 111
at MonoTouch.Design.Client.ServerProcessConnection.b__28_0() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 116
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task1.get_Result() at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass289_11.b__1(Task1 t) in E:\A\_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\IPhoneDesignerSession.cs:line 2073 at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) MonoTouch.Design.Client.InvalidSessionException: Error in the application.
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest(CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 235
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest[TResponse](CommandRequest req, Boolean throwIfNotRunning) in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 252
at MonoTouch.Design.Client.ServerProcessConnection.CreateSession() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 111
at MonoTouch.Design.Client.ServerProcessConnection.b__28_0() in E:\A_work\129\s\Xamarin.Designer.iOS\MonoTouch.Design.Client\Connection\ServerProcessConnection.cs:line 116
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)<---
<---

and the listing goes on and on - way too long for this post...

Getting Native View of Xamarin Forms Custom Control (Android)

$
0
0

Hi,
I need to embed a forms control in a existing native xamarin application.
The native android controls are placed inside a linear layout.
The new forms control should be rendered next to the native controls.

Regards
Ronny


Bluetooth Low Energy advertising with custom LocalName Xamarin Forms

$
0
0

Hi everyone,
I meet the problem, that I have to advertise custom name (LocalName) on both Android and iOS via Bluetooth Low Energy.
I use Gatt Server functionality from this plugin github.com/aritchie/bluetoothle
But it mentioned that it can't advertise LocalName on Android specifically github.com/aritchie/bluetoothle/blob/master/docs/advertising.md . I don't know why. But device is only searchable without name (N/A) when running on Android.

Do someone know how to get around of this limitation?

imagenes no aparecen

$
0
0

Hola a todos tengo una aplicacion web con asp net core y xamarin form en donde envio las imagenes a mi movil pero no aparecen las envio por uri y estoy usando una direccion ssl, pero no me muestran las imagenes y si estan bien dioreccionadas, favor au ayuda comunidad

How to set opacity for a stack layout, excluding labels

$
0
0

I am trying to set a whole stack layout and a frame child to 0.3 opacity with c#, but when I set the Opacity property, it sets it to the child labels too.

XF4.3 Relative Bindings - Anyone able to make it work?

$
0
0

I was very excited to read that Xamarin would finally have Relative Binding.

However its seems to be just plain unrecognized to my IDE.
Visual Studio 2019, latest as of 15nov2019
Xamarin.Forms 4.3.xx, latest as of 15nov2019
New-ish basic app from current templates, that I use for testing such things.

I try the markup as described both in the docs and the blog... Nope. Unrecognized and doesn't bind to the property.

<ContentView
    x:Class="MCRUX.Controls.ButtonFramed"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    x:Name="thisButton"
    mc:Ignorable="d"
    BindingContext="{Binding Source={RelativeSource Self}, Path=DefaultViewModel}">
{...}

Has anyone else made it work? Is there a tip/trick in the documentation I'm just missing? Does it require an experimental SetFlags like CollectionView_Experimental and Shell_Experimental required?

Dotfuscator error

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>