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

How to customize items of picker in Xamarin.forms as there is no ItemTemplate

$
0
0

How we can customize items of Picker in Xamarin.Forms. I am not able to find ItemTemplate property in Picker.

If you are going to answer it like 'Use ListView', then please mention how can we make selection in ListView same as Picker.Because selection in Picker and ListView is completely different.

Any help is apprenticed.

For Example I want to display Picker like that...


Problems with Xamarin Android support packages

$
0
0

Every time is the same nightmare, I have my app that works fine.
Today I just need to remove a package. Like a lot of time, it was a mess.

I remove the plugin.toast. Android project stop to build, with a lot of errors, in xml files.

Tried everything. Remove xamarin forms package, changing target framework, delete nuget cache, I don't want to be boring.

But now, the project simply doesn't build. Frustrating.

Now the error is:

Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ....\packages\Xamarin.Android.Support.Annotations.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets. Timeout.Android

Obviously if I restore packages Visual studio tell me:

All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.1067208
========== Finished ==========

The problem is that I changed the target framework reverting it back to V7, but for a reason that I don't know the proj file of Android was not cleaned, and it contains some directory that will never be satisfied making the project broken.

I was able to solve this specific problem, after some hours of temptative, manually editing the csproj file removing the references that was impossibile to satisfy. But I'm not really confident about the depencies of the other packages, keeping them aligned and safe it's responsibility of nuget!

And in my experience, EVERY time I have to update the packages of a complex solution, something is wrong, and I have to loose a lot of hours trying to solve problems that was created from the updater itself.

I think that the bigger problem is related to the Android support version packages, that when was not updated correctly broke the project file, but I have the feeling that something was not working properly in this process and this is really dangerous for every developer that want to assure a seriously productivity for its work.

“LinkAssemblies task failed unexpectedly” in Android Realease seems to be caused by Xamarin.iOS.dll

$
0
0

I'm trying to compile my multiplatform Xamarin Forms App Android in Realease Mode but, after the last Xamarin Forms update to v2.5.0.122203, it doesn't compile and in output I have this error:

error MSB4018: The "LinkAssemblies" task failed unexpectedly. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessEntireQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

It is not so readable but in the second row of this error I get:

Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>)

In Debug Mode I have no problems.

Did someone else encounter the same error?

Crash trying to debug wirelessly

$
0
0

I have no idea what changed. I started up my machines today and when I try and deploy wirelessly I get this crash output:

Application bundle 'com.myapp' installed on 'RealPhone's 6S'
Launching...
2018-03-20 21:27:22.756 mlaunch[5582:4452104] Threadpool worker DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-13760/DTDeviceKitBase/DTDKRemoteDeviceConnection.mm:968
Details: Failed to start Instruments daemon on device “c92f65c8ad6d40acf4dd10226b61e4890ce46d4c”: Error Domain=com.apple.dtdevicekit Code=-402653083 "Could not connect to the device." UserInfo={NSLocalizedDescription=Could not connect to the device., com.apple.dtdevicekit.stacktrace=(
0 DTDeviceKitBase 0x000000010dd68fed DTDKCreateNSError + 113
1 DTDeviceKitBase 0x000000010dd69831 DTDK_AMDErrorToNSError + 1135
2 DTDeviceKitBase 0x000000010dd7ae8f __63-[DTDKRemoteDeviceConnection startFirstServiceOf:unlockKeybag:]_block_invoke + 300
3 DTDeviceKitBase 0x000000010dd7a521 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_3 + 22
4 DTDeviceKitBase 0x000000010dd6b815 __DTDKExecuteInSession_block_invoke_2 + 35
5 DTDeviceKitBase 0x000000010dd6ac1f __DTDKExecuteWithConnection_block_invoke_2 + 474
6 DTDeviceKitBase 0x000000010dd6aa1a __DTDKExecuteWithConnection_block_invoke + 111
7 libdispatch.dylib 0x00007fff622fcd50 _dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fff62313781 _dispatch_sync_invoke_and_complete_recurse + 65
9 libdispatch.dylib 0x00007fff6231321a _dispatch_sync_wait + 585
10 DVTFoundation 0x000000010c9376f0 DVTDispatchBarrierSync + 213
11 DVTFoundation 0x000000010c910c7a -[DVTDispatchLock performLockedBlock:] + 75
12 DTDeviceKitBase 0x000000010dd6a915 DTDKExecuteWithConnection + 231
13 DTDeviceKitBase 0x000000010dd6b681 DTDKExecuteInSession + 381
14 DTDeviceKitBase 0x000000010dd7a458 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_2 + 119
15 DVTFoundation 0x000000010c936a4f __DVTDispatchAsync_block_invoke + 806
16 libdispatch.dylib 0x00007fff62304591 _dispatch_call_block_and_release + 12
17 libdispatch.dylib 0x00007fff622fcd50 _dispatch_client_callout + 8
18 libdispatch.dylib 0x00007fff6231120c _dispatch_queue_serial_drain + 635
19 libdispatch.dylib 0x00007fff623040fd _dispatch_queue_invoke + 373
20 libdispatch.dylib 0x00007fff62311f02 _dispatch_root_queue_drain_deferred_wlh + 332
21 libdispatch.dylib 0x00007fff62315d16 _dispatch_workloop_worker_thread + 880
22 libsystem_pthread.dylib 0x00007fff625c1033 _pthread_wqthread + 980
23 libsystem_pthread.dylib 0x00007fff625c0c4d start_wqthread + 13
), NSLocalizedRecoverySuggestion=Could not connect to the device., NSLocalizedFailureReason=Could not connect to the device.}
Object:
Method: -instrumentsConnection
Thread: {number = 11, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
warning MT1043: Failed to launch the application using the instruments service. Will try launching the app using gdb service.
Launching 'com.myapp' on the device 'RealPhone's 6S'
Launching /private/var/containers/Bundle/Application/5F381836-A11F-4954-A187-DCFD18B12BC5/myapp.app -monodevelop-port 10000 -connection-mode wifi

If you leave it at this point nothing happens. Eventually the debugger detaches and nothing runs. Luckily things seem to work over USB.

Your project is not referencing the ".NETPortable,Version=v4.6,Profile=Profile44" framework. Add a r

$
0
0

I can't build my Xamarin.Forms project after I did a commit on it from Visual Studio for mac. now I keep getting this error, no matter what target do I choose:

Your project is not referencing the ".NETPortable,Version=v4.6,Profile=Profile44" framework. Add a reference to ".NETPortable,Version=v4.6,Profile=Profile44" in the "frameworks" section of your project.json, and then re-run NuGet restore.

Feature to disable in Production and made to be available only when user clicks on some image/logo

$
0
0

Hi,

In login screen I have list of environments , while generating production builds I need to make this environments invisible to the end user and I need to enable them only on double click of on some instance.

Can any one suggest how to implement the same ??
Thanks in advance,

Nested ListViews with MVVM / Prism

$
0
0

Hey there,

does somebody know how to use a ListView with an ObservableCollection as ItemsSource and a ListView.ItemTemplate with another ListView inside? How can I bind data to the inner ObservableCollection Tariffs nested in TariffDays?

            <ListView ItemsSource="{Binding TariffDays}"
                      SelectedItem="{Binding SelectedTariffDay, Mode=TwoWay}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Label Text="{Binding Name}" />

                            <ListView ItemsSource="{Binding Tariffs}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <Label Text="{Binding StartTime}" />
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>

                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

It's not working at all and I read that this is not working in Xamarin, but how can I achieve this anyway without breaking the rules?

Cheers

WebViewRenderer.OnElementChanged gets called with null native control on Xamarin Forms 2.5

$
0
0

I am using my own customrenderer for Webviews it has always worked but since I upgraded Xamarin Forms nuget package to version 2.5 it crashes because it seems like the member method OnElementChanged is called with null Native control and null thisActivity. any idea how to fix it?

this is the error I get:

    Unhandled Exception:

    System.ArgumentNullException: Value cannot be null.
    Parameter name: thisActivity

How to manually sign an APK file ?

$
0
0

With VS2015 I'm unable to generate a signed APK. I got the error 'The package appears to be corrupted' even if i signed using Signing Identity. Can I manually sign the APK ?

Can't get the PinchToZoomContainer working

$
0
0

I already posted this question on the general forum, but i think that it rather belongs here.
This is my original post: "Hi all!
Im quite new to Xamarin and i have been working on an App for the last 2 weeks using xamarin.forms. I need to make a page which is zoomable by a regular pinch gesture. I have tried the online example at the official xamarin.forms page(can't post links yet sorry)
This solution however will result in a white page with absolutely no content(It doesnt matter which element i set as the content of the wrapper in XAML).
P.S: it will also show me a blank page, if the Content of the page is only the wrapper and a label added manually to the content of the wrapper in the constructor, also I'm testing on all systems IOS Android and UWP"

Font symbols coding format

$
0
0

Hello everybody! Anybody know this fonts symbols will apear in all platforms and version: ✩ ✪ ✫ ✬ ✭ ✮ ✮ ✯ ✰ ✲ ✲ ✳ ✳? They does not suport coding format ANSI. So it will be a problem to use this symbols?

how to get the coordinates where there is a control on the screen?

$
0
0

how could I get the coordinates of x, and a control image??

How to get X and Y coordinate of a listview item?

$
0
0

I want X and Y coordinate of a litview item.so to get this in xamarin forms?

Xamarin.Forms 2.5.0

Access ViewModel inside CustomRenderer

$
0
0

Hello everyone :)

I'm trying to implement a long press behavior on a switch control. I have a custom switch renderer in which I use the "Long click" event:

[assembly: ExportRenderer(typeof(CustomSwitch), typeof(CustomSwitchRenderer))]

namespace Version1.Droid
{
    public class CustomSwitchRenderer : SwitchRenderer
    {
        public CustomSwitchRenderer(Context context): base(context) {}

        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Switch> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                Control.LongClick += Control_LongClick;
            }
        }

        private async void Control_LongClick(object sender, LongClickEventArgs e)
        {
            var answer = await App.Current.MainPage.DisplayAlert("Title", "Blablablabla?", "Yes", "No");
            if (answer)
            {
                //Access binding context of the switch ???
            }
        }
    }
}

How could I access the binding context of the switch inside the LongClick handler ?
I was thinking using the messaging center but I couldn't find any similar example.

Thank you in advance for any help!
Charles


Play video when the view is displayed

$
0
0

I am using Plugin.MediaManager to play video in Xamarin.Forms. I have a ListView with multiple video players. I want to know if it's possible to start playing video when the item in ListView is displayed and also stop playing the item is undisplayed ?

Xamarin Forms - live or die?

$
0
0

I have been writing on C# since about 10 years old. During this time, many interesting and promising technologies have died - Silverlight, Windows Phone, Win RT... It's evolution and business, baby, it's all right. I like Xamarin Forms, despite all the pain that is associated with it. Now I need a remote job, I've been looking for it for a few days. First of all we need native developers -iOS and Android, then developers are needed developer React Native. Also need Xamarin Native developers (much less). But I practically did not meet the proposals for Xamarin Forms. React Native in the beta version but more popular than XF. It seems to me that something goes wrong. Xamarin Forms have 4 years, version 3.0 is on the way but now they are in the role of catching up. A few more years - and the cross-platform battle will be lost, my skills will be unnecessary.
I do not want the Xamarin Forms to die. Need a push, need a transition to a new level. But I'm interested in your opinion.

p.s. Maybe I'm exaggerating, maybe today is not the best day. Maybe it's not in the forms but in my skills. It's just my thoughts.

ContentView calls to ContentPage parent in Xamarin Forms

$
0
0

There are any way to call a method of my parent View (ContentPage) from my actual View (ContentView).

I mean, I want to use ContentView to refresh only a part of the screen, the problem is when I want use methos or propertys of Pages, like IsBusy or DisplayAlert.

Any idea to communicate the View with the Page?

Thank you advanced!

DisplayActionSheet in ContentView

$
0
0

hi,

I have ContentPage (MainPage) with control template, in its Content i am binding ContentView.
`

`

Inside that ContentView i need to get DisplayActionSheet, which is not available for ContentView.

How to use DisplayActionSheet inside ContentView ?

ActivityIndicator when loading a page

$
0
0

Hello everybody!

I have a problem, that when you go to the page the user waits a long time until it loads. ActivityIndicator does not save.

I have a very complex layout, and I would like to put it on the download (Show ActivityInicator). My Layout is loaded for about 6 seconds. If I just run Loading, then everything hangs up very much, since Layout has not loaded yet.

Can I run ActivityIndicator smoothly in parallel with loading Layout?

Viewing all 58056 articles
Browse latest View live


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