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

FFImageLoading is Not Loading Image From App Sandbox in Xamarin.Forms UWP

$
0
0

I am using a Xamarin.Forms UWP app that has image "myicon.png" downloaded to its sandbox location. It's path is like below and I can see it and in Windows Explorer and open the image in MS Paint for example. That prooves that the image exists in the App Sandbox:
"C:/Users/me/AppData/Local/Packages/f040f23f-de21-4722-832d-7b617ef7fbe1_16fy7p00psw5z2/LocalState/se/resources/resources/plugins/spseplugin/myicon.png"

So, the image is not added to project structure (neither PCL nor UWP) but it is available in the app sandbox location.

I am trying to load that image and show it in StackLayout in my UWP app using FFImageLoading library for performance reason as it does image caching. In order to do so, I am doing following:

  1. I have downloaded Nuget for FFImageLoading and it is added to my references
  2. In UWP App.xaml.cs, I added following as per FFImageLoading GitHub documentation instructions:
                        var assembliesToInclude = new List<Assembly>()
                        {
                            typeof(CachedImage).GetTypeInfo().Assembly,
                            typeof(CachedImageRenderer).GetTypeInfo().Assembly
                        };
                        Xamarin.Forms.Forms.Init(e, assembliesToInclude);
  1. In my UWP MainPage.xaml.cs, I added following line in MainPage c-tor just after call to InitializeComponent, also as per FFImageLoading GitHub instructions:
    CachedImageRenderer.Init();

  2. Add xmlns namespace for FFImageLoading library in my XAML:
    xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"

  3. Add FFImageLoading CachedImage to my StackLayout:

        <ff:CachedImage       <-- using CachedImage wont show image. Using Image will show it.
          Source="{Binding ImageUri}" 
          WidthRequest="20" 
          HeightRequest="20" 
          VerticalOptions="Center" 
          DownsampleToViewSize="True" />

Above, ImageUri is a property on my view-model and putting break point on it shows that it is set to the image file path I showed above.

Using FFImageLoading CachedImage however is not showing the image when I run my app whereas Image (Xamarin Image View) is showing it fine.


SDK Changed Application not running

$
0
0

Plz help me
when i changed the SDK version and run the application getting the execution failed message.

Xamarin.Forms App Crashing On Click Event Handler

$
0
0

Hi
I have created a small app using Visual Studio for Mac for iOS with Xamarin Forms. It has three XAML pages. Since this application intends to send message which can not be accomplished using simulator, therefore, I tried using Xamarin Live on my iPhone. The application is installed and shows OK on iPhone Xamarin Live but when I tap on a button on home page it takes us to Message page exactly as intended. There is a send message button on the Message page, when this button is clicked an exception shows up stating 'Uncaught Exception: The index was out of bounds of the array (IndexOutOfRangeException)'. It appears as if it is a problem with page stack, but unfortunately, I am not able to nail it down. Below is the code.

Click Handler on the Home Page

       if (xMessagePage == null)
            xMessagePage = new xMessagePage();
        try
        {
            await Navigation.PushAsync(xMessagePage);
        }
        catch(Exception ex)
        {
            DisplayAlert("BtnMessage_Clicked", ex.Message, "OK");
        }

Click Handler on the message page which tries to bring up the UIActivityViewController

    public void BtnMessage_Clicked(Object sender, EventArgs eArgs)
    {
        uMessageController umc = new uMessageController();

        try
        {
             umc.SendTextMessage("en-us", eMessageType.Text);
        }
        catch(Exception ex)
        {
            uShareMessages.ShowMessageBox("Message_Clicked", ex.Message);
        }
        finally
        {
        }
    }

void uMessageController::SendTextMessage(string strTextMsg, "en-us", eMessageType.Text)
{
try
{
string strDefaultMsg = "MyTest Message1"
string strDefAttachmentName = "NYC";
if(string.IsNullOrEmpty(strTextMsg))
strTextMsg = strDefaultMsg;
string strTextMsg1 = uShareMessages.GetMessageString(strCulture);
string existingSound = NSBundle.MainBundle.PathForResource(strDefAttachmentName, "mp3");

            var remFileUrl = NSUrl.FromFilename(existingSound);

            lstMessageItems = new System.Collections.Generic.List<NSObject> { new NSString(strTextMsg1 ?? string.Empty) };
            lstMessageItems.Add(remFileUrl);
            UIActivityViewController avController = new UIActivityViewController(lstMessageItems.ToArray(), null);

            avController.ExcludedActivityTypes = vcActivitiesExcluded;
            avController.CompletionWithItemsHandler = ActivityViewController_CompletionHandler;
            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(avController, true, null);

        }
        catch(Exception ex)
        {
            uShareMessages.ShowMessageBox("SendTextMessage", ex.Message);
        }

}
Thanks in advance,
Paraclete

Picker in ListView

$
0
0

I have picker in each row of listview. How to get value of picker as well as from which row it is selected in Xamarin.Forms

How to Image Processing within a Box or Frame?

$
0
0

Hi,

I have an app which requires items photos.

The item photo must 300wx200h

I am just starting with Xamarin images and needs guide please..

How can I allow user to take a photo from camera {OR SELECT FROM DEVICE ALBUM} and then position the photo inside the box/frame by reposition or by cropping?

Thanks,
Jassim

how would i show images in thumbnail view please someone help me

$
0
0


see the image ,as shown like in image i need in my pcl project ,thank you

Adding rows to a grid using MVVM

$
0
0

On a page where I am displaying a receipt to a user, I have a section which lists the subtotal, any taxes, and the total. Since the taxes applicable vary by region and based on the products being sold, the number of rows in this section will vary. For example, here are 3 separate orders, one with GST and PST, one with just GST, and one with neither:



I've accomplished this by putting just the SubTotal in the grid in XAML, and adding the rest in the code-behind in a method I call from the ViewModel. However, I'd really like to avoid doing it this way, so I'm wondering if there is an approach to accomplishing this which doesn't require having a bunch of code in the View's code-behind. I'd like to do this while keeping the columns nicely aligned as if they were in a single grid, and without adding any weird spacing between the rows.

how to remove default blue colored splaash screen from xamarin forms ios

$
0
0

I want to remove default blue colored splash screen from Xamarin Forms ios App...anyone please help me out
Advance thanks


Xamarin.iOS App crashes during async call of SQLite Connection

$
0
0

I am working on a Xamarin.iOS project. I would like to insert some data into my SQLite database. When i try to do this I get the following exception only on my devices (iPhone 5s & iPad2).

The thread 'Unknown' (0x12) has exited with code 0 (0x0).
[0:] Object reference not set to an instance of an object
[0:] at System.Threading.Tasks.Task.AddTaskContinuationComplex (System.Object tc, System.Boolean addBeforeOthers) [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:4747
at System.Threading.Tasks.Task.AddTaskContinuation (System.Object tc, System.Boolean addBeforeOthers) [0x00023] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:4817
at System.Threading.Tasks.Task.SetContinuationForAwait (System.Action continuationAction, System.Boolean continueOnCapturedContext, System.Boolean flowExecutionContext, System.Threading.StackCrawlMark& stackMark) [0x00063] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3019
at System.Runtime.CompilerServices.TaskAwaiter.OnCompletedInternal (System.Threading.Tasks.Task task, System.Action continuation, System.Boolean continueOnCapturedContext, System.Boolean flowExecutionContext) [0x00010] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:223
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].UnsafeOnCompleted (System.Action continuation) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:347 at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_gsharedvt_constrained_call (intptr,intptr,intptr,intptr,intptr) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].AwaitUnsafeOnCompleted[TAwaiter,TStateMachine] (TAwaiter& awaiter, TStateMachine& stateMachine) [0x0004c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:559
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_1 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1034
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1306
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1283
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:856
at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func`1[TResult] callback) [0x00006] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/ObjCRuntime/Runtime.cs:231
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1208
[0:]
The app has been terminated.

The main problem is that it is working perfectly fine on Android, UWP and even on the iOS emulator.
In the code below you see the SQLLite connection which i try to use:

var _database = new SQLiteAsyncConnection(path,SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex);
var result = await _database.UpdateAsync(model);

After connecting the program continues gets some models from my WebAPI. Then I want to insert the models into my database but the exception listed above is occuring.

Could it be that I have to set any permissions on my devices or is it possible that there is a thread in the background which is not working correctly?

Any answers or tips would be great.

Kind regards,

Daniel

IMAGE CROP and RESIZE in Xamarin Forms

$
0
0

Need to implement image resizing and cropping in Xamarin Forms

How to set a button with an underscore?

$
0
0

I want to set a button with an underscore;I have created a button inheritance and ButtonRenderer on the iOS and Android projects, but I can't set the underscore. Can anyone tell me how to do this?Thank you very much!

Xamarin.Forms.GoogleMaps not showing on Android

$
0
0

Hi,

I've been developing an application based around the Xamarin.Forms.GoogleMaps control. It's all been going great in the development stages, There was limited documentation for Android, but it's been working in dev, It's only since I've put it on the store for beta testing that I'm having issues.

I have the below markup in my AndroidManifest.xml

<application android:label="APPNAME" android:icon="@drawable/icon">
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="API_KEY" />
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    </application>

I have signed the app with the KeyStore file and pulled out the SHA1 fingerprint which I've added to the google developer API console alongside the debug key I also have added.

So the issue is the Map control displays in Debug (so it must be hooked up to the API console because the debug key is in there) and it's not working after submitting to the store for BETA testing.

So I think I must be missing something really simple, I've had the standard Xamarin.Forms.Map control working on the store in the past - Is the setup slightly different for the Xamarin.Forms.GoogleMaps one?

Thanks in advance.

Thanks,
Sean

Image Cropping and Rotating

$
0
0

I'm looking for a good way to crop and rotate images cross platform. The most important being iOS and Android. To crop the images I wanted to be able to implement a pinch zoom and pan type gestures to move the image around to be able to crop. Something similar to instagram. Anyone have any suggestions?

xamarin forms

Xamarin Forms Drag Image

$
0
0

A feature of my app is the ability to drag a small image along a specific pattern like the shape of the letter H. Looking for ideas on how I can accomplish this. I am assuming I will be implementing the dragging on a canvas but not sure how to contain the dragging only to the shape/pattern.


Xamarin Forms PCL - iOS - Video in WebView keeps playing on the background

$
0
0

Problem:

•Push a new page with a WebView

•Play a video on the page (try Youtube)

•Pop the page

•Sound is still playing in the background

•Switch to a different app on the phone

•Sound is still playing in the background

Why is this happening and how can I stop it?

This happens only in iOS devices, not on Android.

Any help or guidance you could offer is greatly appreciated.

Missing references

$
0
0

I wanted to give a try to Xamarin Live Play (on my API 19 tablet) and my project is showing me this:

The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
error: The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
error: The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
error: The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
error: The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
error: The type or namespace name 'Plugin' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'ISettings' could not be found (are you missing a using directive or an assembly reference?)....etc

This is a project I've moved to .NET standard 2.0 (VS 2017 15.5).
I've tried with my old project and it was compiling very well with Xam Live Play (except that it doesn't show up on screen: "visualization error not a widening conversion").

issues with iphone x safe area top

$
0
0

i have included safeareatop in Appdelegate to make it compatible for iphone x.so now the code is working fine in ios 11.but its crashing in the ios 10.3 version.can anyone help to fix this issue

System.NotSupportedException: No data is available for encoding 51936 (#598)

$
0
0
System.NotSupportedException: No data is available for encoding 51936 (#598).

Can i use multiple view model for a single view in MVVM pattern in xamarin forms?

$
0
0

Hi,

I want to use multiple view model for a single view in mvvm pattern in xamarin form. Please explain me.

Viewing all 58056 articles
Browse latest View live


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