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

Custom Map with custom text

$
0
0

I am trying to build a custom map that allows me to draw polygons and place text in the center of the polygon like so:

image

I have managed to create the polygons in my custom renderer, but have not been able to find any info on how to create a custom view and place its center at a specific gps location.

Here is the app running in the simulator with 2 separate polygons drawn. I want to place text in the center of each one:

image

Ideally I could create a Label and set its center to a certain GPS coordinate. I know this is not supported, but that is what Im trying to do. The circle around the text is optional.

Any suggestions?


Navigaton bar buttons on left

$
0
0

I was using a Custom ContentPageRenderer to manually move UIBarButtonItem to NavigationControllers LeftBarButtonItems collection from RightBarButtonItems collection.
https://forums.xamarin.com/discussion/21004/navigation-bar-left-toolbar-button

This seems to have stopped working after taking latest Xamarin Forms - 2.2.0.31.

Am i the only one facing this?

If not, is this a bug with latest build or something has been changed and this solution will no longer work. If yes, can somebody suggest an alternative?

-S

set bindingcontext of page from another page?

$
0
0

i have some async work being performed in App.cs (specifically OnStart). i set OnStart to async with something awaited. when that awaited line is hit my MasterDetailPage Detail continues and what is awaited completes after the Detail page Constructor and OnAppearing complete. So i thought if i removed the DetailPage OnAppearing and used OnBindingContextChanged and then when my awaited completes i set the BindingContext of the Detail to what i am awaiting then the OnBindingContextChanged would hit and everything would be great in the world. thing is i do not know how to set the BindingContext of a page outside of said page. any thoughts?

Subscribe and Unsubscribe Events

$
0
0

Hello!

I am new to memory management and I've read from here and there that you should unsubscribe events when you're not using them (finished). This question might be totally newbish but...

Say we have a Button, and when I press it it fires a Click event.

For example:

public MainWindow()
{
    Init...bla bla();
    button1.Clicked += Button1_Clicked;
}

private void Button1_Clicked(object sender, EventArgs e)
{
    //Do something
}

So, after I've clicked the button and I am now satisfied with whatever it did. Where in the code shall I call the button1.Clicked -= Button1_Clicked? Inside the Button1_Clicked perhaps? But that's not the main question, the main question is... AFTER I've unsubscribed the event, how would I go about calling the event again? I mean, I would have to Subscribe (button1.Clicked += Button1_Clicked;) again somewhere.

And if I do Subscribe again, then I don't really see the purpose of unsubscribing in the first place since I am creating the reference again.

I'm totally lost, I appreciate any help!

Updating UI BeginInvokeOnMainThread not reflecting immediately

$
0
0

Hi,

I am showing activity indicator after clicking login button until redirecting the user to another page, to make them understand some progress is going on. But after clicking login button Activity Indicator is not shown immediately, it is shown after few seconds,

Why its so? To reduce that delay only I am putting activity indicator...

My Code:

 async void loginButtonGesture_Tapped(object sender, EventArgs e)
{
     Device.BeginInvokeOnMainThread(() =>
                    {
                        loadingPanel.IsRunning = true;
                        loadingPanel.IsVisible = true;
                    });
}

Horizontal List View Implementation in Xamarin forms PCL

$
0
0

Hi guys,

is there anyway to implement Horizontal Listview in Xamarin Forms ? can we implement Expandable ListView in Xamarin forms?

Xamarin.Forms - Android Azure Mobile services

$
0
0

Hi, I'm new to Azure and playing with Mobile App. I've created correctly all infrastructure stuff through Azure portal, downloaded backend service and frontend Xamarin.forms sample (through Mobile App -> Quick Start) and it's working (the sample code stores "TodoItem" data in SQL database and there is a nice mobile UI presented). The problem is that it's working only in debug configuration. When I switch to release configuration, it simply crashes (speaking about Android version, Windows Phone/WinApp seems to be working ok in release). The weird thing is that when I check "enable developer instrumentation" for release configuration, it's working again. Any idea why is this happening, any hints what to try? Thanks a lot!

Binding Opacity of items in ListView based on their position relative to visible center?

$
0
0

Tossing around approaches for showing the center item in a ListView at full opacity, and then having items above and below show as faded (Opacity <1) relative to the center visible item (or vertical center of the control). Some kind of binding for Opacity relative to the ListView properties does not seem crazy, but can't mess with the BindingContext. Thoughts on best way to do something like this?


Unhandled Activation Error

$
0
0

When I open the Xamarin official example, download the code, run, the first display of the landing, I landed, so that the display "Unhandled Activation Error, System.Exception: Could not load machine data: Cannot determine the text encoding for the assembly location: C:\Users\LiuWei\Desktop\DEMO\官方代码\TabbedPage\mandroid-win.exe
Please add the correct encoding to MONO_EXTERNAL_ENCODINGS and try again.
在 Xamarin.Components.Ide.Activation.ActivationService.GetErrorWorkflow(LicenseSyncResult[] results, Boolean ignoreSyncErrors)
在 Xamarin.Components.Ide.Activation.ActivationService.d__61.MoveNext()
在 Xamarin.Components.Ide.Activation.ActivationDialog.DisplayWorkflowStep(ActivationWorkflowStep step)
在 Xamarin.Components.Ide.Activation.ActivationDialog.<>c__DisplayClass30_0.b__0(Task t)"

colors.xml - set value in code

$
0
0

hi all,

to get the value from the colors.xml we do the following

var backgroundColor = Resources.GetColor(Resource.Color.entry_background_new);

anyone know if its possible to set the color value in code?

Swapping layout listview

ListView access to the underlying viewcells

$
0
0

Scenario:
I'm attempting to implement a custom deletion method for items being listed within a ListView via a custom ViewCell. There is a Trash icon (image button -> image with tap gesture attached) that when tapped, needs to be able to toggle the visibility (initially set to false) of another image button (same concept) within each ViewCell within the ListView. This newly appeared "delete" button will then be used to delete that specific item from the app, and consequently from the ListView itself which means an external event handler needs to be used (to my knowledge as I'm still learning Xamarin).

After having spent the last couple days on Google and on these forums, I have come up empty handed as to where these views are being kept within ListView or even how to access them, short of checking reflection which seemed a bit extreme. I am aware that this is possible, at least in Android via a custom Adapter but I would prefer a more universal approach.

So as the title states, is there a way to access the ListView's underlying ViewCells (in this case custom)? And if not, how could I go about achieving this? Example code of my current progress can be provided.

Note:
My company does not like the current method of the "Context Actions" deletion method because they want it to have a universal feel across all supported platforms (currently Android and iOS), which is what led me down this path.

Any help is greatly appreciated.

The "GenerateResourceDesigner" task failed unexpectedly

$
0
0

I believe I am getting an error similar to the error listed in this thread but its slightly different. I am new to Xamarin development and am not sure how to resolve this issue:

Not sure if this helps but my application set-up is to have MyApp.Common as a PCL referenced by my .Droid and .iOS application:

Severity Code Description Project File Line Suppression State
Error The "GenerateResourceDesigner" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'MyApp.Common, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'MyApp.Common.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.GenerateResourceDesigner.c__AnonStorey0.<>m__0(String ass)
at System.Linq.Enumerable.WhereSelectListIterator

2.MoveNext()
   at Xamarin.Android.Tasks.ResourceDesignerImportGenerator.CreateImportMethods(IEnumerable
1 libraries)
at Xamarin.Android.Tasks.GenerateResourceDesigner.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() PD.UserInterface.Droid

Any suggestions are eagerly welcomed.

Error : The "GenerateResourceDesigner" task failed unexpectedly.

$
0
0

I am trying to solve this error from last 5 days but I am not getting optimal solution in xamarin forms.

Severity Code Description Project File Line Suppression State
Error The "GenerateResourceDesigner" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'xamarinSampleApplicationiOS.exe, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'xamarinSampleApplicationiOS.exe.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.GenerateResourceDesigner.c__AnonStorey0.<>m__0(String ass)
at System.Linq.Enumerable.WhereSelectListIterator

2.MoveNext()
   at Xamarin.Android.Tasks.ResourceDesignerImportGenerator.CreateImportMethods(IEnumerable
1 libraries)
at Xamarin.Android.Tasks.GenerateResourceDesigner.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() xamarinSampleApplication.Droid

Help me to figure out it. Thanks in Advance.

Target 8.0 works, Target 8.1 give strange erors on Lumia 535 Dual Sim RM_1090 - Windows Phone 8.1 Up

$
0
0

Hello,

I have an updated Windows Phone to 8.1 (Lumia 535 Dual Sim RM_1090 - Windows Phone 8.1 Update - OS Version 8.10.14234.375)
With Target Windows Phone 8.1 I received very strange errors like

  • at deploy time DEP0001 : Unexpected Error: -1988945906 - and no deploy on device or emulator
  • one day ago when I could deploy my program I received run-time error
    The program has exited with code -1073741819 (0xc0000005) 'Access violation'
    (that I could not debug and catch even with all exceptions activated as breakpoints and Windows Symbols Server activated during debug

  • I can not ask for help because there is no way to find out the module and source line code - who is going to debug this ? no one can help)

  • I deleted all VS projects and started again, several times, from GitHub original zip file or from my zip progress savings - no result (it seams that VS is memorizing something and I do not indent to reinstall a 50 GB app like Visual Studio, so even after deleting project directories I can not repeat the initial experience of deploying to target 8.1 - even after success I will return to Access Violation Run time error)

I desperately switch to target = Windows Phone 8.0 and - MAGIC - everything changed

  • no deploy error
  • app arrived, again, on my Windows Phone 8.1
  • instead of an X as icon I received a nice Xamarin logo
  • the list view of pictures is now very nicely auto sized at width and heights adapted (before I had to choose the size of the pictures and they appear big and with chaotic widths and heights (I had to download same size images with google search tools :-( - now even the one that I downloaded at different width is nicely resized)
  • no runtime errors after navigating through pages (on 8.1 target after a random navigation of 1 to 4 pages app was exiting to main menu :-( and an Debug log =The program has exited with code -1073741819 (0xc0000005) 'Access violation' )

I had this experience 20 years ago with C, memory management and strange access violations and I switched to Java.
I think that in this C# environment (VS + Xamarin + Windows Mobile 8.1) there are still some C libraries that crashes
Now with this trick (target 8.0 for my device 8.1 Windows Mobile Phone) I can go one and keep VS and Xamarin on my PC

Did you had this experience ? Any issues if I will go on like this ?

Thank you

Dorin


Trigger MasterDetailPage with Button (Hamburger Menu)

$
0
0

Hello ,

I have a MasterDetailPage.

Master is my LeftMenuPage and my Detail is a NavigationPage which has

SetHasNavigationBar(page,false);

So that I dont see hamburger menu icon in that page.

My solution is add another hamburger icon for that page and trigger left menu with that icon.

Is there any method for that ?

LeftMenu_OnClick()
{
    LeftMenu.Open();
}

I need full view on that page , but also need to open Master with button.

Thank you!

ImageResourceExtension doesn't always load the image?

$
0
0

I'm using the ImageResourceExtension sample to populate an Image control using XAML markup + an embedded resource. I'm seeing odd behavior where sometimes the image will display, but other times it will not. The resource is there, a dump of the manifest resource names shows the resource, and like I said, it occasionally displays and occasionally does not (and this is even during the same debugging session while navigating back and forth).

Floating Action Button in Xamarin Forms

$
0
0

Has anyone implemented the FAB in a Xamarin Forms project? I know there are ports available for Xamarin.Android but I'm wondering if this will mesh well with XF  due to it not having the latest support packages.

Droid Debug error System.Runtime.Serialization.dll.so

$
0
0

VS 2015 and Xamarin Forms version 2.1.0.6529 also showing 2.2.0.31.
I have been getting this error when trying to debug to an Android tablet. Until today, the problem was very intermittent but now it takes three or four tries before I get the my app to run in debug mode. I have tried to clean project, restart VS and nothing seems to work. I saw an issue on bugzilla but no resolution. Anyone have an idea that I missed?

Thanks.

05-06 10:49:00.590 D/Mono (25514): [0x67920278] worker starting
05-06 10:49:00.597 D/Mono (25514): Assembly Ref addref Xamarin.Forms.Core[0x660fa520] -> System.Dynamic.Runtime[0x66172b38]: 2
05-06 10:49:00.599 D/Mono (25514): Image addref System.Runtime.Serialization[0x6792faa0] -> System.Runtime.Serialization.dll[0x6792df20]: 1
05-06 10:49:00.599 D/Mono (25514): Assembly System.Runtime.Serialization[0x6792faa0] added to domain RootDomain, ref_count=1
05-06 10:49:00.600 D/Mono (25514): AOT module 'System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app-lib/Mobi2market.Mobi2market-1/libaot-System.Runtime.Serialization.dll.so" not found
05-06 10:49:00.601 D/Mono (25514): AOT module '/Users/builder/data/lanes/3053/a94a03b5/source/monodroid/builds/install/mono-armv7/lib/mono/aot-cache/arm/System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app-lib/Mobi2market.Mobi2market-1/libaot-System.Runtime.Serialization.dll.so" not found
05-06 10:49:00.602 D/Mono (25514): Unloading image data-0x67a8a008 [0x679441f0].

POLL: Should Xamarin.Forms support features applicable to just 1 platform?

$
0
0

Now that XF is open source, the developer community can add features that we have been wanting for a long time. However, there is push back accepting features that are only supported on 1 platform. I was curious what the developer community thought of this topic.

Take for example, UITableViewCellAccessory on iOS. Pretty much all iOS apps will need a disclosure indicator on their table rows somewhere. Should we make all XF developers write the same custom cell renderer to handle this for iOS or just add capabilities to XF Cell and have it be ignored for all platforms except iOS?

This is just one example of many features that are applicable to 1 platform that could be added to XF to make it easier for developers. What do you think?

Viewing all 58056 articles
Browse latest View live