I know this should be trivial, but I haven't found a working example of loggin in using facebook or google for Xamarin Forms using Xamarin.Auth
Can anyone share a working project or point me to a repository with a working example?
Facebook & Google Login with Xamarin Forms using Xamarin.Auth
How to load a page with webview?
when i add to my project this class
using System;
using Xamarin.Forms;
namespace mynamespace
{
class WebViewDemoPage : ContentPage
{
public WebViewDemoPage()
{
Label header = new Label
{
Text = "WebView",
FontSize = 50,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.Center
};
WebView webView = new WebView
{
Source = new UrlWebViewSource
{
Url = "https://blog.xamarin.com/",
},
VerticalOptions = LayoutOptions.FillAndExpand
};
// Build the page.
this.Content = new StackLayout
{
Children =
{
header,
webView
}
};
}
}
}
in this line i
WebView webView = new WebView
have this message:
WebView is a namespace but is used like a type
If i add a ContentPage i get the same error, but if i remove it in other page(MainPage) i don't get this error, but if i add this class, in the MainPage i get this error too.
Few question from a newbie - MVVM, ViewModels and sln folders structure
Hey, I'm new into XF it's my third day of learning.
I didn't saw any FAQ of how questions should look so I will make one post with few.
First one, how your solution structure looks like? Default it's specific platform projects like "SolutionName.Droid" etc. and one project for entire shared code.
It's good or you making more project for shared code?
Second one, I have tabbed page with two content page.
App.xaml.cs:
this.MainPage = new NavigationPage(new MainPage());
From MainPage
this.Navigation.PushAsync(new MyTabbedPage());
MainPage.xaml.cs
`
MyTabbedPageViewModel vm = new MyTabbedPageViewModel(data);
this.BindingContext = vm;
this.Children.Add(new DetailsPage
{
Title = "Details",
BindingContext = vm
});
this.Children.Add(new AttendanceListPage
{
Title = "Attendance list",
BindingContext = vm
});
`
And it works. I can go to tabbed page and children content pages. The problem is when I clicking back button of tabbed page(this previous page arrow ).
First click resets the tabbedpage(I think it is recreated because my controls lost data) and then second click return to MainPage. Why?
Third question is about ViewModels. As you saw in previous question I have tabbedPage with tabbedPageViewModel and two contentPages but I don't have view models for them. It's one domain context from my perspective. Should I use one ViewModel for one View? If yes then:
Fourth, how to send data, messages between ViewModels/Pages if not via constructor?
If PageOne creates PageTwo it's easy via constructor. But When PageTwo want send some data back to PageOne. How to do that?
I read something about MessaginCenter. Is this the key to this?
Last question, should I use MVVM framework for Xamarin Forms?
I have read on stackoverflow that you should not use it because XF already has it in itself.
How is it? What do you think about it?
How to make a phone call in "native" Xamarin.Forms in Windows Phone...?
To XF, there is an example to make phone-calls over uri:
Device.OpenUri(new Uri("tel:012345-33-32"));
In the example, for WP an alert is shown ("not yet implemented" or similar).
This works on iOS and Andorid, but not on Windows Phone.
Question:
How to make a phone call in WP (similar to the example above)?
Thanks
Xamarin Forms using Socket Plugin - UDP send and receive example
Hi there,
Has anyone used socket plugin from @RyanDavis to send and receive UDP packets? We have a requirement to use it to broadcast and receive data via UDP sockets on Xamarin Forms.
If anyone has used it in the above mentioned situation, kindly advice how to do this with socket plugin (sockets-to-pci) from @RyanDavis.
Essential I have been able to do this with python sockets (code below):
broadcast_ip = "192.168.1.255"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
print('sending to: ', broadcast_ip, ' on: ', broadcast_port)
print('sending command: ', command)
s.sendto(command, (broadcast_ip, broadcast_port))
data = s.recvfrom(32) # buffer size is 1024 bytes
s.close()
print('data recv: ', data)
Need it to be find an equivalent for Xamarin Forms C#. Thank you.
JD
location permission
I'm building an app which needs acces to the device' GPS.
I followed this tutorial (https://github.com/jamesmontemagno/PermissionsPlugin) but the app doesn't prompt me to ask for permissions.
I've got this code in my mainactivity:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) { PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); }
This are the permissions in my AndroidManifest:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" />
App consuming a WCF service. How?
I never work with WCF. Today i received this Web Service
http://200.200.200.200/MyService/MyService.svc/Something(fictitious)
How can i consume this service? I've been doing with Web API but not WCF. What do i must to do?
__NSFastEnumerationMutationHandler
Hi, I spent several months to develop an app using xamarin.forms. However, my app intermittent crashes due to the __NSFastEnumerationMutationHandler exception. It is happening once in one or two days, very hard to trace, even if i can trace it. It is the monotouchexception and it will never stop at any part of the program. Please help and advice. By the way, it works fine with android platform.
I am using some of animations to built a learning tool. If i can't fix it, i need to revert back to swift/xcode. it is a great waste of my time.
Incident Identifier: DE7175B5-4A9E-4779-BFDE-0CA0573A60DE
CrashReporter Key: b64a9698dcf65065e54243890089d9329afbaa22
Hardware Model: iPad5,1
Process: LearningTool.iOS [324]
Path: /private/var/containers/Bundle/Application/2358804B-AC2C-44A2-A40B-E060530BEBCA/LearningTool.iOS.app/LearningTool.iOS
Identifier: sg.Learning.www.Learning-Tool
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: sg.Learning.www.Learning-Tool [428]
Date/Time: 2017-02-02 19:43:59.9418 +0800
Launch Time: 2017-02-02 19:34:43.5585 +0800
OS Version: iPhone OS 10.2.1 (14D27)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 6
Application Specific Information:
abort() called
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x1816751b8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x1800ac55c objc_exception_throw + 56
2 CoreFoundation 0x181674c00 __NSFastEnumerationMutationHandler + 128
3 UIKit 0x18751a494 -[UIView(Hierarchy) subviews] + 420
4 UIKit 0x187825188 -[UIView(CALayerDelegate) _wantsReapplicationOfAutoLayoutWithLayoutDirtyOnEntry:] + 72
5 UIKit 0x187520ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1252
6 QuartzCore 0x1849ce9d8 -[CALayer layoutSublayers] + 148
7 QuartzCore 0x1849c34cc CA::Layer::layout_if_needed(CA::Transaction*) + 292
8 QuartzCore 0x1849c338c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
9 QuartzCore 0x1849403e0 CA::Context::commit_transaction(CA::Transaction*) + 252
10 QuartzCore 0x184967a68 CA::Transaction::commit() + 512
11 LearningTool.iOS 0x100ec1bd8 wrapper_managed_to_native_ObjCRuntime_Messaging_void_objc_msgSend_intptr_intptr (/:1)
12 LearningTool.iOS 0x100e3ad08 CoreAnimation_CATransaction_Commit (CATransaction.g.cs:81)
13 LearningTool.iOS 0x100d6cf7c Xamarin_Forms_Platform_iOS_CADisplayLinkTicker_StartThread (/C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\CADisplayLinkTicker.cs:61)
14 LearningTool.iOS 0x10077d610 System_Threading_ThreadHelper_ThreadStart_Context_object + 192
15 LearningTool.iOS 0x10077b8ac System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 428
16 LearningTool.iOS 0x10077b6ec System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 44
17 LearningTool.iOS 0x10077b664 System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 84
18 LearningTool.iOS 0x10077d764 System_Threading_ThreadHelper_ThreadStart + 52
19 LearningTool.iOS 0x10088f504 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
20 LearningTool.iOS 0x1000d8cd0 mono_jit_runtime_invoke (mini-runtime.c:2523)
21 LearningTool.iOS 0x1001356cc do_runtime_invoke (object.c:2809)
22 LearningTool.iOS 0x10015e6d0 start_wrapper (threads.c:746)
23 LearningTool.iOS 0x1001a7404 inner_start_thread (mono-threads-posix.c:92)
24 libsystem_pthread.dylib 0x180709850 0x180706000 + 14416
25 libsystem_pthread.dylib 0x180709760 0x180706000 + 14176
26 libsystem_pthread.dylib 0x180706d94 0x180706000 + 3476
Thread 0 name: tid_403 Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x0000000180625188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000180624ff8 mach_msg + 72
2 CoreFoundation 0x00000001816225d0 CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x00000001816201ec __CFRunLoopRun + 1132
4 CoreFoundation 0x000000018154e2b8 CFRunLoopRunSpecific + 444
5 GraphicsServices 0x0000000183002198 GSEventRunModal + 180
6 UIKit 0x000000018758e7fc -[UIApplication _run] + 684
7 UIKit 0x0000000187589534 UIApplicationMain + 208
8 LearningTool.iOS 0x0000000100ebcbf4 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (/:1)
9 LearningTool.iOS 0x0000000100e3dafc UIKit_UIApplication_Main_string___intptr_intptr (UIApplication.cs:79)
10 LearningTool.iOS 0x0000000100e3dabc UIKit_UIApplication_Main_string___string_string (UIApplication.cs:63)
11 LearningTool.iOS 0x00000001001c2844 LearningTool_iOS_Application_Main_string (/:1)
12 LearningTool.iOS 0x000000010088f504 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
13 LearningTool.iOS 0x00000001000d8cd0 mono_jit_runtime_invoke (mini-runtime.c:2524)
14 LearningTool.iOS 0x00000001001356cc do_runtime_invoke (object.c:2809)
15 LearningTool.iOS 0x00000001001376f0 mono_runtime_exec_main (object.c:4585)
16 LearningTool.iOS 0x000000010013730c mono_runtime_run_main (object.c:4134)
17 LearningTool.iOS 0x00000001000c2f34 mono_jit_exec (driver.g.c:1048)
18 LearningTool.iOS 0x00000001001c16a0 xamarin_main (monotouch-main.m:487)
19 LearningTool.iOS 0x00000001010be444 main (main.arm64.m:84)
20 libdyld.dylib 0x00000001805315b8 0x18052d000 + 17848
Thread 1:
0 libsystem_kernel.dylib 0x0000000180642e1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x00000001807089c0 0x180706000 + 10688
2 libc++.1.dylib 0x00000001800313ec std::__1::condition_variable::wait(std::__1::unique_lock&) + 56
3 JavaScriptCore 0x0000000185e4b5d0 void std::__1::condition_variable_any::wait<std::__1::unique_lock >(std::__1::unique_lock&) + 112
4 JavaScriptCore 0x0000000185e4b544 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::)()>::threadRunLoop() + 168
5 JavaScriptCore 0x0000000185e4b424 std::__1::__shared_ptr_emplace<std::__1::mutex, std::__1::allocator >::~__shared_ptr_emplace() + 0
6 JavaScriptCore 0x0000000185e4b6d4 void std::__1::__thread_proxy<std::__1::tuple), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::)()>> >(void) + 92
7 libsystem_pthread.dylib 0x0000000180709850 0x180706000 + 14416
8 libsystem_pthread.dylib 0x0000000180709760 0x180706000 + 14176
9 libsystem_pthread.dylib 0x0000000180706d94 0x180706000 + 3476
Thread 6 name: tid_5a23
Thread 6 Crashed:
0 libsystem_kernel.dylib 0x0000000180643014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018070b450 0x180706000 + 21584
2 libsystem_c.dylib 0x00000001805b7400 abort + 140
3 LearningTool.iOS 0x00000001000cbed8 mono_handle_native_sigsegv (mini-exceptions.c:2420)
4 libsystem_platform.dylib 0x0000000180705348 _sigtramp + 52
5 libsystem_pthread.dylib 0x000000018070b450 0x180706000 + 21584
6 libsystem_c.dylib 0x00000001805b7400 abort + 140
7 LearningTool.iOS 0x00000001001b6ea0 print_all_exceptions(MonoObject*) (runtime.m:997)
8 LearningTool.iOS 0x00000001000cc610 mono_invoke_unhandled_exception_hook (mini-exceptions.c:2873)
9 LearningTool.iOS 0x00000001000cbb6c mono_handle_exception_internal (mini-exceptions.c:1798)
10 LearningTool.iOS 0x00000001000cac4c mono_handle_exception (mini-exceptions.c:2027)
11 LearningTool.iOS 0x00000001000c3748 mono_arm_throw_exception (exceptions-arm64.c:390)
12 LearningTool.iOS 0x00000001008c16d8 throw_exception + 168
13 LearningTool.iOS 0x00000001001b6bf4 xamarin_process_managed_exception (runtime.m:2079)
14 LearningTool.iOS 0x00000001001b6acc xamarin_process_managed_exception_gchandle (runtime.m:1035)
15 LearningTool.iOS 0x00000001001b6a88 xamarin_ftnptr_exception_handler (runtime.m:1024)
16 LearningTool.iOS 0x0000000100ecc350 wrapper_native_to_managed_ObjCRuntime_Runtime_throw_ns_exception_intptr (/:1)
17 LearningTool.iOS 0x00000001001b5480 xamarin_throw_ns_exception (.delegates.inc:105)
18 LearningTool.iOS 0x00000001001b7768 exception_handler(NSException*) (runtime.m:1057)
19 CoreFoundation 0x0000000181675538 __handleUncaughtException + 644
20 libobjc.A.dylib 0x00000001800ac838 _objc_terminate() + 112
21 libc++abi.dylib 0x000000018009b66c std::__terminate(void (*)()) + 16
22 libc++abi.dylib 0x000000018009af84 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 0
23 libobjc.A.dylib 0x00000001800ac690 _objc_exception_destructor(void*) + 0
24 CoreFoundation 0x0000000181674c00 -[NSException name] + 0
25 UIKit 0x000000018751a494 -[UIView(Hierarchy) subviews] + 420
26 UIKit 0x0000000187825188 -[UIView(CALayerDelegate) _wantsReapplicationOfAutoLayoutWithLayoutDirtyOnEntry:] + 72
27 UIKit 0x0000000187520ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1252
28 QuartzCore 0x00000001849ce9d8 -[CALayer layoutSublayers] + 148
29 QuartzCore 0x00000001849c34cc CA::Layer::layout_if_needed(CA::Transaction*) + 292
30 QuartzCore 0x00000001849c338c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
31 QuartzCore 0x00000001849403e0 CA::Context::commit_transaction(CA::Transaction*) + 252
32 QuartzCore 0x0000000184967a68 CA::Transaction::commit() + 512
33 LearningTool.iOS 0x0000000100ec1bd8 wrapper_managed_to_native_ObjCRuntime_Messaging_void_objc_msgSend_intptr_intptr (/:1)
34 LearningTool.iOS 0x0000000100e3ad08 CoreAnimation_CATransaction_Commit (CATransaction.g.cs:81)
35 LearningTool.iOS 0x0000000100d6cf7c Xamarin_Forms_Platform_iOS_CADisplayLinkTicker_StartThread (/C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\CADisplayLinkTicker.cs:63)
36 LearningTool.iOS 0x000000010077d610 System_Threading_ThreadHelper_ThreadStart_Context_object + 192
37 LearningTool.iOS 0x000000010077b8ac System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 428
38 LearningTool.iOS 0x000000010077b6ec System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 44
39 LearningTool.iOS 0x000000010077b664 System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 84
40 LearningTool.iOS 0x000000010077d764 System_Threading_ThreadHelper_ThreadStart + 52
41 LearningTool.iOS 0x000000010088f504 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
42 LearningTool.iOS 0x00000001000d8cd0 mono_jit_runtime_invoke (mini-runtime.c:2524)
43 LearningTool.iOS 0x00000001001356cc do_runtime_invoke (object.c:2809)
44 LearningTool.iOS 0x000000010015e6d0 start_wrapper (threads.c:747)
45 LearningTool.iOS 0x00000001001a7404 inner_start_thread (mono-threads-posix.c:92)
46 libsystem_pthread.dylib 0x0000000180709850 0x180706000 + 14416
47 libsystem_pthread.dylib 0x0000000180709760 0x180706000 + 14176
48 libsystem_pthread.dylib 0x0000000180706d94 0x180706000 + 3476
Thread 6 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000030
x4: 0x000000000000001b x5: 0x000000016ec11d50 x6: 0x0000000000000036 x7: 0xffffffffffffffec
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000180705314 x11: 0x0000000102e10000
x12: 0xffffffffffffc000 x13: 0x0000000102e0c000 x14: 0x0000000000002000 x15: 0x00000000000047eb
x16: 0x0000000000000148 x17: 0x000000018156d810 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000016ec17000 x21: 0x0000000101151f54 x22: 0x0000000101151fb1 x23: 0x43ae9cba3188008e
x24: 0x000000016ec12188 x25: 0x0000000101151f64 x26: 0x0000000103cd1770 x27: 0x000000010417caf0
x28: 0x0000000102e01260 fp: 0x000000016ec12120 lr: 0x000000018070b450
sp: 0x000000016ec12100 pc: 0x0000000180643014 cpsr: 0x00000000
How to get iOS storyboard to display background color as expected?
I'm trying to get my iOS splash screen looking right. It basically wants to be a centered image, with the background in the brand's color. The image itself contains the brand's color, as well as other colors.
When the app is run, there is a significant difference between the "brand" color in the image and the "brand" color of the surrounding space. The following is my LaunchScreen.storyboard . Any ideas why the difference in coloring? It's as if the background is being muted somehow.
Also, if I wanted to expand the image to fill the available space (whilst maintaining aspect ratio), what would I need to change?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="X5k-f2-b5h" launchScreen="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="gAE-YM-kbH">
<objects>
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="492"/>
<viewControllerLayoutGuide type="bottom" id="493"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw" userInteractionEnabled="NO" clearsContextBeforeDrawing="NO" autoresizesSubviews="NO">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23" clearsContextBeforeDrawing="NO" autoresizesSubviews="NO">
<rect key="frame" x="177" y="338" width="60" height="60"/>
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
</accessibility>
<color key="backgroundColor" colorSpace="calibratedRGB" red="0.29607843137254902" green="0.41764705882352939" blue="0.30196078431372548" alpha="1"/>
</imageView>
</subviews>
<color key="backgroundColor" customColorSpace="sRGB" colorSpace="calibratedRGB" red="0.29607843137254902" green="0.41764705882352939" blue="0.30196078431372548" alpha="1"/>
<constraints>
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" id="39"/>
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" id="41"/>
</constraints>
<rect key="contentStretch" x="0" y="0" width="0" height="0"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" notEnabled="YES" image="YES"/>
</accessibility>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="349" y="339"/>
</scene>
</scenes>
<resources>
<image name="Icon-60.png" width="60" height="60"/>
</resources>
<color key="tintColor" colorSpace="calibratedRGB" red="0.29607843137254902" green="0.41764705882352939" blue="0.30196078431372548" alpha="1"/>
</document>
Unhandled Exception: System.TypeLoadException
What means this error and how do i solve?
Unhandled Exception: System.TypeLoadException: Could not resolve type with token 01000043 (from typeref, class/assembly Xamarin.Forms.Internals.ResourceLoader, Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null) ocorreu
ProgressBar bogs down SQLite search
In my app I have an app the imports data from the user's SQLite database. Originally when testing with 300 rows in the database the import went fairly fast just a few seconds and the ProgressBar accurately zipped across the top. Now it seems that the progress bar is dragging things down ridiculously. If I don't use the ProgressBar even with a database of over 2500 items it takes only a few seconds. Seems the await is the problem but if I leave that out the progress bar displays only halfway through when the import is finished at close to the same amount of time as without the ProgressBar.
The loop is simple: get data->bump progress repeat
I have searched for any similar situations mentioned and do wonder if the ProgessBar should be on another thread? I haven't found any examples of this (though it's sometimes hard to get the magic search words). Seems on every screen refresh the ProgressBar should update wherever to the current item number imported even if the last refresh was at 100 fewer items. That should keep it up to date and not bog down the import. It's probably doing this when the await is left out.
Anyone solve this problem or is it just the way the control is going to work? Or maybe the best solution is to leave out the await which gives the user a sense that something is happening anyway.
Xamarin.Forms and local notification
Hi,
I'm new to Xamarin, and interested to understand for a Xamarin.Forms application using PCL, if local notifications can be implemented in the PCL or is it a device specific function?
And if there is any examples which shows how to achieve this.
What is the correct type argument to use of a type of Point
Hello, I'm trying to pass a type argument where the data type is of point. I keep running into an issue. here is my xmal code
<gauge:Header x:Name="MiddleChartTxt" ForegroundColor="White">
<gauge:Header.Position>
<OnPlatform x:TypeArguments="x:Point">
<On Platform="iOS" Value="0.5,0.5" />
<On Platform="Android" Value="0.5,0.55" />
</OnPlatform>
</gauge:Header.Position>
<gauge:Header.TextSize>
<OnPlatform x:TypeArguments="x:Double" iOS="16" Android="16" />
</gauge:Header.TextSize>
</gauge:Header>
I've checked out this page which gives me a list of options eg. double, int etc.. but can't find any reference to point.
any suggestions?? Thank you
Injecting json web token into a Webview
Hi, is it possible to inject a json web token into a Webview and use it?
Does anyone have an example on how to do this?
Launching Phone dialer, Email composer, Sms composer
Hi,
I'm using XAML Xamarin.Forms and would like to trigger opening Phone, Email Composer, Sms in Android and iOS when somebody clicks a phone number, email address, or sms phone number. Similar to the HTML mailto:, tel: and sms: tags.
Does anyone know how to best do this?
Thanks!
Chris
Custom Renderers - Setting multiple background properties
I've created a Custom Renderer for the Editor Control for Android. I want to be able to set the Corner Radius/border AND different colours if the control is enabled or disabled. The code I have is as follows:
public class CustomEditorRenderer : EditorRenderer
{
public CustomEditorRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
if (Control != null)
{
var gd = new GradientDrawable();
gd.SetCornerRadius(10);
gd.SetStroke(2, Xamarin.Forms.Color.FromHex("#146BAE").ToAndroid());
Control.SetBackground(gd);
var enableDisableStates = new StateListDrawable();
enableDisableStates.AddState(new[] { Android.Resource.Attribute.StateEnabled },
new ColorDrawable(Xamarin.Forms.Color.FromHex("#ffffff").ToAndroid()));
enableDisableStates.AddState(new[] { -Android.Resource.Attribute.StateEnabled },
new ColorDrawable(Xamarin.Forms.Color.FromHex("#eaeaea").ToAndroid()));
Control.SetBackground(enableDisableStates);
}
}
}
Obviously calling SetBackground twice overwrites the first call, so my question is how can I combine this to apply both the state colours and border to the control?
Thanks
WebView (iOS 11): html anchors not working with local source
I'm using a XF WebView and set the html as string to the "Html" Property of HtmlWebViewSource (which then is set to the WebViews "Source".)
The html contains anchors (<a href="#...") to jump to. This only works until iOS 10, but not in iOS 11, ie. you click on the link but nothing happens.
Any idea how to overcome this limitation ?
Binding Command for Button inside a ListView and Toggled Action from Switch inside ListView
Hi everyone,
I'm trying to add a command to a button inside a listview in a MVVM architecture, but i'm not being so succeed. Also i'm trying to attach an action to when the switch is toggled, but i have no idea how to do that (and i know that i can put an method inside the SET property in the MODEL, but i want to call an method from the view model). The data from the notification model (Time, Legend, Activated and AlarmStatus) is appearing on the screen and the button outside the listview is working as well... See bellow my code until now:
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AppTest.Views.NotifyManager">
<ContentPage.Content>
<StackLayout Padding="25">
<Button Text="Add" Command="{Binding AddNotify} />
<ListView ItemsSource="{Binding Notifications}" HasUnevenRows="True" SelectedItem="{Binding notifSelected}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Label Text="{Binding Time}" FontSize="20"/>
<Label Text="{Binding Legend}" FontSize="15"/>
<Switch IsToggled="{Binding Activated}" />
<Label Text="{Binding AlarmStatus}" FontSize="15"/>
<Button Text="Remove" Command="{Binding ???}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
and the view model:
namespace AppTest.ViewModel
{
class NotifyManagerViewModel
{
SaveNotification sn;
public ObservableCollection<Notification> Notifications { get; set; }
private NotificationDAO dao;
public ICommand AddNotify { get; protected set; }
public INavigation Navigation { get; set; }
private Notification notifSelected;
public Notification notifSelected
{
get
{
return notifSelected;
}
set
{
if(notifSelected != value)
{
notifSelected = value;
}
}
}
public NotifyManagerViewModel(NotificationDAO notDao)
{
dao = notDao;
Notifications = dao.Notifications;
AddNotify = new Command(() =>
{
sn = new SaveNotification(dao);
Navigation.PushAsync(sn);
});
}
}
}
Thanks
How to Integrate Ping Identity with Xamarin.Forms App
Greetings everybody.
Currently I am working in a Xamarin.Forms solution where we have to integrate Ping Identity (https://www.pingidentity.com) with Open ID & OAuth 2.0. Sample code & help guide is available in the website for integrating Ping Identity with native iOS application. But I could not find any reference or supporting document for Xamarin.Native or Xamarin.Forms.
Have anybody integrated Ping SSO or Ping Identity with either Xamarin.Native or Xamarin.Forms ? Any help in this regard would be very helpful.
How to place dot image on another image
How to place dot image on image when user select particular location on mobile for booth android and ios