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

Button click action is not working barcode scanning

$
0
0
I am developing application for Android. In first page of application I need to scan the barcode in zebra device and need to click the button from that page. I have done the barcode scanning after that I clicked button, that button click action in not happening. Please help I have sticker for two days

Thanks

Is there Any alternate of microchart nugets to implement Graph Chart?

$
0
0

Is there Any alternate of microchart nugets to implement Graph Chart? microchart Nugets increase package size .

The "XamlCTask" task failed unexpectedly.

$
0
0

Hello Team,
I am facing this The "XamlCTask" task failed unexpectedly. problem after adding the xamarin.forms.maps package to my application.

Waiting for your response.

The Essential UI Kit Includes 35+ Free Xamarin.Forms App Templates

$
0
0

Hello Everyone,

I think posting this information here will help Xamarin.Forms developers reduce their development time for building beautiful mobile apps.

The Essential UI Kit for Xamarin.Forms includes 35+ elegantly designed XAML pages, which can be used for modern mobile apps. You can use these pages to build your application from scratch or add required pages to your current applications. All the pages are based on the MVVM pattern, which makes it easy to integrate your business logic. The kit comes with a powerful Visual Studio extension, so adding new pages is like adding a ContentPage.

More pages are coming to this UI kit in the near future!

You can find all the resources to get started with this new product in the following blog post.

https://www.syncfusion.com/blogs/post/the-essential-ui-kit-for-xamarin-forms-is-ready-to-use.aspx

I encourage you to try using our Essential UI Kit to build your Xamarin.Forms apps faster and then give us your feedback.

Thanks,
Prabakaran

Xamarin Essentials Sensors Reading

$
0
0

I'm trying to use XamarinEssentials to get sensors reading at the highest speed possible.
Trying to use SensorSpeed.Fastest, I'm still getting all the events on the Main/UI thread (which is for sure not the fastest way).
I hoped to find a way to get the events on other threads so I can collect more samples from the sendors.

Any sensor that we start with SensorSpeed.Fastest is claimed to "Get the sensor data as fast as possible (not guaranteed to return on UI thread)."

Tried the following code on multiple devices (and different sensors). Always same results (all notifications are always in the main/ui thread).
Am I doing anything wrong?

Note:

  • I'm using Xamarin Forms
  • Tested on Android devices

Here is a code snippet that demonstrated my issue:

Magnetometer.ReadingChanged += Magnetometer_ReadingChanged;
Magnetometer.Start(SensorSpeed.Fastest)
...

void Magnetometer_ReadingChanged(object sender, MagnetometerChangedEventArgs e)
{
** // This always received on ThreadId=1 (Main/UI Thread)...**
Console.WriteLine($"Thread: {Thread.CurrentThread.ManagedThreadId},. Reading: {data.MagneticField.}");
}

Open picker on Listview itemtapped event in xamarin forms

$
0
0

I want to Open picker list (picker.focus()) whenever I click on Frame.
I am using Xamarin forms with Prism Framework.

I have tried with below code but getting item object , not picker object.
<ListView.Behaviors>

                        <behavior:EventToCommandBehavior
                            EventName="ItemTapped"
                            Command="{Binding ApplyLeaveInfoCommand}"

                            EventArgsParameterPath="Item"/>

                    </ListView.Behaviors>

So Can I get picker.focus() after click on listview Item ???

Complete code:-


<ListView.ItemTemplate>





<Grid.RowDefinitions>


</Grid.RowDefinitions>
<Grid.ColumnDefinitions>


</Grid.ColumnDefinitions>

                                            <Image Source="{Binding ImageSource}" Aspect="AspectFit" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" VerticalOptions="CenterAndExpand" />
                                        </Grid><Frame.GestureRecognizers>
                                            <ClickGestureRecognizer Command="{Binding ApplyLeaveInfoCommand}"
                                                                    CommandParameter="{Binding .}"
                                                                    /></Frame.GestureRecognizers>
                        </Frame>
            </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>

Unable to connect to SignalR via c# client

$
0
0

I am trying a simple Azure function SignalR connection using Xamarin C# client.
The sample Javascript conenction to Azure function works fine.

        [FunctionName("negotiate")]
        public static SignalRConnectionInfo GetSignalRInfo(
        [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
        [SignalRConnectionInfo(HubName = "chat")] SignalRConnectionInfo connectionInfo)
        {
            Console.WriteLine($"UserInfo: ");
            return connectionInfo;
        }

The client Javascript code works fine

    const connection = new signalR.HubConnectionBuilder()
      .withUrl(`${apiBaseUrl}/api`)
      .configureLogging(signalR.LogLevel.Information)
      .build();

    connection.on('newMessage', newMessage);
    connection.onclose(() => console.log('disconnected'));

    console.log('connecting...');
    connection.start()
      .then(() => data.ready = true)
      .catch(console.error);

It's my Xamarin forms c# code that hangs on StartAsync() call

            hubConnection = new HubConnectionBuilder()
                //.WithUrl($"http://signalrdemomsph.azurewebsites.net/chatHub")
                .WithUrl($"http://10.0.2.2:7071/api/")
                //.WithUrl($"https://10.0.2.2:44398/chatHub")
                .Build();

            hubConnection.On<string>("negotiate", (user) =>
            {
                Messages.Add(new SignalRMessage() { User = Name, Message = $"{user} has joined the chat", IsSystemMessage = true });
            });


            hubConnection.On<string, string>("ReceiveMessage", (user, message) =>
            {
                Messages.Add(new SignalRMessage() { User = user, Message = message, IsSystemMessage = false, IsOwnMessage = Name == user });
            });

            try
            {
                await hubConnection.StartAsync();
            }
            catch(Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }

            await hubConnection.InvokeAsync("negotiate", Name);

I read here at Stackoverflow it could be a deadlock issue as I get an exception after a minute or so at the above code Console.Writeline(e.StackTrace)
as below.

  at System.Net.Http.ConnectHelper.ConnectAsync (System.String host, System.Int32 port, System.Threading.CancellationToken cancellationToken) [0x00180] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:84 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 
  at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ea] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:371 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 
  at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync (System.Threading.Tasks.ValueTask`1[TResult] creationTask) [0x000a2] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:529 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 
  at System.Net.Http.HttpConnectionPool.SendWithRetryAsync (System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x0003f] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:284 
  at System.Net.Http.RedirectHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:32 
  at Microsoft.AspNetCore.Http.Connections.Client.Internal.AccessTokenHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ff] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00095] in <929233fdf21345829c24828bbaf559fa>:0 
  at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync (System.Uri url, System.Net.Http.HttpClient httpClient, Microsoft.Extensions.Logging.ILogger logger, System.Threading.CancellationToken cancellationToken) [0x00257] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x00080] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00180] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x0011e] in <929233fdf21345829c24828bbaf559fa>:0 
  at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00091] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x00114] in <929233fdf21345829c24828bbaf559fa>:0 
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x001bf] in <929233fdf21345829c24828bbaf559fa>:0 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore (System.Threading.CancellationToken cancellationToken) [0x000a5] in <82f2bec582b048f7a648dfe730be82f1>:0 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner (System.Threading.CancellationToken cancellationToken) [0x0019e] in <82f2bec582b048f7a648dfe730be82f1>:0 
  at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <82f2bec582b048f7a648dfe730be82f1>:0 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync (System.Threading.CancellationToken cancellationToken) [0x00091] in <82f2bec582b048f7a648dfe730be82f1>:0 
  at mmMobile.BoardSetupPage.ConnectViaSignalR () [0x000af] in C:\TestCodes\Xamarin\mmMobile\mmMobile\mmMobile\BoardSetupPage.xaml.cs:162 

Getting Mono.AndroidTools.RequiresUninstallException on Android

$
0
0

Today I started getting this deployment error on android:

Severity Code Description Project File Line Suppression State
Error ADB0030: Mono.AndroidTools.RequiresUninstallException: The installed package is incompatible. Please manually uninstall and try again.
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\267\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 339
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.b__0(Task1 t) in E:\A\_work\267\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753 at System.Threading.Tasks.ContinuationTaskFromResultTask1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 187
--- End of stack trace from previous location where exception was thrown ---
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__112.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 414
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__106.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 217
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__104.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 119 0

It only happens in Debug, but in Release i can deploy and run the app just fine.
Why is this happening?

This morning i installed the Android SDK 10.0 and I suspect it started after that, so now I uninstalled it, but I still can't deploy because of the same error.
Other apps from the same PC can be deployed just fine, so I don't get it...

I did check this out
https://docs.microsoft.com/en-us/xamarin/android/errors-and-warnings/adb0030

but I don't even have my app installed on the device...

Thanks


How can I detect when the user push a button from the keyboard? Android (Search Button)

$
0
0

I need to execute the search when the user push that button

Is it possible to show a Crystal Reports on Xamarin?

$
0
0

Hello there!

Right now, my apps can show some reports in PDF format: I have a WebApi call that opens a Crystal Report, populate it with updated data, save as PDF, and put it on a shared folder to see it using that popular javascript web viewer through a WebView on the App.

But our customer wants to watch the Crystal Report itself, because it has navigation (sub-reports, line details data...), so PDF is not good enough.
Asking to our SAP expert, he said that there is a lot of plugins to see Crystals on PC and mobile phones, so it can be easy to find a plugin or something to put a report in our APP. So I was looking for some examples or info, and I only found how to do on VS with C#, but no clue on how to show on a Xamarin page or how to open it on a third-party APP (if any).

Could you give me some advices, point me on the right direction or a link to a blog or something to do that? Or what the customer/expert wants is impossible right now?

Thank you.

XAML Hot Reload for Xamarin.Forms

$
0
0

XAML Hot Reload for Xamarin.Forms is now available for all to try! Enabling you to make changes to your XAML UI and see them reflected live. Without ever requiring another build and deploy.

XAML Hot Reload for Xamarin.Forms speeds up your development. While also making it easier to build, experiment, and iterate on your user interface. This means no longer having to rebuild your app each time you tweak your UI. Because it instantly shows you your changes in your running app!

When your application is compiled using XAML Hot Reload, it works with all libraries and third-party controls. It will be available for iOS and Android in Visual Studio 2019 and Visual Studio 2019 for Mac. This works on all valid deployment targets, including simulators, emulators, and physical devices.

To use XAML Hot Reload for Xamarin.Forms, it must be enabled via:

Tools > Options > Xamarin > Hot Reload > Enable XAML Hot Reload for Xamarin.Forms

macOS: Use FontAwesome

$
0
0

Hi,

I have a Xamarin.Forms application with FontAwesome for iOS & Android. Now I
want to use it in macOS also.

I added this to the Info.plist:

    <key>Fonts provided by application</key>
    <array>
        <string>FontAwesome5Regular.otf</string>
        <string>FontAwesome5Solid.otf</string>
    </array>

In my App.xaml I use this:

<OnPlatform x:Key="FontAwesomeBrands" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Brands.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Brands-Regular" />
    <On Platform="macOS" Value="FontAwesome5Brands-Regular" />
</OnPlatform>

<OnPlatform x:Key="FontAwesomeSolid" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Solid.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Free-Solid" />
    <On Platform="macOS" Value="FontAwesome5Free-Solid" />
</OnPlatform>

<OnPlatform x:Key="FontAwesomeRegular" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Regular.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Free-Regular" />
    <On Platform="macOS" Value="FontAwesome5Free-Regular" />
</OnPlatform>

Could it be that the FontFamlily names other on macOS?
I checked that the font is in Resource folder in the macOS project and it is defined as BundleResource.

Thanks and greets,
Johann

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocatio

$
0
0

Getting the below exception when trying to send a string value through MessagingCenter. The exception is on a PopupPage.

Exception Details:

exception:>>System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
 at CatholicBrain.Views.BibleOrderGamePage.<.ctor>b__3_0 (CatholicBrain.Model.BibleOrderGameViewModel s, System.String answer) [0x00001] in F:\My Projects\Xamarin\catholicbrain-mobile-app\CatholicBrain\CatholicBrain\Views\BibleOrderGamePage.xaml.cs:30 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <46c2fa109b574c7ea6739f9fe2350976>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in <46c2fa109b574c7ea6739f9fe2350976>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <46c2fa109b574c7ea6739f9fe2350976>:0 
  at Xamarin.Forms.MessagingCenter+Subscription.InvokeCallback (System.Object sender, System.Object args) [0x00064] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:94 
  at Xamarin.Forms.MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:217 
  at Xamarin.Forms.MessagingCenter.Xamarin.Forms.IMessagingCenter.Send[TSender,TArgs] (TSender sender, System.String message, TArgs args) [0x00013] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:115 
  at Xamarin.Forms.MessagingCenter.Send[TSender,TArgs] (TSender sender, System.String message, TArgs args) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:108 
  at CatholicBrain.Model.BibleOrderGameViewModel.StartBibleOrderCheck (CatholicBrain.Model.BibleOrderAnswer selectedItem, System.Collections.Generic.List`1[T] rightAnswerList) [0x00114] in F:\My Projects\Xamarin\catholicbrain-mobile-app\CatholicBrain\CatholicBrain\Model\BibleOrderGameViewModel.cs:195 

MessagingCenter.Send

MessagingCenter.Send<BibleOrderGameViewModel, string>(this, "rightanswer", selectedItem.Answer);
await PopupNavigation.Instance.PopAsync();

MessagingCenter.Subscribe

MessagingCenter.Subscribe<BibleOrderGameViewModel, string>(this, "rightanswer", (s, answer) =>
{
    answerLabel.Text = answer;
});

How to set background image in tabbed page?

$
0
0

I am trying to add a background image for my tabbed page. But I am not able to set it somehow.
And even I want to change the background color of the tabbed page bar.

code-behind:

viewModel = new UserRoomsViewModel(App.LoggedInUserId);
        foreach (Room roomEntity in viewModel.roomDataStore)
        {
            Children.Add(new MyDevices(roomEntity.RoomId, roomEntity.RoomName)
            {
                Title = roomEntity.RoomName
            });
        }

Exception thrown by CollectionView while implementing as Staggeredgridlayoutmanager

$
0
0

I'm facing issue in Collectionview after implementing as staggeredgridlayoutmanager as given below"
Java.Lang.ArrayIndexOutOfBoundsException: 'length=4; index=36'
Note: "index=36" in the error may vary depending upon scroll position and "length=4" in the error statement i think are the number of visible items at any time in collectionview.

My Assumptions:
I think the error mentioned above always occurs when i reach to the end of collectionview and collectionview try to load more items. This is only happens when i fastely scroll collectionview and if i scroll normally then all is working well.

As for as i know, the think that is causing the problem is the layout measuring process after adding more items to the collectionview at reaching to the bottom of it and in that duration if i continue to scroll while collectionview is busy to measure the layout, then it will throw an exception as mentioned above.

And i think if i'm able to detect layout measuring process and stop further user scroll at that time, then i can solve the problem but the question is that is there anything exposed by collectionview or even at platform specific level (In my case android) to know that Layout Measuring processed is being performed

    If i'm wrong, please someone can give me solution to solve that problem!

How to set background image in tabbed page?

$
0
0

I am trying to add a background image for my tabbed page. But I am not able to set it somehow.
And even I want to change the background color of the tabbed page bar.

code-behind:

viewModel = new UserRoomsViewModel(App.LoggedInUserId);
        foreach (Room roomEntity in viewModel.roomDataStore)
        {
            Children.Add(new MyDevices(roomEntity.RoomId, roomEntity.RoomName)
            {
                Title = roomEntity.RoomName
            });
        }

How to Binding page in ContentView with MVVM

$
0
0

Hi everyone

I am developing an application with Xamarin Forms 4.3.0.9. I also use Shell in my project. My goal is to swipe between Tabbars. I've written custom renderer code for this. However, when used with shell structure, black screen error occurs on iOS side.

That's why I came up with the CubeView of the cardViews plugin I used in my project. Because the tabbar feature and you can scroll. But I have a problem.

With MVVM, I need to bind 4 of my pages into the card. I tried something for it, but I didn't get the result I wanted. I'm going to show you the codes I wrote down below. I ask you to tell me how to bind the page dynamically into the card with MVVM.

CardsSampleViewModel .cs

namespace GulaylarMenuDesign.ViewModel
{
public sealed class CardsSampleViewModel : INotifyPropertyChanged
{

        public event PropertyChangedEventHandler PropertyChanged;

        private int _currentIndex;
        private int _pageCount = 0;

        public CardsSampleViewModel()
        {
            Items = new ObservableCollection<object>
            {
                new { Source = "DDD", Ind = _pageCount++, Color = Color.Red, Title = "Altın"},
                new { Source = "DDD", Ind = _pageCount++, Color = Color.Red, Title = "Pırlanta", },
            };

            PanPositionChangedCommand = new Command(v =>
            {
                if (IsAutoAnimationRunning || IsUserInteractionRunning)
                {
                    return;
                }

                var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1);
                if (index < 0 || index >= Items.Count)
                {
                    return;
                }
                CurrentIndex = index;
            });

            RemoveCurrentItemCommand = new Command(() =>
            {
                if (!Items.Any())
                {
                    return;
                }
                Items.RemoveAt(CurrentIndex.ToCyclicalIndex(Items.Count));
            });

            GoToLastCommand = new Command(() =>
            {
                CurrentIndex = Items.Count - 1;
            });
        }

        public ICommand PanPositionChangedCommand { get; }

        public ICommand RemoveCurrentItemCommand { get; }

        public ICommand GoToLastCommand { get; }

        public int CurrentIndex
        {
            get => _currentIndex;
            set
            {
                _currentIndex = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentIndex)));
            }
        }

        public bool IsAutoAnimationRunning { get; set; }

        public bool IsUserInteractionRunning { get; set; }

        public ObservableCollection<object> Items { get; }

        private object AddPage()
        {
            ContentPage page = new ContentPage();

            var source = page.Content.BindingContext = "AltinPage";

            return source;
        }

    }
}

Is there a way to bind the page into the DataTemplate in the following code?

 > Dnm.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"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:controls="clr-namespace:PanCardView.Controls;assembly=PanCardView"
             xmlns:cards="clr-namespace:PanCardView;assembly=PanCardView"
             xmlns:behaviors="clr-namespace:GulaylarMenuDesign.Behaviors"
             xmlns:viewModels="clr-namespace:GulaylarMenuDesign.ViewModel"
             xmlns:dnm="clr-namespace:GulaylarMenuDesign.Views.FaydalıBilgiler"
             mc:Ignorable="d"
             x:Class="GulaylarMenuDesign.Views.FaydalıBilgiler.Dnm"
             BackgroundColor="#343238">

    <ContentPage.BindingContext>
        <viewModels:CardsSampleViewModel/>
    </ContentPage.BindingContext>

    <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="LabelBodyFont" TargetType="behaviors:CustomLabel">
                <Setter Property="TextColor" Value="White"/>
                <Setter Property="FontSize" Value="17"/>
                <Setter Property="LineHeight" Value="1.3"/>
                <Setter Property="LineBreakMode" Value="WordWrap"/>
                <Setter Property="FontFamily" Value="Times"/>
                <Setter Property="Margin" Value="10,0,10,0"/>
            </Style>

            <Style x:Key="SubtitleFont" TargetType="behaviors:CustomLabel">
                <Setter Property="TextColor" Value="#ED6933"/>
                <Setter Property="FontSize" Value="Subtitle"/>
                <Setter Property="LineBreakMode" Value="WordWrap"/>
                <Setter Property="FontFamily" Value="Times"/>
                <Setter Property="Margin" Value="10,10,10,0"/>
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>

    <StackLayout Spacing="10" Padding="0, 0, 0, 10">
        <ContentView HeightRequest="40" HorizontalOptions="FillAndExpand">
            <controls:TabsControl
                StripeColor="#ED6933"      
                HeightRequest="40"
                BindingContext="{x:Reference cube}">
                <controls:TabsControl.ItemTemplate>
                    <DataTemplate>
                        <Label HorizontalTextAlignment="Center"
                               VerticalTextAlignment="Center"
                               HorizontalOptions="FillAndExpand"
                               VerticalOptions="CenterAndExpand"
                               FontSize="Subtitle"
                               FontFamily="Times"
                               TextColor="White"
                               Text="{Binding Title}"/>

                    </DataTemplate>
                </controls:TabsControl.ItemTemplate>
            </controls:TabsControl>
        </ContentView>
        <cards:CubeView
                x:Name="cube"
                VerticalOptions="FillAndExpand"
                ItemsSource="{Binding Items}"
                SelectedIndex="{Binding CurrentIndex}">
            <cards:CubeView.ItemTemplate>
                <DataTemplate>
                    <ContentView>
                        <StackLayout BindableLayout.ItemsSource="{Binding Source}">
                            <BindableLayout.ItemTemplate>
                                <DataTemplate>
                                    <dnm:DDD/>
                                </DataTemplate>
                            </BindableLayout.ItemTemplate>
                        </StackLayout>
                    </ContentView>
                </DataTemplate>
            </cards:CubeView.ItemTemplate>
        </cards:CubeView>
    </StackLayout>
</ContentPage>

How to integrate Microsoft Graph Notifications into Xamarin.Forms

$
0
0

Hi,

I am developing an application which contains Microsoft outlook and calendar.
Can anyone help me how to integrate Microsoft Graph Notifications in Xamarin.Forms

The requested resource does not support http method 'GET'

$
0
0

i am using Xamarin form,

Post is working using my Xamarin app to Sql server database using Asp.net Api,

but Get is not working to try to log in method.

my code is below.

using Seagullapi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.UI.WebControls;

namespace Seagullapi.Controllers
{
public class LoginController : ApiController
{
LoginEntities db = new LoginEntities();

    // GET: api/Login
    [HttpPost]
    [ActionName("XAMARIN_REG")]
    public HttpResponseMessage Xamarin_reg(login log)
    {
        try
        {
            login llogin = new login();
            llogin.phone = log.phone;
            llogin.password = log.password;
            llogin.email = log.email;
            llogin.first_name = log.first_name;
            llogin.last_name = log.last_name;
            llogin.dateofbirth = log.dateofbirth;
            llogin.address = log.address;
            llogin.city = log.city;
            llogin.state = log.state;
            llogin.zip = log.zip;
            llogin.passwordconfirm = log.passwordconfirm;

            db.logins.Add(llogin);
            db.SaveChanges();
            return Request.CreateResponse(HttpStatusCode.Accepted, "Successfully Created");
        }
        catch (Exception ex)
        {
            return Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.ToString());
        }

    }


    [HttpGet]
    [ActionName("XAMARIN_Login")]
    // GET: api/Login/5
    public HttpResponseMessage Xamarin_Login(string phone, string password)
    {
        var user = db.logins.Where(x => x.phone == phone && x.password == password).FirstOrDefault();
        if (user == null)
        {
            return Request.CreateResponse(HttpStatusCode.Unauthorized, "Please Enter valid UserName and Password");
        }
        else
        {
            return Request.CreateResponse(HttpStatusCode.Accepted, "Success");
        }
    }
}

}

My log in entities

public partial class login
{
    public string phone { get; set; }
    public string password { get; set; }
    public string email { get; set; }
    public string first_name { get; set; }
    public string last_name { get; set; }
    public string dateofbirth { get; set; }
    public string address { get; set; }
    public string city { get; set; }
    public string state { get; set; }
    public string zip { get; set; }
    public string passwordconfirm { get; set; }
    public string email2 { get; set; }
}

}

please tell me the reason why i cannot work with Get method.

Thank you.

Smooth navigation of master detail page

$
0
0

Hello Guy's
I've create Master detail page and when navigate from one page to another page it show flicker for some time and if content page have to much functionality it tack to much time to show another page any suggestion to resolve it problem.

Thank's

Viewing all 91519 articles
Browse latest View live


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