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

Using TabbedPage as a wizard

$
0
0

Hi guys,
I have a following implementation made with TabbedPage and preety much working with the services.

However in order to make it more user friendly and yet control the navigation in specific way, I have following requirements.

Req 1. User must navigate through step 1 to step 2 and so on .. *(Tabs must still be clickable and user only can move further, if he has filled that step completely, User can move through Tabs which are correctly filled in any fashion however should be restricted to the step which has error/empty fields).
I am trying to implement some behaviors here- am I on right track?

Req 2. All the tabs data (MVVM Properties) must be made available for review on final tab, i.e. step 1 to step 6 data in final tab.
(Since I am using Prism Library I tried this with Éventaggregator, however I am not able to get through.)

Can you guys please suggest a good solution?
Thanks.

N Baua


custom viewrenderer for UILabel overlaps text inside list view on scroll

$
0
0

I am using a couple of sources to make a custom renderer for a label that can display htmlstring and has data detectors. On android, it works perfectly, but ios implementation has some issues. Here's the ios implementation :

`using System.ComponentModel;
using CoreGraphics;
using Foundation;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(HyperLinkLabel), typeof(HyperLinkLabelRenderer))]
namespace YourNameSpace
{
public class HyperLinkLabelRenderer : ViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        var view = (HyperLinkLabel)Element;
        if (view == null) return;

        var attr = new NSAttributedStringDocumentAttributes();
        var nsError = new NSError();
        attr.DocumentType = NSDocumentType.HTML;

        var myHtmlData = NSData.FromString(view.Text, NSStringEncoding.Unicode);

        UITextView uilabelleftside = new UITextView(new CGRect(0, 0, view.Width, view.Height));
        //uilabelleftside.Text = view.Text;
        uilabelleftside.Editable = false;
        uilabelleftside.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
        uilabelleftside.Font = UIFont.SystemFontOfSize((float)view.FontSize);


        // Setting the data detector types mask to capture all types of link-able data
        uilabelleftside.DataDetectorTypes = UIDataDetectorType.All;
        uilabelleftside.BackgroundColor = UIColor.Clear;

        // overriding Xamarin Forms Label and replace with our native control
        SetNativeControl(uilabelleftside);
    }

    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);

        if (e.PropertyName == Label.TextProperty.PropertyName)
        {
            var view = (HyperLinkLabel)Element;
            if (view == null) return;

            var attr = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();
            attr.DocumentType = NSDocumentType.HTML;

            var myHtmlData = NSData.FromString(view.Text, NSStringEncoding.Unicode);

            UITextView uilabelleftside = new UITextView(new CGRect(0, 0, view.Width, view.Height));

            uilabelleftside.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            uilabelleftside.Font = UIFont.SystemFontOfSize((float)view.FontSize);
            uilabelleftside.Editable = false;

            // Setting the data detector types mask to capture all types of link-able data
            uilabelleftside.DataDetectorTypes = UIDataDetectorType.All;
            uilabelleftside.BackgroundColor = UIColor.Clear;

            // overriding Xamarin Forms Label and replace with our native control
            SetNativeControl(uilabelleftside);
        }
    }
}

}
`

When I scroll down or up and an item reappears, it fires OnElementChanged with different values and this causes the text of the renderer to overlap.
Here's my Xaml:

<TabbedPage.ItemTemplate> <DataTemplate> <ContentPage Title="{Binding title}"> <ListView ItemsSource="{Binding Posts}"> <ListView.RowHeight> <OnPlatform x:TypeArguments="x:Int32" iOS="200" Android="220"/> </ListView.RowHeight> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Padding="8"> <Grid.ColumnDefinitions> <ColumnDefinition Width = "50"/> <ColumnDefinition Width = "*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height = "40"/> <RowDefinition Height = "3"/> <RowDefinition Height = "*"/> <RowDefinition Height = "30"/> </Grid.RowDefinitions> <Image Grid.Column = "0" Grid.Row = "0" Source = "{Binding author.avatar_url}" Aspect = "AspectFill" WidthRequest = "40" HeightRequest = "40" HorizontalOptions = "Center" VerticalOptions = "Center"/> <Grid Grid.Column = "1"> <Grid.ColumnDefinitions> <ColumnDefinition Width = "*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height = "15"/> <RowDefinition> <OnPlatform x:TypeArguments = "GridLength" iOS="10" Android="15" /> </RowDefinition> </Grid.RowDefinitions> <Label Grid.Row = "0" Style = "{StaticResource authorName}" Text="{Binding author.full_name}" /> <Label Grid.Row = "1" Style = "{StaticResource proffInfo}" Text="{Binding author.proffInfo}" /> </Grid> <Grid x:Name = "postContent" Grid.Row = "2" Grid.Column = "0" Grid.ColumnSpan = "2" > <Grid.RowDefinitions> <RowDefinition Height = "30"/> <RowDefinition Height = "*"/> </Grid.RowDefinitions> <Label Grid.Row = "0 " Style = "{StaticResource heading1}" Text = "{Binding title}" /> <!--<WebView Grid.Row = "1"> <WebView.Source> <HtmlWebViewSource Html="{Binding html_content}"/> </WebView.Source> </WebView>--> <renderers:HyperLinkLabel Grid.Row = "1" Text="{Binding html_content}" /> </Grid> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </ContentPage> </DataTemplate> </TabbedPage.ItemTemplate>

The xaml shouldn't be an issue cause it renders on android just fine.

How to check the compatibility of macOS application in the lower version?

$
0
0

I am going to develop an application in Xamarin.Forms for macOS. I thought of supporting my application in OS X Mavericks and higher. I have macOS High Sierra in my macbook. Can someone tell me how to make sure that my application will run in lower versions like OS X Mavericks using my macbook itself?

problem when getting an image from the camera

$
0
0

Greetings, I'm trying to make an app on Android, IOS and UWP is about a classification of images and you can get the image in two ways one through the image galleries and one through the camera and I'm using the nuget package from Xam.Plugin. Media (3.1.3) when I try the app on android and use the button to get image by gallery no problem but when using the camera button the app closes and gives me a screen of break mode attached image and I gave it permissions to the androidmanifest of the camera, READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE and READ_INPUT_STATE but I still have the same error that I can do to solve this thanks appreciate the help

ListView or Label

$
0
0

Is it necessary to use ListView in order to assign value to a Label? I want to assign a value to a label which is coming from a Web API.
1. If I use ListView, it takes too much space but displays the value on the Label.
2. If I use only Label, value is not properly displayed on it. (Systems.Collections.Generic.List'1 instead of the data)

var foo = JsonConvert.DeserializeObject<List<MyClass>>(content);
Label_A.Text = foo.ToString();

Debug Xamarin Forms Library

$
0
0

I'm getting an error that I cannot create a sample app to recreate the bug. I know where the exception is occurring in the Xamarin Forms Android platform library. I need to put a breakpoint on one of the lines so I can see what is going wrong and document the bug for the Xamarin Forms team. But, I cannot successfully debug Xamarin Forms. What I tried doing is removing the NuGet packages and then manually adding the Xamarin Forms projects in to my solution (Xamarin.Forms.Core, Xamarin.Forms.) and then referencing these from my shared .NET Standard 2.0 library. Up to this point I can compile, but the issue I face is that the .xaml file don't generate code so I just get lots of compilation errors like

Severity Code Description Project File Line Suppression State
Error CS0115 'AccountsPage.OnAppearing()': no suitable method found to override Wallet C:\GitRepos\coins\src\Portfolio\Wallet\Pages\AccountsPage.xaml.cs 33 N/A
Error CS0115 'App.OnResume()': no suitable method found to override Wallet C:\GitRepos\coins\src\Portfolio\Wallet\App.xaml.cs 76 N/A
Error CS0115 'App.OnSleep()': no suitable method found to override Wallet C:\GitRepos\coins\src\Portfolio\Wallet\App.xaml.cs 71 N/A
Error CS0115 'App.OnStart()': no suitable method found to override Wallet C:\GitRepos\coins\src\Portfolio\Wallet\App.xaml.cs 66 N/A

These errors come up because Visual Studio isn't generating any code.

So, how can I debug Xamarin Forms? How can I get Visual Studio to realize that it needs to run a custom tool on .xaml files to generate the code?

Is there a tutorial anywhere to step through XF code?

OnSleep/OnResume not working on iOS app

$
0
0

It doesn't appear that OnSleep()/OnResume() is working for my iOS app. OnStart() seems to work fine, and all 3 lifecycle methods are working on Android version of the app. I'm on v1.4.1. The code is pretty straightforward, but I'll post it anyways:

    public App()
    {
        var disclaimerPage = new DisclaimerPage();
        disclaimerPage.AcceptedDisclaimer += HandleAcceptedDisclaimer;
        MainPage = disclaimerPage;
    }

    private void HandleAcceptedDisclaimer(object sender, EventArgs e)
    {
        MainPage = new NavigationPage(new MainPage());
    }

    protected override void OnStart()
    {
        Debug.WriteLine("***Starting up the app***");
    }

    protected override void OnSleep()
    {
        // Handle when your app sleeps
        Debug.WriteLine("***Going to OnSleep***");
    }

    protected override void OnResume()
    {
        // Handle when your app resumes
        Debug.WriteLine("***Resuming operation***");
    }

iOS 5s vs iOS6 Which is better for build Xamarin forms project?

$
0
0

I am developing Cross platform application,I have tested my app on android, but now I have to test my project on iOS.So which one should I buy? iPhone 5s or 6s?


Xam.Forms.Maps - Zoom level or Similar

$
0
0

I am developing a system for IOS with maps using the "Xamarin.Forms.Maps".

This system contains massive pins (~ 34k), the problem is that the performance is extremely slow when Zoom out which visualize all. When zooming in and points decrease over the viewing area performance improves.

Question, it is possible as well as on Google Maps to get the points only appear when you are near the well far.

f you do not have it, someone suggests an idea to improve performance?

Can't Load Sqlite file in IOS

$
0
0

I have issue with sqlite in ios it's worked in android but in ios tha application crashed any help?

How to take a picture without open Camera UI?

$
0
0
Hi everybody!
I have followed CustomRenderer a View official sample to show my custom Camera. Then I want to take a picture every second to get Bitmap to perform OCR.
So, How to take a picture programmatically.
If you have a best way to always OCR from Camera Preview stream, please tell me!
Thank you

Xamarin.Forms without option PCL

$
0
0

Hi
Today I installed from internet Visual Studio Community 2017 Version 15.6.4 and framework .net 4.7.02556.
I need create a project with Cross-Plataform -> MobileApp(Xamarin.Forms), in the next window (New Cross Plataform App) I do not see the option PCL in code sharing strategy only have Shared Project and .Net Standard. Someone knows what happened with PCL?

How do I do this simple layout scenario

$
0
0

I am struggling with using the Xamarin layouts. They're not intuitive. I have a situation like this: I have a box and a label. I want the label's width to be capped at the lesser of 75% of the parent view's width or the actual width of the label. I want the box to be the size of the label plus a border (and to be drawn beneath the label). In my head, this is how it would work based on what I'm used to doing with GUI layouts:

var measuredLabelWidth = label.MeasureWidth();
label.Width = Math.min(0.75*parent.Width, measuredLabelWidth);
label.Height = label.MeasureHeight();
box.Width = label.Width + border*2;
box.Height = label.Height + border*2;
label.X = box.X + border;
label.Y = box.Y + border;

My problem is that it seems you can only set a minimum width or the desired width. But no maximum. I tried setting the label's WidthRequest to 75% of the parent view but then it just always sets it to that: even if I have a label with 1 letter, it will be resized to take up that full width. Which then means the box background is way too wide. And I tried to see what the width of the label would be given my width constraint by calling label.Measure with 75% of the parent's width, but it just returned -1 for the sizes. Here's an example of what I want that also showcases my amazing MS Paint abilities:

control for sending feedback .

$
0
0

I want a feedback control which works like this exactly on "tez app".

If the user keep on typing feedback , when he reaches the end of the line the "editor control "should move down. Can any one suggest a solution for this, either it is possible using editor control or some other control. if so please guide me.

Is there some limitation for the number of XAML in one project on iPhone 32 bit?

$
0
0

I have a project which has more than 200 XAML files.
Now this project can't work on iPhone 32bit like 5C and 5. It stalls on wake up.
But if I make another C# PCL project and move some XAML files to that project about 2-30 files? , it works properly.
I didn't read Xamarin.Forms source code yet, is there some limitation on startup? Like registering XAML files on startup encounters small 32 bits stack or something?


How to record video in Xamarin forms for 15 seconds?

$
0
0

How to record video in Xamarin Forms for 15 seconds? The Video recording should stop after 15 seconds. And also I'm not getting any related codes for recording and playing video in Xamarin Forms. Is it possible in Xamarin Forms. Please help me with this. Your help will be greatly appreciated.

Create App with three columns

$
0
0

Hello,

I want to create an app that has a similar layout to Wunderlist. That means I want to have a Hamburger Menu on the left where I can choose a category, then a list of items in the middle and on the right I want the details of the selected item to be displayed.

Wunderlist has this kind of layout (lists, tasks, and the details of a task) and depending on the width they are either shown side by side (dektop) or only one at a time (mobile apps).

I have used a MasterDetail Page for the Hamburger Menu. Should I set the details page to another Master Detail Page or is there any other way?

In my previous UWP app I used the HamburgerMenu and MasterDetailsView from the UWP toolkit. Are there similar controls available for Xamarin Forms?

Support status of Windows Phone 8.1?

$
0
0
Hello,

I am pretty new to Xamarin so please excuse me if any questions seem dumb.

I have a UWP (C#/XAML) app and I want to port it to Xamarin mainly to publish it Android and iOS as well.

I have added a Xamarin.Forms project containing UWP, Android, iOS and a shared Xamarin project to my existing VS 2017 UWP solution. I am now in the process of recreating my existing code in the shared Xamarin.Forms project.

I have only recently learned that I can also target other platforms with Xamarin.Forms, namely Tizen and macOS and also that there is or was support for WP8 with or without Silverlight.

I am confused as to the current support status of Windows Phone 8.1 of Xamarin.Forms. Has support for WP 8.1 ended or only for Silverlight? If so, what is the last version to support any kind of Windows Phone 8 development?

Can you have a Visual Studio solution with current Xamarin apps (shared, UWP, iOS, Android) and legacy (WP 8.1) projects to open in VS 2015 (for WP 8.1 compiling and debugging) and VS 2017 (for development and everything else)?

Thank you very much!

What is the harm to change MainPage outside of App constructor?

App.android has stopped suddenly

$
0
0
I make new project when xamarin forms 2.5 . It runs ik on emulator and real device . Suddunly it give me app.android has stopped . The project only has MainPage.xaml
Viewing all 58056 articles
Browse latest View live


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