Can Anyone help me to replace the main left menu with sub left menu(Just like Paytm App).
Replace the main left bar with child left menu while tapping on the main menu item in xamarin forms.
How to left align masterdetail icon on ios?
The hamburgermenu icon is center aligned on ios, but on android it works fine and is left aligned.
Master.xaml
<ContentPage xmlns=""
xmlns:x=""
x:Class="Name.Master"
Title="Master"
Icon="Hamburger_icon_sm.png"
>
InitialPage.xaml.cs
namespace Name
{
public partial class InitialPage : MasterDetailPage
{
public InitialPage()
{
InitializeComponent();
this.Master = new Master();
var detail = new Detail();
this.Detail = new NavigationPage(detail) {
BarTextColor = Color.White
};
App.MasterDetail = this;
}
}
}
How can I make it left aligned on ios also?
MVVM Light - Remove Navigation pages from stack
I have simple forms based application which submits an application to a service, upon which I want to clear the navigation stack, so that a new application can be entered. I know this is possible with out of the box Xamarin using Navigation.RemovePage
, but no idea how do this within MVVM Lights navigation service framework.
I have the following in the NavigateTo method using parameter as an indicator to clear the stack:
if (parameter == null)
{
foreach (var pageList in _navigation.Pages)
{
//Remove from navigation stack
}
}
I was hoping I could fire something from here to clear the stack so that the pages are refreshed.
Thanks
Master Detail Page UWP Renderer
Now I'm having a great time with Xamarin.Forms, being a freelancer it really makes my life easy when it comes to making apps! I have been using CustomRenderers and DependencyService to make some really native looking apps.
At the moment when I make an app in the main App.cs file when choosing the MainPage I check to see if the user is using iOS. If they are then they get sent to a tabbed page, if not then they get sent to a master detail page. This has been working really well!
The main issue I have with MasterDetailPage is in UWP though, the UWP design guidelines suggest then when the hamburger menu is closed then you should be able to still see the icons of the menu just not the text. In a sense it just changes the size of the menu from 300px to 50px so you can only see the icons.
Has anyone managed to get the MasterDetailPage to do the same in Xamarin.Forms? Of course only on tablets and desktops, not phones.
How to bind views to a Dictionary in Xamarin.Forms?
I have View and a ViewModel. In the ViewModel I create a dynamic form (based on a form object), this "dynamic form" is a StackLayout with a N number of Views (like entries, pickers...).
Lets say that, when the user hits the submit button the app needs to store all the information of the fields from the form in a Dictionary<string, object>()
.
I had a method that would go through the StackLayout and create a new Dictionary. I didn't quite like this aprouch, what I want to do is bind the Stacklayout's fields to the Dictionary.
I create a field, like this:
var entry = new
Keyboard = Keyboard.Numeric,
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions = LayoutOptions.CenterAndExpand
};
and then I:
stackLayout.Children.Add(entry);
In order to set the correct biding, do I need to use the BindingContext property from when I'm setting the entry' properties or should I use the setBiding
method ?
I'm here clueless here and could use a few pointers. I searched on stackoverflow but didn't find what I needed.
My ViewModel code.
class FormViewModel : INotifyPropertyChanged
{
public ICommand RegisterCommand { get; set; }
private StackLayout _layout;
private Answer Answer;
private Dictionary<string, object> dictionary = new Dictionary<string, object>();
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public FormViewModel(Form form, StackLayout layout)
{
_layout = layout;
RegisterCommand = new Command(SaveForm);
}
public void SaveForm()
{
}
}
I removed a few things, but thats the basic idea.
How to left align masterdetail icon on ios?
The hamburgermenu icon is center aligned on ios, but on android it works fine and is left aligned.
Master.xaml
<ContentPage xmlns=""
xmlns:x=""
x:Class="Name.Master"
Title="Master"
Icon="Hamburger_icon_sm.png"
>
InitialPage.xaml.cs
namespace Name
{
public partial class InitialPage : MasterDetailPage
{
public InitialPage()
{
InitializeComponent();
this.Master = new Master();
var detail = new Detail();
this.Detail = new NavigationPage(detail) {
BarTextColor = Color.White
};
App.MasterDetail = this;
}
}
}
How can I make it left aligned on ios also?
How to assign an icon to the Navigation Bar for a single page on Android
Hello,
I try to use an icon instead of the title on the main page of my Xamarin.Forms app.
I've read a lot of related topics, but I didn't found any solution:
navigationpage-settitleicon
navigationpage-settitleicon-works-on-ios-but-not-android
toolbar-title-set-center-align
xamarin-forms-custom-toolbar-android
On iOS this is done easily by adding this on my first page:
NavigationPage.SetTitleIcon(this, "navbar_logo.png");
On Android, I've added this on Toolbar.axml:
<ImageView android:src="@drawable/navbar_adp_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" />
This works, but the icon is now visible on each page on Android.
I've tried to use a renderer to hide the icon when I navigate to another page. For this I would like to use the override OnViewAdded() method:
public class CustomNavigationPageRenderer : NavigationPageRenderer { public override void OnViewAdded(Android.Views.View child) { ... } }
But I can't cast the child into Xamarin.Forms.Platform.Android.PageContainer, cause this object is "internal".
So I don't see how I could achieve this...
Would you have any suggestion?
focus and unfocus called always after each other (infinity loop) in UWP xamrine forms
focus and unfocus called always after each other (infinity loop) in UWP xamrine forms
Can we concatenate Binding with StringFormat in XAML?
Hello,
Can we concatenate Binding values with stringformat IN XAML?
For example:
<label Text={Binding Firstname, Binding Lastname, StringFormat='{0} {1}'}/>
Best regards
How to bind a ContentView content at run time to dynamically assign views.
Say I've built a component as follows:
<ContentView x:Class="MyView">
<ContentView.Content>
<Grid >
and a few others similar....
I'd like to define a page with some dynamic content in a stack layout
<ContentPage>
<ContentPage.Content>
<StackLayout>
<ContentView Content= "{Binding TestNavVM.CurrentView}"/>
and then in VM code....
public View CurrentView
{
get{return view;}
set{view = value;OnPropertyChanged();}
}
...
and
CurrentView = new MyView();
Of course, it doesn't work, but as this question here suggests it's possible.
So - what am I doing wrong?
VLC Library for xamarin forms
Hi is there a cross platform library which allows me to use VLC platform across platform, I could find a few on NuGet but it is difficult to tell which all platforms does it support.
I could find one very nicely written library "https://github.com/martijn00/VlcXamarin", but it supports only Android. I could make it to work, but can I get one library which has cross platform support?
Open a PDF (with Search, Highlight and Bookmark functionalities) in Xamrin.Forms
Hey there,
I have been searching for quite a while now, and I can’t seem to find a plugin that recreates the PDF viewer like iBooks from Apple:
I have looked into using WebViews, but it has very limited functionalities.
I am definitely willing to pay for it, but I am currently a student, and so don’t have that much money to spend. I would be willing to pay around $100.
Here are some plugins I have discovered:
1. Syncfusion - at $1995, this is wayyyy too expensive
2. PSPDFKit - I can’t seem to login to get a quote, but looks promising
3. XFinium.PDF - at $299 it is an okayish price (still way too high) but it was last updated in 2015
Also, this should be for iOS and Android. Windows phone would be a bonus.
Anyway, if you have other suggestions, please do tell me.
Thanks,
Daniel
Conditional Compilation for UWP?
Hello,
I was looking for compile directives for Universal Windows Platform.
I was checking this docs page
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/part_4_-_platform_divergence_abstraction_divergent_implementation/
It shows IOS, Android (IOS, ANDROID) and some others, but now UWP.
What should I use for it? (UWP maybe?)
I tried it but seems like does not work.
Can you please help?
Migration from FCM to AppCenter Push
Hi,
I recently migrated solution in which I used FCM for notifications.
After migrate I discover that notification intent is not delivered to MainActivity after click notification in system notification bar.
App starts but no action is made.
After investigating with help of guys from AppCenter team, I prepared another clean solution when I confirm that there is some problem with process Push event when application use SplashActivity.
I cannot make it working.
When app is runnin all is ok.
When app is in background, then I think is workin too.
But when app is closed and started from notification or when app is killed and is started, notify event is called before main activity is finally created, so for ex. popup is called with not existing window because of recreate App.
I tried with SingleTop and etc...
I have prepared solution, maybe somebody have any idea.
https://brzezinol2@bitbucket.org/brzezinol2/pushtestonkilledapp.git
Plugin.Geolocator.Abstractions.GeolocationError.PositionUnavailable
Hello i am using Plugin.geolocator for get my current location.in my android and uwp working fine but when i try to check in ios then it throw me error like Plugin.Geolocator.Abstractions.GeolocationError.PositionUnavailable.
I already add permission in info.plist
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Allbus wants to use your location for ...?</string> <key>NSLocationAlwaysUsageDescription</key> <string>Allbus is using your location.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Allbus is using your location.</string>
In my output window i am getting below detail
Thread started: <Thread Pool> #12 2018-02-15 06:44:38.786 AllInBus.iOS[10768:241009] Currently does not have Location permissions, requesting permissions 2018-02-15 06:44:40.790 AllInBus.iOS[10768:241009] Could not inset compass from edges 9 2018-02-15 06:44:40.791 AllInBus.iOS[10768:241009] Could not inset scale from edge 9 2018-02-15 06:44:40.968 AllInBus.iOS[10768:241009] Could not inset legal attribution from corner 4
and my common code is as below
` var locator = CrossGeolocator.Current;
if (locator.IsGeolocationEnabled && locator.IsGeolocationAvailable)
{
locator.DesiredAccuracy = 50;
var pos = await locator.GetPositionAsync(TimeSpan.FromSeconds(10), null);
if (pos != null)
{
double lat = pos.Latitude;
double lon = pos.Longitude;
}
}`
Please help me am i missing anything or doing wrong ??
What's the best approach to get offline sync done
Hello Xamarin developers,
We are working on big project that our first goal is performance, so what's the best approach to implement these functionalities
We need to implement mobile database that will be symphonized with our REST API in order to use the mobile application even without internet connection (without azure). Would you recommend any approach?
What is the best way to work with SQLite in Xamarin Forms application (Entity framework core, Dapper …)?
App crashed with Message "log_callback(char const*, char const*, char const*, int, void*) runtime.m"
Hello,
I have developed app with Xamarin.forms, which is crashed in iPad Air (iOS 11.2.1) with the following message : "log_callback(char const*, char const*, char const*, int, void*) runtime.m, line 1099".
I did lots of google for it but I did not find any solution, so I am asking it here.
Here is the stack trace from the hockey app.
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001828ec2e8 pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000182a012f8 pthread_kill$VARIANT$mp + 392
2 libsystem_c.dylib 0x000000018285afbc abort + 136
3 MyAppName.iOS 0x000000010292a530 log_callback(char const*, char const*, char const*, int, void) (runtime.m:1099)
4 MyAppName.iOS 0x0000000102925594 monoeg_g_log (goutput.c:115)
5 MyAppName.iOS 0x00000001028fe780 alloc_obj (sgen-marksweep.c:292)
6 MyAppName.iOS 0x0000000102900188 copy_object_no_checks (sgen-copy-object.h:71)
7 MyAppName.iOS 0x00000001028e83f4 major_scan_object_with_evacuation (sgen-marksweep-drain-gray-stack.h:84)
8 MyAppName.iOS 0x00000001028eb53c drain_gray_stack (sgen-marksweep-drain-gray-stack.h:345)
9 MyAppName.iOS 0x00000001028e0380 finish_gray_stack (sgen-gc.c:515)
10 MyAppName.iOS 0x00000001028e0b1c major_finish_collection (sgen-gc.c:2033)
11 MyAppName.iOS 0x00000001028dcfac major_do_collection (sgen-gc.c:2159)
12 MyAppName.iOS 0x00000001028dc544 sgen_perform_collection (sgen-gc.c:2356)
13 MyAppName.iOS 0x00000001028d3168 sgen_alloc_obj_nolock (sgen-alloc.c:256)
14 MyAppName.iOS 0x00000001028ac080 mono_gc_alloc_string (sgen-mono.c:1822)
15 MyAppName.iOS 0x000000010289bfa4 mono_string_new_size_checked (object.c:6085)
16 MyAppName.iOS 0x00000001028a147c mono_string_new_checked (object.c:5974)
17 MyAppName.iOS 0x0000000102868f7c mono_string_new_handle (handle.c:400)
18 MyAppName.iOS 0x000000010286fc20 ves_icall_System_Reflection_Assembly_get_code_base (icall.c:4560)
19 MyAppName.iOS 0x0000000100c857c4 wrapper_managed_to_native_System_Reflection_Assembly_get_code_base_System_Reflection_Assembly_bool + 160
20 MyAppName.iOS 0x0000000100e06fa8 mscorlib_System_Reflection_AssemblyName_Create_System_Reflection_Assembly_bool (Assembly.cs:152)
21 MyAppName.iOS 0x0000000100e09848 mscorlib_System_Reflection_RuntimeAssembly_GetName_bool (MonoAssembly.cs:167)
22 MyAppName.iOS 0x0000000100e05364 mscorlib_System_Reflection_Assembly_GetName (Assembly.cs:440)
23 MyAppName.iOS 0x0000000101687980 Xamarin_iOS_ObjCRuntime_Class_ResolveAssembly_string (Class.cs:261)
24 MyAppName.iOS 0x0000000101687724 Xamarin_iOS_ObjCRuntime_Class_ResolveTokenReference_uint_uint (Class.cs:214)
25 MyAppName.iOS 0x000000010164c4fc Xamarin_iOS_ObjCRuntime_Runtime_GetMethodFromToken_uint (Runtime.cs:587)
26 MyAppName.iOS 0x000000010164f584 Xamarin_iOS_ObjCRuntime_Runtime_get_method_from_token_uint_int_ (Delegates.generated.cs:365)
27 MyAppName.iOS 0x000000010161d494 wrapper_native_to_managed_ObjCRuntime_Runtime_get_method_from_token_uint_int_ (:1)
28 MyAppName.iOS 0x0000000100c51cdc native_to_managed_trampoline_169(objc_object, objc_selector*, _MonoMethod**, unsigned int) (registrar.m:8643)
29 MyAppName.iOS 0x0000000100c51c44 -[Xamarin_Forms_Platform_iOS_NavigationRenderer_SecondaryToolbar items] (registrar.m:15883)
30 UIKit 0x000000018c6f9d3c -[_UIToolbarVisualProviderModernIOS _updateContentView] + 436
31 UIKit 0x000000018c6f9f3c -[_UIToolbarVisualProviderModernIOS positionToolbarButtonsAndResetFontScaleAdjustment:] + 32
32 UIKit 0x000000018c40bd70 -[UIToolbar layoutSubviews] + 48
33 MyAppName.iOS 0x0000000101610bc8 wrapper_managed_to_native_ObjCRuntime_Messaging_objc_msgSendSuper_intptr_intptr_7 (:1)
34 MyAppName.iOS 0x0000000101691ef0 Xamarin_iOS_UIKit_UIView_LayoutSubviews (UIView.g.cs:1261)
35 MyAppName.iOS 0x0000000101b833e0 Xamarin_Forms_Platform_iOS_Xamarin_Forms_Platform_iOS_NavigationRenderer_SecondaryToolbar_LayoutSubviews + 32
36 MyAppName.iOS 0x0000000100cec484 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 240
37 MyAppName.iOS 0x0000000102837c40 mono_jit_runtime_invoke (mini-runtime.c:2525)
38 MyAppName.iOS 0x000000010289d2c8 do_runtime_invoke (object.c:2829)
39 MyAppName.iOS 0x000000010289d228 mono_runtime_invoke (object.c:2983)
40 MyAppName.iOS 0x0000000100c2d138 native_to_managed_trampoline_7(objc_object*, objc_selector*, _MonoMethod**, unsigned int) (registrar.m:283)
41 MyAppName.iOS 0x0000000100c52198 -[Xamarin_Forms_Platform_iOS_NavigationRenderer_SecondaryToolbar layoutSubviews] (registrar.m:15895)
42 UIKit 0x000000018c2b8f00 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1272
43 QuartzCore 0x0000000186e1d998 -[CALayer layoutSublayers] + 180
44 QuartzCore 0x0000000186e21b20 CA::Layer::layout_if_needed(CA::Transaction*) + 328
45 QuartzCore 0x0000000186d8e36c CA::Context::commit_transaction(CA::Transaction*) + 332
46 QuartzCore 0x0000000186db5b90 CA::Transaction::commit() + 536
47 UIKit 0x000000018c534c00 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 136
48 CoreFoundation 0x0000000182d82790 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 16
49 CoreFoundation 0x0000000182d82060 CFRunLoopDoBlocks + 284
50 CoreFoundation 0x0000000182d7fd70 __CFRunLoopRun + 1064
51 CoreFoundation 0x0000000182c9fe58 CFRunLoopRunSpecific + 432
52 GraphicsServices 0x0000000184b4cf84 GSEventRunModal + 96
53 UIKit 0x000000018c31f67c UIApplicationMain + 232
54 MyAppName.iOS 0x000000010160dca0 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (:1)
55 MyAppName.iOS 0x000000010167e8c4 Xamarin_iOS_UIKit_UIApplication_Main_string___string_string (UIApplication.cs:79)
56 MyAppName.iOS 0x0000000100c631fc MyAppName.iOS_FastBar_Registration_Forms_IOS_Application_Main_string + 24
57 MyAppName.iOS 0x0000000100cec484 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 240
58 MyAppName.iOS 0x0000000102837c40 mono_jit_runtime_invoke (mini-runtime.c:2525)
59 MyAppName.iOS 0x000000010289d2c8 do_runtime_invoke (object.c:2829)
60 MyAppName.iOS 0x000000010289fccc do_exec_main_checked (object.c:2983)
61 MyAppName.iOS 0x0000000102821754 mono_jit_exec (driver.g.c:1040)
62 MyAppName.iOS 0x000000010292e470 xamarin_main (monotouch-main.m:483)
63 MyAppName.iOS 0x0000000100c5c828 main (main.m:185)
64 libdyld.dylib 0x00000001827bc56c start + 0.
please provide some suggestion to fix it.
Thanks
Using StringFormat in Binding in XAML
How can I use StringFormat in Binding in XAML? For the life of me, I can't find the magic string of characters to enable this - I've tried a gajillion iterations. Here's an example that doesn't work:
<Label Text="{Binding Id, StringFormat=0:N}"/>
救命!
Show multiple pins on same location point
I have same location on map with exact latitude and longitude points but i want multiple pins when user zoom the mapview, as i have to display the info window on the annotation click.
How to catch A geolocation error occured: PositionUnavailable?
I'm getting crashes with the unhandled exception "A geolocation error occured: PositionUnavailable"
But the only place that I think I am calling anything geolocation related is the following:
try { await geolocator.GetPositionAsync(timeout: 10000, cancelToken: cancelSource.Token, includeHeading: true) .ContinueWith(t => { // Some code to set the center }); } catch (XLabs.Platform.Services.Geolocation.GeolocationException) { // we just ignore it... }
I guess my questions are, is this going to catch the exception (and if so, why isn't unhandled)
and is there something else that is trying to use the location and thus throwing this exception?