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

Localization- Resources update on CurrentUICulture change, but View strings don't. Is this expected?

$
0
0

I recently read through the Xamarin Localization docs, but I'm having trouble with some of the details they don't elaborate on. Mainly, if a user is allowed to choose a new language in the app at runtime, how can I update the page views referencing strings in the .resx localization resources? Why wouldn't they update on their own?

Current situation - When I change the CurrentUICulture to a new value, the referenced resource data updates automatically (which can be proven by outputting something like AppResources.title1 to the console), but none of the existing views update their text on the page. (To clarify, newly created Views display the new strings fine, but already existing views remain the same.) It was never mentioned in the docs if this was expected behavior or not, and I don't want to make assumptions. Perhaps someone can help clear this up for me.

Are the views expected to update their display automatically when the underlying resource data changes?
If not, is there a recommended way to support this behavior?


How to set Embedded font support for Native platforms?

$
0
0

Hi,
I am working on embedded font in xamarin forms. I have implemented custom controls, one control is in Xamarin forms, where the embedded font support is working fine.
Next custom control rendered in native platforms, Where the embedded font support is not working.

How to implement embedded font support in native platforms?

Thanks in advance

Crash on foregrounding app iOS

$
0
0

If I background the app and then foreground, I get an ArgumentNullException that doesn't seem to touch my code. What could I be doing wrong? Or should I log a bug?

ios:13.5.1
Xamarin.Forms 4.7.0.1080
Xamarin 16.6.000.1062 (d16-6@41e1f0e)
Xamarin.iOS and Xamarin.Mac SDK 13.18.2.1 (29c4ea7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Stack Trace from Debugger:
System.ArgumentNullException

Value cannot be null.
Parameter name: enumerable

at Xamarin.Forms.Internals.EnumerableExtensions.IndexOf[T] (System.Collections.Generic.IEnumerable1[T] enumerable, T item) [0x00003] in <d38e76fdc23646f49d3b65e0bfb375de>:0 at Xamarin.Forms.Application.OnRequestedThemeChanged (Xamarin.Forms.AppThemeChangedEventArgs args) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Application.cs:172 at Xamarin.Forms.Platform.iOS.PageRenderer.TraitCollectionDidChange (UIKit.UITraitCollection previousTraitCollection) [0x00021] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:373 at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65 at RemoteApp.Forms.iOS.Application.Main (System.String[] args) [0x00001] in /Users/collinfe/Documents/UnifyVehicleRemote/src/RemoteApp.Forms.iOS/Main.cs:17

Native crash log:
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Thread 0 name: tid_407 Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x0000000189d9dd88 __pthread_kill + 8 1 libsystem_pthread.dylib 0x0000000189cb61e8 pthread_kill$VARIANT$mp + 136 2 libsystem_c.dylib 0x0000000189c099b0 __abort + 112 3 libsystem_c.dylib 0x0000000189c09940 __abort + 0 4 RemoteApp.Forms.iOS 0x00000001072bf774 xamarin_printf + 79918964 (runtime.m:2468) 5 RemoteApp.Forms.iOS 0x000000010718a634 mono_invoke_unhandled_exception_hook + 78652980 (exception.c:1299) 6 RemoteApp.Forms.iOS 0x0000000107127e80 mono_handle_exception_internal + 78249600 (mini-exceptions.c:2783) 7 RemoteApp.Forms.iOS 0x0000000107126868 mono_handle_exception + 78243944 (mini-exceptions.c:3107) 8 RemoteApp.Forms.iOS 0x000000010711d334 mono_arm_throw_exception + 78205748 (exceptions-arm64.c:401) 9 RemoteApp.Forms.iOS 0x00000001030c0edc throw_exception + 172 10 RemoteApp.Forms.iOS 0x000000010341addc Xamarin_Forms_Internals_EnumerableExtensions_IndexOf_T_REF_System_Collections_Generic_IEnumerable_1_T_REF_T_REF + 14233052 (/D:\a\1\s\Xamarin.Forms.Core\EnumerableExtensions.cs:81) 11 RemoteApp.Forms.iOS 0x000000010316e310 Xamarin_Forms_Application_OnRequestedThemeChanged_Xamarin_Forms_AppThemeChangedEventArgs + 11428624 (/D:\a\1\s\Xamarin.Forms.Core\Application.cs:172) 12 RemoteApp.Forms.iOS 0x0000000105f9a98c Xamarin_Forms_Platform_iOS_PageRenderer_TraitCollectionDidChange_UIKit_UITraitCollection + 59845004 (/D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:375) 13 RemoteApp.Forms.iOS 0x0000000103003860 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272 14 RemoteApp.Forms.iOS 0x0000000107138388 mono_jit_runtime_invoke + 78316424 (mini-runtime.c:3165) 15 RemoteApp.Forms.iOS 0x00000001071e65d4 mono_runtime_invoke_checked + 79029716 (object.c:3220) 16 RemoteApp.Forms.iOS 0x00000001071e9a3c mono_runtime_invoke + 79043132 (object.c:3107) 17 RemoteApp.Forms.iOS 0x000000010268ce48 native_to_managed_trampoline_5(objc_object*, objc_selector*, _MonoMethod**, objc_object*, unsigned int) + 20040 (registrar.m:228) 18 RemoteApp.Forms.iOS 0x000000010270e494 -[Xamarin_Forms_Platform_iOS_PageRenderer traitCollectionDidChange:] + 550036 (registrar.m:49197) 19 UIKitCore 0x000000018da0a308 -[UIViewController _traitCollectionDidChange:] + 204 20 UIKitCore 0x000000018da0a5cc -[UIViewController _updateTraitsIfNecessary] + 372 21 UIKitCore 0x000000018e503414 -[UIView+ 15606804 (CALayerDelegate) layoutSublayersOfLayer:] + 1048 22 QuartzCore 0x0000000190a96724 -[CALayer layoutSublayers] + 284 23 QuartzCore 0x0000000190a9c87c CA::Layer::layout_if_needed+ 1407100 (CA::Transaction*) + 468 24 QuartzCore 0x0000000190aa73c0 CA::Layer::layout_and_display_if_needed+ 1450944 (CA::Transaction*) + 140 25 QuartzCore 0x00000001909eff1c CA::Context::commit_transaction+ 700188 (CA::Transaction*, double) + 296 26 QuartzCore 0x0000000190a198bc CA::Transaction::commit+ 870588 () + 676 27 UIKitCore 0x000000018e0589f4 __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke_4 + 44 28 UIKitCore 0x000000018e057dd0 -[UIApplication _performWithUICACommitStateSnapshotting:] + 184 29 UIKitCore 0x000000018e05892c __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke_2 + 552 30 UIKitCore 0x000000018e4f61cc +[UIView+ 15552972 (Animation) performWithoutAnimation:] + 96 31 UIKitCore 0x000000018e0586cc __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke + 216 32 UIKitCore 0x000000018d665540 -[UIScene _applyOverrideSettings:forActions:] + 116 33 UIKitCore 0x000000018e294fa4 -[UIWindowScene _applySnapshotSettings:forActions:] + 76 34 UIKitCore 0x000000018e05859c -[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:] + 380 35 UIKitCore 0x000000018e059f38 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_3 + 124 36 FrontBoardServices 0x000000018f166538 -[FBSSceneSnapshotAction _executeNextRequest] + 256 37 FrontBoardServices 0x000000018f16658c -[FBSSceneSnapshotAction _executeNextRequest] + 340 38 FrontBoardServices 0x000000018f166128 -[FBSSceneSnapshotAction executeRequestsWithHandler:completionHandler:expirationHandler:] + 276 39 UIKitCore 0x000000018e059e60 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_2 + 280 40 UIKitCore 0x000000018e0593c8 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:] + 1028 41 UIKitCore 0x000000018e059d20 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke + 132 42 UIKitCore 0x000000018d665438 -[UIScene _enableOverrideSettingsForActions:] + 60 43 UIKitCore 0x000000018d6656b8 -[UIScene _performSystemSnapshotWithActions:] + 120 44 UIKitCore 0x000000018e059a9c -[UIApplication _performSnapshotsWithAction:forScene:completion:] + 468 45 UIKitCore 0x000000018e594968 __98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_3 + 168 46 UIKitCore 0x000000018e5947f0 __98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_2 + 468 47 UIKitCore 0x000000018d664cb4 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 664 48 UIKitCore 0x000000018d665cac -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220 49 UIKitCore 0x000000018dbebafc -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464 50 FrontBoardServices 0x000000018f1200a8 -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:] + 528 51 FrontBoardServices 0x000000018f144684 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke_2 + 120 52 FrontBoardServices 0x000000018f129bfc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 53 FrontBoardServices 0x000000018f1445b8 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke + 184 54 libdispatch.dylib 0x0000000189c6e524 _dispatch_client_callout + 16 55 libdispatch.dylib 0x0000000189c17434 _dispatch_block_invoke_direct$VARIANT$mp + 224 56 FrontBoardServices 0x000000018f168850 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40 57 FrontBoardServices 0x000000018f16851c -[FBSSerialQueue _queue_performNextIfPossible] + 404 58 FrontBoardServices 0x000000018f168a44 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 59 CoreFoundation 0x0000000189f26c18 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 60 CoreFoundation 0x0000000189f26b70 __CFRunLoopDoSource0 + 80 61 CoreFoundation 0x0000000189f262f8 __CFRunLoopDoSources0 + 184 62 CoreFoundation 0x0000000189f21328 __CFRunLoopRun + 788 63 CoreFoundation 0x0000000189f20ce8 CFRunLoopRunSpecific + 424 64 GraphicsServices 0x000000019406b38c GSEventRunModal + 160 65 UIKitCore 0x000000018e04f444 UIApplicationMain + 1932 66 RemoteApp.Forms.iOS 0x0000000105a33798 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 344 67 RemoteApp.Forms.iOS 0x000000010516b020 UIKit_UIApplication_Main_string___intptr_intptr + 44970016 (UIApplication.cs:86) 68 RemoteApp.Forms.iOS 0x000000010516aea4 UIKit_UIApplication_Main_string___string_string + 44969636 (UIApplication.cs:66) 69 RemoteApp.Forms.iOS 0x000000010273c190 RemoteApp_Forms_iOS_Application_Main_string__ + 737680 (Main.cs:17) 70 RemoteApp.Forms.iOS 0x0000000103003860 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272 71 RemoteApp.Forms.iOS 0x0000000107138388 mono_jit_runtime_invoke + 78316424 (mini-runtime.c:3165) 72 RemoteApp.Forms.iOS 0x00000001071e65d4 mono_runtime_invoke_checked + 79029716 (object.c:3220) 73 RemoteApp.Forms.iOS 0x00000001071eb878 mono_runtime_exec_main_checked + 79050872 (object.c:5284) 74 RemoteApp.Forms.iOS 0x000000010711ce74 mono_jit_exec + 78204532 (driver.c:1328) 75 RemoteApp.Forms.iOS 0x00000001072cfd84 xamarin_main + 79986052 (monotouch-main.m:485) 76 RemoteApp.Forms.iOS 0x000000010273c094 main + 737428 (main.m:186) 77 libdyld.dylib 0x0000000189da88f0 start + 4

Will my app be rejected because it has WebView of Payment Gateway in it?

$
0
0

I am working on to create a Xamarin Forms app (For Android and iOS both platforms) which will have payment gateway to accept payments from customers. Currently I am using WebView in my app to open the payment page URL. So, my question is that will my app be rejected on Play Store or Apple Store because it is based on WebView? If yes, then is there any alternative to WebView?

record the sound of a phone

$
0
0
Hello
How can I record the sound of a phone ringing and picking it up?
Like audio recording software

Android push notifications “Message was successfully sent, but there were no matching targets."

$
0
0

I am trying to setup push notifications on a Xamarin.Forms Android app following this tutorial and this sample. My AndroidManifest.xml, FirebaseService.cs and MainActivity.cs are basically the same as the sample. When I fire up the Android Emulator and do a Test Send from Azure Notification Hubs I get: "Message was successfully sent, but there were no matching targets." Is that tutorial outdated?

How to prevent UWP map from automatically panning to user location

$
0
0

Very frustrating.

I have a map with a ZoomToFeatures method which successfully zooms and pans the map such that all elements are shown on screen. It works well on Android.

However... On UWP the method also works fine, but as soon as the device has been given my GPS co-ordinates, it pans to those co-ordinates instead. There doesn't seem to be any way I can override this or tell it not to.

Have I missed something somewhere? How can I prevent this annoying 'feature' from happening? I want to keep the user location showing on the map, so I can't just turn that part off.

Thanks.

How to find out selected date in calendar

$
0
0

Hi,
I am trying to assert that current date is selected in calendar. I can see in Repl(); that what makes it selected is that it belongs to some "class": "MonthViewItem > CellTextView"

However I am not able to query for that class. I tried lots of things but none of them works.
For example I was expecting this to work but it doesn't it gives empty array:
app.Query(x => x.Class("MonthViewItem").Class("CellTextView").Marked("Thursday 09/July/2020"));

This doesn't work as well:
app.Query(x => x.Class("MonthViewItem > CellTextView"));

Is there an easy way how to get date which selected in calendar?

Thank you.


(Prism) Binding DelegateCommand not updating in Xaml

$
0
0

I'm using Prism. I can't seem to get DelegateCommand binding working in Xaml. I create the binding after receiving the Fault object from the previous ViewModel.

The ViewModel.

        public class FaultEditPageViewModel : ViewModelBase
        {

            private FaultModel _fault;
            public FaultModel Fault
            {
                get => _fault;
                set => SetProperty(ref _fault, value);
            }

            public DelegateCommand FaultEditCommand { get; set; }

            public FaultEditPageViewModel(INavigationService navigationService) : base(navigationService)
            {
                Title = "Muokkaa kone- ja laitevikaa";

                FaultEditCommand = new DelegateCommand(FaultEdit);
            }

            public override void OnNavigatedTo(INavigationParameters parameters)
            {
                Fault = parameters["fault"] as FaultModel;

                if (Fault.WorkToBeDoneArray != null)
                {
                    foreach (var WorkToBeDone in Fault.WorkToBeDoneArray)
                    {
                        // DelegateCommand doesn't work?? xaml doesn't get notified of this

                        WorkToBeDone.WorkToBeDoneDeleteCommand = new DelegateCommand<WorkToBeDoneArray>(WorkToBeDoneDelete);
                    }
                }

                // same here, xaml doesn't get notified of this

                Fault.WorkToBeDoneAddCommand = new DelegateCommand(WorkToBeDoneAdd);
            }

            private void WorkToBeDoneAdd()
            {
                Debug.WriteLine("WorkToBeDoneAdd");

                Fault.WorkToBeDoneArray.Add(new WorkToBeDoneArray
                {
                    WorkToBeDoneDeleteCommand = new DelegateCommand<WorkToBeDoneArray>(WorkToBeDoneDelete)
                });
            }

            private void WorkToBeDoneDelete(WorkToBeDoneArray WorkToBeDone)
            {
                Debug.WriteLine("WorkToBeDoneDelete");

                Fault.WorkToBeDoneArray.Remove(WorkToBeDone);
            }
    }

The Model, contains a lot of data, simplified it.

    public class WorkToBeDoneArray
    {
        [JsonProperty("description")]
        public string Description { get; set; }

        public DelegateCommand<WorkToBeDoneArray> WorkToBeDoneDeleteCommand { get; set; }
    }

    public class FaultModel
    {
        [JsonProperty("workToBeDoneArray")]
        public ObservableCollection<WorkToBeDoneArray> WorkToBeDoneArray { get; set; }

        public DelegateCommand WorkToBeDoneAddCommand { get; set; }
    }

Xaml, simplified.

    <ScrollView>
        <StackLayout Padding="20, 20, 20, 20">
            <StackLayout BindingContext="{Binding Fault}">
                <Label Text="Tehtävät työt" FontAttributes="Bold"/>
                <Button Text="Lisää työtehtävä" Command="{Binding WorkToBeDoneAddCommand}"/>
                <StackLayout BindableLayout.ItemsSource="{Binding WorkToBeDoneArray}">
                    <BindableLayout.ItemTemplate>
                        <DataTemplate>
                            <StackLayout>
                                <Label Text="Tehtävä työ" FontAttributes="Bold"/>
                                <Entry Text="{Binding Description}" Placeholder="Tehtävä työ" />
                                <Button Text="Poista työtehtävä" Command="{Binding WorkToBeDoneDeleteCommand}" CommandParameter="{Binding}"/>
                            </StackLayout>
                        </DataTemplate>
                    </BindableLayout.ItemTemplate>
                </StackLayout>
            </StackLayout>
            <Button Text="Muokkaa" Command="{Binding FaultEditCommand}" />
        </StackLayout>
    </ScrollView>

Unrelated to this issue but does anyone know why I cant register nor login using Firefox, it just hangs/loads forever.

embed camera view in stacklayout and get image bytes

$
0
0

hi there, is there a plug in which lets me open camera inside a stacklayout, then get image bytes whenever I wish ?
all without having to save to phone

any help is truly appreciated !

How to force garbage collection including large memory heap?

$
0
0

Normally when working in C#, if I want to force a garbage collection, including the large object heap, I would do the following (possibly with extra args on the GC.Collect call):

GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
GC.WaitForPendingFinalizers();

Building for mobile using Xamarin.Forms, I don't see the LargeObjectHeapCompactionMode property on GCSettings. Is there an alternative way of forcing everything that is unreferenced to be garbage collected when using XF?

I want to include some code during development that at the press of a button will check that all of my page objects (other than the current page) are no longer referenced. The base class that I use for all page objects keeps track of whether a particular page type has been instantiated but not yet finalized. However, I need to be able to force the finalize of all unreferenced objects when I press the button.

Shell Navigation - parameters

$
0
0

Hi.
I have problem with parameters in navigation.

I defined a few routes in AppShell, routes like "myitems" and "additem".

To navigate to add view from "myitems" I'm using
string uri = $"//additem?code={code}"; await AppShell.Current.GoToAsync(uri);

And also I added property to additem code behind
[QueryProperty("ItemCode", "code")]

After that in class I added two variables in this class
private string itemCode; public string ItemCode { set { itemCode= Uri.UnescapeDataString(value); } get { return itemCode; } }

And I want to pass this value to ViewModel. ViewModel is created in constructor and one of the parameters is this code.
Unfortunately the set is called after operations in constructor. What can I do to have the parameter while I'm creating viewmodel object in constructor?

Cannot debug my App on a physical device

$
0
0

I have an odd issue which has just appeared - my App was last built a few months ago and everything was fine then but as often happens when i have come back to it I have issues getting it to build and run. My issue now is a bit weird. I build everything on my PC using a connected MAC as I have had endless issues building directly on the MAC itself. The app will build and run fine in any of the simulators however when I select to build for iPhone and then select my test phone as the device it doesn't work correctly - I still see in my build window that the configuration being built is 'iPhoneSimulator' and not 'iPhone' and indeed after the build the simulator is invoked and the App run there. Unfortunately my test is to check on invocation of another App from my app and so I need to debug on a physical device...

How to catch a timeout exception

$
0
0

I am working on a Xamarin Forms application that supports both android and iOS. In my application HTTPClient have a time out of 30 seconds and when there is no response with in mentioned time out, it is throwing a exception. tried to catch the exception using TaskCanceledException and TimeoutException but it was triggering none of these these exception. Please some help me by sharing more information on how we will be able to identify the time out exception in our xamarin forms application.

The exception that was caught was something line Java.IO.IOException when testing my app in android version. Any info will be helpful. Is there any one who have ran into the same issue.

Xamarin Fomrs: Issue with text to speech feature for HTML data.

$
0
0

I am using the Label for showing HTML data on UI with TextType="Html" property. That feature works well and on UI HTML content gets converted to normal text.

I am also implemented text to speech features using Xamarin Essentials. When the TTS function starts I am highlighting the corresponding text using span property.

When the TTS function starts, the normal text gets converted into HTML data. How I fix this issue?

Screenshot:

enter image description here

I have uploaded a sample project here for the reference.


UWP CarouselView, how to remove/hide navigation buttons

$
0
0

When mouse over a CarouselView, navigation buttons appear on the sides of the screen.

Obviously, because it's not comfortable to do a swipe gesture with mouse.

Is there a way to hide them?
I want to implement custom buttons for navigation.

Ideally is to remove swipe gestures and side buttons, like InputTransparent parameter does. Ideally...

AdMob Package Installation Error

$
0
0

I've gotten close to finishing an Android App... I need to add in AdMob, and started a new project for testing... I create a NEW blank Xamarin app for Android Only... I do not update anything... However, AdMob NuGet package will not install... Any feedback would be appreciated.

List / MVVM model: how to pass a List from a page to another page and display it.

$
0
0

I have a list ("errores") and wish to pass it to another view so I can display it there using a listview. I've tried sending "errores" as a parameter, but it's not being displayed in my next view. Thank you!

QuizPageModel.cs

private async Task ShowResults() => await Application.Current.MainPage.Navigation.PushAsync(new RESULTSPAGE2(errores));

}

}


RESULTSPAGE.xaml

<ContentPage.Content>

    <ListView x:Name="MainListView">

        <ListView.ItemTemplate>

            <DataTemplate>

                <TextCell Text="{Binding errores}"/>

            </DataTemplate>

        </ListView.ItemTemplate>


    </ListView>
    </ContentPage.Content>


RESULTSPAGE2.xaml.cs

public partial class RESULTSPAGE2 : ContentPage
{
public List errores;

    public RESULTSPAGE2()
    {
        InitializeComponent();

        MainListView.ItemsSource = errores;
    }

    public RESULTSPAGE2(List<Question> errores)
    {
        this.errores = errores;
    }
}

}

warning about Task.Run()

$
0
0

Hi All,

I have a question about how to use Task.Run(). Code is like below:

public async Task GetResult()
{
Result result = new Result:

  result = await new Manipulator().GetResult();

  if (result.Valid)
  {
   ApiManager mgr = new ApiManager ();
       Task.Run( async () => await mgr.UploadResult ( result ));          // just send result to server, as it takes a bit time, so don't wait here.
  }

 return result;

}

Code is above, should I use Task.Run() there for the task which I don't need to wait for result?
And I get a warning for the Task.Run():
"Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call."

Do I need to worry about this warning or is there a better way to do it?

Thanks in advance.

Ting

MVVM viewmodel deselect listview item

$
0
0

Is there a way to deselect a listview item in a viewmodel without having to do it in the xaml code behind?

Viewing all 79144 articles
Browse latest View live


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