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

Phone vs tablet design questions

$
0
0

Hi,

In our old enterprise iOS app we've used SplitView Controller for both phones and tablets, but only displayed master on phones and master/details on tablets. This approach worked very well because we could display say list of invoices on master view and actual invoice info on details, while when on phone we would push details instead of displaying in details.

Now we're in the process of creating our app from scratch with Xamarin.Forms and going Android as well and I'm having hard time replicating this.
On the phones Xamarin.Forms hamburger menu is only suitable for fly-out menus, would be a bad design to show current list of invoices there.

Anyone had same design issues? Did you find good solutions? I wonder if I should create custom split view control, so I can display master view on phones and master/detail on tablets? This way I could still have navigation drawer for additional menu items only?


How to get the jks for the lost keystore?

$
0
0

Hi,

I have a Xamarin Forms app and I lost my ketstore file

Now Google is asking me to follow below steps to recover the keystore

but the first command is asking for the jks file

Where can I get that for Xamarin Forms app?

Hi There,
Thanks for contacting Google Play Developer Support.

Now that we’ve verified your account, I’m happy to help you reset your upload key. The new upload key will be used to sign APKs that you upload to Play.

Here’s how to generate and register a new upload key:
Follow the instructions in the Android Studio Help Center to generate a new key. It must be different from any previous keys. Alternatively, you can use the following command line to generate a new key:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
This key must be a 2048 bit RSA key and have 25-year validity.
Export the certificate for that key to PEM format:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Reply to this email and attach the upload_certificate.pem file.
I look forward to your response. Please let me know if you have any questions in the meantime.

Regards,
Jaden
Google Play Developer Support

Thanks,
Jassim

How to Implement Multi-factor Authentication with Azure (MFA) in xamarin Forms

$
0
0

Hi , I am working on multi factor authentication using azure Active Directory but when I am trying to login it is opening in webview, but I am looking for a way to do the same inside my application not in webview.

I have looked in various articles but I did not find any way to do the same , please suggest me or give me any idea how can I implement the MFA in my app without opening the webview using Azure. (I want to use the same process but on my custom/native designed screen for the Authorization [credentials screen and OTP screen]).

Any suggestion will be really helpful Thanks in advance.

Hello, tell me why xamarin forms does not see resources?

$
0
0

Hello, tell me why xamarin forms does not see resources?

How can I refresh a content page without having to reload or use refreshing?

$
0
0

How can I refresh a content page without having to reload or use refreshing?

I am making a clone of a social network, and so in every action I do, I have to use the refresh to update the app's content.

How to animate AbsoluteLayout size changes

$
0
0

I'm trying to animate size changes of an AbsoluteLayout.
My AbsoluteLayout is contained within a FlexLayout and its width changes when an underlying control is in focus.
I need it to work on Android but if it could be done in a Xamarin Forms kinda way - the better.

XamlCTask Error

$
0
0

Hello everyone,
I have a helper library. I want to use the remote server for packages. So I added the necessary keys in the nuget config file (globalPackagesFolder), then changed the csproj file and rebuild it. I see that you get the packages from the right place, but I get 2 errors. The errors are below. Can anyone help me?
Thank you.
Best regards.

Error The "XamlCTask" task could not be instantiated from "\mobiletestserver.tb\xamarinNuget\packages\Xamarin.Forms.3.6.0.264807\build\net46\Xamarin.Forms.Build.Tasks.dll". Could not load file or assembly 'Xamarin.Forms.Build.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=798c2ba514f889d3' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Error The "XamlCTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name

Pending Add Error

$
0
0

So yesterday i started to get "Pending Add" whenever i tried to add for example a png file to my resource folder or basically any folder.
I've already have some images added to the project and they are safe and sound(checked in)

Ive tried following workaround:

  • Copy/paste and adding the image in the cs.proj file manually
  • Exclude/Include in project
  • Add existing file
  • Copy/paste the image through file explorer to the desired folder and then include in project
  • Restarted VS more times then i can count.

Anyone encountered this before?

Current versions in use:

Visual Studio Community 2017 Version 15.1 - 26403.3 Release
Xamarin 4.4.034
Android SDK 7.2.07


How to make a tabs in a TabbedPage do actions to one page ....?

$
0
0

Hi , The Title say it pretty much .

I couldn’t find a way to do it , so i will be thrilled if any one know how to do it.

Thank you!

( look at the gif )

Cannot display ListView data when creating PDF using PdfSharp.Xamarin.Forms

$
0
0

I am new to xamarin and I am using PdfSharp.Xamarin.Forms nuget to create a PDF in Xamarin forms for both Android and iOS. Problem is I cannot render ListView. They have mentioned about it, and need to write a renderer for it. But I have no idea how to create and bind it.

This is how I did it.

    <Grid x:Name="mainGrid">

        <ScrollView>

            <StackLayout Padding="4" Orientation="Vertical">

                <!--<Image HeightRequest="80" Source="logojpeg.jpg" Margin="0,0,0,5"/>-->

                <Label FontSize="18" TextColor="Black" FontFamily="{StaticResource timesNewRomanBold}" HorizontalOptions="CenterAndExpand" Text="Monthly Motor Renew List of Jayasekara (900585) as at January, 2020"/>
                <Label FontSize="18" TextColor="Black" FontFamily="{StaticResource timesNewRomanBold}" HorizontalOptions="CenterAndExpand" Text="Report generated on 27 December, 2019" Margin="0,0,0,5"/>

                <ListView x:Name="renewListView"
                              Footer=""
                              pdf:PdfRendererAttributes.ListRendererDelegate="{StaticResource PDFSampleListRendererDelegate}"
                              BackgroundColor="White"
                              SeparatorVisibility="None"
                              HasUnevenRows="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell IsEnabled="false">



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

            </StackLayout>

        </ScrollView>

    </Grid>

Code Behind

public partial class MotorRenewalFinalPrint : ContentPage
{
    public MotorRenewalFinalPrint()
    {
        InitializeComponent();
    }

    public MotorRenewalFinalPrint (List<MotorRenewalPrintData> newdd)
    {
        InitializeComponent ();
        Title = "Save as PDF";
        renewListView.ItemsSource = newdd;
    }

    private void pdf_Clicked(object sender, EventArgs e)
    {

        var pdf = PDFManager.GeneratePDFFromView(mainGrid);
        var fileManager = DependencyService.Get<IFileIO>();
        string filePath = Path.Combine(fileManager.GetMyDocumentsPath(), "formpdf.pdf");
        DependencyService.Get<IPdfSave>().Save(pdf, filePath);
        DependencyService.Get<IPDFPreviewProvider>().TriggerPreview(filePath);

    }
}

PDFSampleListRendererDelegate renderer

public class PDFSampleListRendererDelegate : PdfListViewRendererDelegate
{
    public override void DrawCell(ListView listView, int section, int row, XGraphics page, XRect bounds, double scaleFactor)
    {
        base.DrawCell(listView, section, row, page, bounds, scaleFactor);
    }

    public override void DrawFooter(ListView listView, int section, XGraphics page, XRect bounds, double scaleFactor)
    {
        base.DrawFooter(listView, section, page, bounds, scaleFactor);
    }

    public override double GetFooterHeight(ListView listView, int section)
    {
        return base.GetFooterHeight(listView, section);
    }
}

ACR.UserDialogs Splat - Could not be resolved as it was built against Version=v5.0

$
0
0

Hi

Since upgrading my version of Visual Studio 2019 to the latest build I have been unable to build my project.

Is anyone getting this same message or do you know how to resolve it?

I am using Splat 2.0.0 as I am user ACR.UserDialogs 6.5.1 as part of a shared project.

.nuget/packages/splat/2.0.0/lib/netstandard1.1/Splat.dll" could not be resolved because it was built against the ".NETPortable,Version=v5.0" framework. This is a higher version than the currently targeted framework ".NETPortable,Version=v4.5,Profile=Profile111".

Many thanks in advance

Disabled button style

$
0
0

I'm using MVVM approach described here.

To control a button behaviour I use ICommand binding with CanExecute flag. Everything works.

But how can I control disabled button style (background color and text color) in XAML?

EMDK SDK Release version not working

$
0
0

Hello everyone
I'm developing an enterprise application with Zebra devices and EMDK SDK for barcode scanning for Xamarin.Android and I used Dependency Service so I developed the app with Xamarin.Forms everything is working super fine but the release version is not working after I open the app it immediately stops working and closes
In addition to this I always has warning like this

Xamarin.Android Project Linking Failure

$
0
0

The following error appeared when I build my Xamarin.Android project in Release. I have chosen linking "SDK Assemblies Only". If I choose no linking, no exceptions appeared. My Xamarin.Forms project has reference to another project which uses System.Configuration.dll. So it needed to be referenced in my project. I have tried to remove System.Configuration reference from subprojects but it has a is quite extensive use. I had to reference to this subproject as it is a Model project that is commonly used in the main Web app solution that is already been structured and deployed with .net framework 4.6.
Is there any alternative so as to pass this linker error?

Severity Code Description Project File Line Suppression State
Error Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Configuration.ConfigurationException' (defined in assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') with scope 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Configuration.ConfigurationException
at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
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)
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) in /Users/runner/runners/2.161.1/work/1/s/external/Java.Interop/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics/Diagnostic.cs:line 165
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute()

How to create Samsung emulators in visual studio?

$
0
0

Hi,

Can anyone guide me on how to create different Samsung emulators for testing? All I can see is the Nexus device emulators. Thank you.


Is mac mini enough for deploy to market ?

$
0
0

Hi, firstly i'm sorry about my bad english.

I have a question about mac mini,

1-Could i deploy app to market with mac mini
2-Is good for xamarin.forms programming?

and who use mac mini for create application and deploy ?

Thank u

How to bind a nested model to a listview?

$
0
0

I need to bind a nested model to a listview

The model is as follows

public class StudySearchResultModel
{
    public int StudySearchId { get; set; }
    public string BriefTitle { get; set; }

    public List<FacilityModel> Facilities { get; set; }      // a property which is list of another model named as FacilityModel
}

public class FacilityModel
{
    public int FacilityId { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    public string Phone { get; set; }
}

Then the View Model

Here the Itemsource to listview is "StudyResults"

private ObservableCollection<StudySearchResultModel> _studyResults;
    public ObservableCollection<StudySearchResultModel> StudyResults
    {
        get { return _studyResults; }
        set
        {
            _studyResults = value;
            OnPropertyChanged("StudyResults");
        }
    }

var temp = (searchResult.studySearchResultDtos.Select(i => new StudySearchResultModel()
                    {
                        StudySearchId = i.Id,
                        BriefTitle = i.BriefTitle,
                        FacilityId = i.Facilities?.FirstOrDefault()?.Id ?? 0,
                        FacilityPhone = i.Facilities?.FirstOrDefault()?.Phone,
                        IsPhoneEnabled = !string.IsNullOrEmpty(i.Facilities?.FirstOrDefault()?.Phone),  
                        FacilityEmail = i.Facilities?.FirstOrDefault()?.Email,
                        FacilityName = i.Facilities?.FirstOrDefault()?.Name,
                    }));
                    StudyResults = new ObservableCollection<StudySearchResultModel>(temp.ToList());

And the xaml of listview is as follows

ListView x:Name="ItemsListView"
              HorizontalOptions="FillAndExpand"
              VerticalOptions="FillAndExpand"
              ItemsSource="{Binding StudyResults,Mode=TwoWay}"
              CachingStrategy="RecycleElement"
              SelectedItem="{Binding SelectedItem, Mode=TwoWay}">

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <StackLayout Padding="2">
                        <Frame BorderColor="#f3f3f3"
                               Visual="{OnPlatform Default=Material, iOS=Default}"
                               HasShadow="True"
                               Padding="10"
                               Opacity="NaN">
                            <StackLayout Orientation="Horizontal"
                                         VerticalOptions="Center"
                                         HorizontalOptions="FillAndExpand">
                                <StackLayout HorizontalOptions="FillAndExpand"
                                             Padding="2,2,2,2">
                                    <Label Text="{Binding BriefTitle, Mode=TwoWay}"
                                                                 FontSize="16"
                                                                 FontAttributes="None" />

                                    <StackLayout Orientation="Horizontal"
                                                 VerticalOptions="EndAndExpand"
                                                 HorizontalOptions="End"
                                                 Padding="2,2,2,2"
                                                 Margin="2,2,2,2"
                                                 BackgroundColor="Transparent">
                                        <Image Source="call.png"
                                               WidthRequest="30"
                                               HeightRequest="30"
                                               IsVisible="{Binding IsPhoneEnabled, Mode=TwoWay}">
                                            <Image.GestureRecognizers>
                                                <TapGestureRecognizer Command="{Binding Path=BindingContext.CallTapCommand, Source={x:Reference BrowseItemsPage}}"
                                                                      CommandParameter="{Binding FacilityPhone, Mode=TwoWay}" />
                                            </Image.GestureRecognizers>
                                        </Image>
                                    </StackLayout>
                                </StackLayout>
                            </StackLayout>
                        </Frame>
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>

    </ListView>

Implement system like OnPlatform/OnIdiom

$
0
0

Hi,
I need to bind to a different property depending on the language of my app.
I would like to do this by XAML and was inspiried by OnPlatform/OnIdiom.

So I created something like OnIdiom but for Languages, but I have no clue how to make it accessible in any content in XAML.

using ThibertApp.Resources;

namespace ThibertApp.Localization
{
    public class OnLanguage<T>
    {
        T _EN;
        T _FR;
        bool _isENSet;
        bool _isFRSet;

        public T EN
        {
            get => _EN;
            set
            {
                _EN = value;
                _isENSet = true;
            }
        }

        public T FR
        {
            get => _FR;
            set
            {
                _FR = value;
                _isFRSet = true;
            }
        }

        public static implicit operator T(OnLanguage<T> onLanguage)
        {
            switch (AppResources.Culture.TwoLetterISOLanguageName)
            {
                default:
                case "en":
                    return onLanguage._isENSet ? onLanguage.EN : default(T);
                case "fr":
                    return onLanguage._isFRSet ? onLanguage.FR : default(T);
            }
        }
    }
}
<?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:s="clr-namespace:ThibertApp.Resources"
             xmlns:l="clr-namespace:ThibertApp.Localization;assembly=ThibertApp"
             x:Class="ThibertApp.Pages.HomePage"
             Title="{Binding Title}"
             IconImageSource="{Binding IconImageSource}"
             BackgroundColor="White"
             Style="{StaticResource ThibertPage}">
    <ContentPage.Content>
        <StackLayout Margin="10">
            <Frame CornerRadius="10"
                   BackgroundColor="{StaticResource ThibertGrey}">
                <Entry Placeholder="{Static s:AppResources.SearchPlaceholder}">
                    <Entry.Text>
                        <l:OnLanguage EN="{Binding TextEN}" FR="{Binding TextFR}"/>
                    </Entry.Text>
                </Entry>
            </Frame>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

When I reference my class and attempt to enter values it gives those errors.

Severity    Code    Description Project File    Line    Suppression State
Error   XLS0504 Property 'Text' does not support values of type 'OnLanguage'.   ThibertApp  HomePage.xaml   17  
Severity    Code    Description Project File    Line    Suppression State
Error       Position 17:26. Type l:OnLanguage not found in xmlns clr-namespace:ThibertApp.Localization  ThibertApp  C:\Users\william_d\source\repos\ThibertApp\ThibertApp\ThibertApp\Pages\HomePage.xaml    17  

Does anyone have any guideline as to how to make this possible? I've cloned Xamarin Forms and looked for reference to OnIdiom/OnPlatform and didn't find much that could answer my questions.

Thank you very much

Shell.FlyoutHeaderTemplate Not Refresh

$
0
0

Hi
At first I have Three buttons

1) go to lagin page
2) go to main page and refresh Shell.FlyoutHeaderTemplate
3) hide bottom login and register and sho exit

not working FlyoutHeaderTemplate Not Refresh



How to set AbsoluteLayout.LayoutBounds OnPlatform in XAML file?

$
0
0

How to set AbsoluteLayout.LayoutBounds OnPlatform in XAML file?

I have tried to do like this:

<AbsoluteLayout>
    <Label>
        <AbsoluteLayout.LayoutBounds>
             <OnPlatform x:TypeArguments="Rectangle" iOS="..." Android="..." /> 
            </AbsoluteLayout.LayoutBounds>
    </Label>
</AbsoluteLayout>

but it doesn't work

Viewing all 77050 articles
Browse latest View live


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