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

class property not initialize for Xamarin form cross platform only for IOS

$
0
0

I am using Xamarin Cross Platform application to build a sample login form. The following code is just taking the email and password value and giving result. The unique problem is when i run this for Android emulator everything is working fine. The class object LoginDTO hold the value of Username , password but when i run the code for IOS the username ,password is not holding the value and after explicit assign it showing null.

I don't know what is wrong here. I appreciate your help.

                LoginDTO objLogin = new LoginDTO();
                objLogin.UserName = email;
                objLogin.Password = password;
                UserManagerService umanager = new UserManagerService();
                blnresult = await umanager.ValidateLogin(objLogin);

trying to get value from entry column from a xamarin.forms.datagrid

$
0
0

hi guys
im trying to get the quantity value that is set when i enter it.
i cannot use ant third-party licenses such as synfusion, telerik,etc.
i have to use this datagrid

is there any way for me to obtain a value from a cell...?

App Crashed After Xamarin Forms Update to 4.7.0.968

Tab indicator in Xamarin Forms Tabbed Page placed at bottom

$
0
0

I have a Xamarin Forms bottom placed tabbed page rendered using C#. I want a tab indicator to be displayed above each tab icons as it would in a top placed tabbed page. Is it possible? I am not able to find solution anywhere. I came across this SO post - https://stackoverflow.com/a/41570159/10329199, where we can define app:tabIndicatorColor="#123456" in Tabbar.axml. But I didnt work because I'm rendering the tabbar using C# not in AXML. I also want this tab indicator in iOS. Thanks

Network issues in Xamarin forms httpclient

$
0
0

Our mobile app heavily depends on continuous syncing between app and server. For this we run multiple api's in the background(parallely) to fetch the data (like Account, Acc related items etc).

Every 5 mins sync process starts and it instantiates 12 api's. I have a backgroundtask(where I', handling httpclient methods) where all the 12 api's calls this task to fetch it's respective data.

public BackgroundTask(string authToken)
{
client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
}
api call:

private async TTask PostReturnMultipleAsync(string api, object postContent, CancellationToken cancellationToken)
{
try
{
var serializedContent = JsonConvert.SerializeObject(postContent);
HttpContent httpContent = new StringContent(serializedContent, Encoding.UTF8, "application/json");
response = await client.PostAsync(Constants.BaseUrl + "/" + api, httpContent, cancellationToken);
}catch(Exception ex){}
}
The issue is sometimes I'm getting strange errors in some sync process related to network. Let's say sync process starts at 12:00 pm I will be getting errors in some api's and another sync process starts at 12:10 pm, then it works fine.

The errors details are as follows:

[6/23/2020 8:16:26 AM] The network connection was lost.
at System.Net.Http.NSUrlSessionHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) <0x1035be040 + 0x009a3> in <75e8f2cafde249969958834208668188#2628be6571b6c601843a6a945b784ff0>:0 at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) <0x1034e1cd0 + 0x005f4> in <692b89da4aac4c12a3ac3af90678ac25#2628be6571b6c601843a6a945b784ff0>:0 at TCRMobile.Tasks.BackgroundTask1[T].PostAsync (System.String api, System.Object postContent, System.Threading.CancellationToken cancellationToken) <0x103971430 + 0x00377> in <570cf8f88c3948a1b77300eead58c259#2628be6571b6c601843a6a945b784ff0>:0

[6/23/2020 8:16:26 AM] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x280158510 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <1695E60D-6530-4BD8-A2B2-08E8E8C3C317>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <1695E60D-6530-4BD8-A2B2-08E8E8C3C317>.<1>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://apps.tcrsoftware.com/tcrservices/api/Tickets/GetTickets

[6/22/2020 1:43:13 PM] A task was canceled.
at System.Net.Http.NSUrlSessionHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) <0x101d92040 + 0x009a3> in <75e8f2cafde249969958834208668188#2628be6571b6c601843a6a945b784ff0>:0 at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean

I tried setting timeout to 50 seconds, that doesn't helps too. Any better to do this?

trying to get value from entry column from a xamarin.forms.datagrid

$
0
0

hi guys
im trying to get the quantity value that is set when i enter it.
i cannot use ant third-party licenses such as synfusion, telerik,etc.
i have to use this datagrid

is there any way for me to obtain a value from a cell...?

App Crashed After Xamarin Forms Update to 4.7.0.968

My app is unable to connect to internet when I publish app to app store.

$
0
0

My app is unable to connect to internet when I publish app to app store. But it is working when I install using AdHoc profile. Please find below for my info.plist

<key>App Transport Security Settings</key>
<dict>
    <key>Allow Arbitrary Loads</key>
    <true/>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>subdomain.domain.com</key>
        <dict>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

please let me know an doing any mistake. my domain uses "https"


Linker Issue

$
0
0

Hey there,

I'm just wondering if anyone can help me out here.
I am trying to use the linker to reduce the size of my apk.
I have gotten a few errors and resolved them by adding the assemblies to my linker.config file in my Android project.

I am getting the below error:
Mono.Linker.MarkException: Error processing method: 'System.Security.Claims.ClaimsPrincipal IdentityServer4.IdentityServerPrincipal::Create(System.String,System.String,System.String,System.Collections.Generic.IEnumerable`1<System.String>,System.DateTime,System.Security.Claims.Claim[])' in assembly: 'IdentityServer4.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Int32 IdentityModel.EpochTimeExtensions::ToEpochTime(System.DateTime) at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() at Mono.Linker.Steps.MarkStep.Process() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.RunTask() at Xamarin.Android.Tasks.AndroidTask.Execute()

-I have added IdentityServer4 to my linker.config file but it hasn't resolved the issue.
-I have cleaned and rebuilt my solution approx 4 billion times as I've seen that has resolved similar issues for other people.
-All my nuget packages are up to date.
-If I set linker to None, it works but my apk is about 110MB.

Thanks in advance,
Shane

Xamarin.Forms tiled background image?

$
0
0

I've seen a few old threads about tiled backgrounds, but they're either abandoned with no answer or they were not about Xamarin.Forms specifically, but about how to implement tiled backgrounds on each platform.

I'm guessing this is still not possible on Xamarin.Forms, or am I wrong? Anyone knows?

How to change bottom navigation bar icon color Xamarin forms ios

$
0
0

In my project i added bottom navigation bar but i facing an issue unable to change default icon selection colors.

Tabbed page renderer written like this

protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
    base.OnElementChanged(e);
    UITextAttributes normalTextAttributes = new UITextAttributes();
    normalTextAttributes.Font = UIFont.FromName("SanFranciscoText-Light", 9.0F); // unselected

    TabBar.TintColor = UIKit.UIColor.FromRGB(153, 67, 2);
    TabBar.BarTintColor = UIColor.FromRGB(223, 139, 75); 
    try
    {
        var tabbarController = (UITabBarController)this.ViewController;
        if (null != tabbarController)
        {
            tabbarController.ViewControllerSelected += OnTabbarControllerItemSelected;
        }
    }
    catch (Exception exception)
    {
        Console.WriteLine(exception);
    }
    UITabBarItem.Appearance.SetTitleTextAttributes(normalTextAttributes, UIControlState.Normal);
}


public override UIViewController SelectedViewCont
{
    get
    {
        UITextAttributes selectedTextAttributes = new UITextAttributes();
        selectedTextAttributes.Font = UIFont.FromName("SanFranciscoText-Bold ", 12.0F); // SELECTED
        selectedTextAttributes.TextColor = UIColor.White;
        return base.SelectedViewController;
    }
    set
    {
        allViewControllers = base.ViewControllers.ToList();
        base.SelectedViewController = value;
        foreach (UIViewController viewController in base.ViewControllers)
        {
            UITextAttributes normalTextAttributes = new UITextAttributes();
            normalTextAttributes.Font = UIFont.FromName("SanFranciscoText-Light ", 9.0F); 
            viewController.TabBarItem.SetTitleTextAttributes(normalTextAttributes, UIControlState.Normal);
        }           
    }
}

I want to change selected tab Icon color to dark orange and unselected tab color to white. Is there any way to do this ?

Thanks,
Jagdeesh.

FirebaseInstanceId.Instance.Token returning null

$
0
0

In My app, I am trying to get FirebaseInstanceId.Instance.Token but it returning null

Firebase.FirebaseApp.InitializeApp(this);
LoadApplication(new App());
var token = FirebaseInstanceId.Instance.Token;

showing error

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process music.com.wiltapplication. Make sure to call FirebaseApp.initializeApp(Context) first

Is there any mistaken in my code ?

Thanks,
Jagdeesh

Styling ViewCell.ContextActions MenuItem

$
0
0

Hi,
I am looking for some guide that help me to change the style of Viewcell menuitem

Thankou in advance,
David.

text not bold in xamarin forms markdown label

$
0
0

This is my code to bold label text. But text not bold

parameterText= "This is supposed to be bold too"

public FormattedString GetBoldTextValue(string parameterText)
{
var boldFormat = "**";
var formatString = new FormattedString();
while (!string.IsNullOrWhiteSpace(parameterText))
{
try
{
var boldIndex = parameterText.IndexOf(boldFormat);

                if (boldIndex >= 0)
                {
                    if (boldIndex > 0)
                    {
                        var t = parameterText.Substring(0, boldIndex);
                        formatString.Spans.Add(new Span() { Text = t });
                    }
                    parameterText = parameterText.Substring(boldIndex + 2);
                    var next = parameterText.IndexOf(boldFormat);
                    var t1 = parameterText.Substring(0, next);
                    formatString.Spans.Add(new Span() { Text = t1, FontAttributes = FontAttributes.Bold });
                    parameterText = parameterText.Substring(next + 2);
                }
                else
                {
                    formatString.Spans.Add(new Span() { Text = parameterText });
                    break;
                }
            }
            catch (Exception)
            {
                formatString = new FormattedString();
                break;
            }
        }

        return formatString;
    }`

This code worked well. But After I added Label Render this not working. This is my render.

How can I make such a slider


Blinking animation for an image in DataTemplate

$
0
0

https: //stackoverflow.com/questions/62580924/xamarin-forms-blinking-animation-for-an-image-in-datatemplatehow to make it blink

Anybody knows how to fire an event when signing on a Signature Pad in Xamarin.Forms?

$
0
0

I tried this but it doesn't fire when signing.
signatureView.PropertyChanged += (sender, args) => {
var x = string.Empty;
};

And I'm using Xamarin.Controls.SignaturePad.Forms.

profile image crop and drag

$
0
0

i have user profile page where i allow user to upload profile image. I want user can drag and zoom to crop the picture as they like

can anyone help?

How to hide Flyout items In shell xamarin forms.

$
0
0

I have two different users. So I want to show different FLYOUTS in shell flyout respectively.

how to create rating bar in xaml

$
0
0

hello,
how to create a rating bar in xaml and get its value. please help.

Viewing all 79144 articles
Browse latest View live


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