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

Slow performance of dynamic controls after updating Xamarin Forms

$
0
0

Hi,

After updating Xamarin.Forms found that the dynamic controls/UI is generated very slowly.
Previously it was working very smoothly without any delay. Now it takes a lot longer for even smaller tasks.

Also sometimes there is a bit of lag which was previously not there.

Can anyone help pinpoint to what might be causing the problem.


Working RoundedBoxView for alll Platforms!!!

$
0
0

Hello,

i was looking for a working RoundedBoxView Renderer and couldnt find one, so i had to do it by my own. In case someone need it here it is, for iOS, Android, Windows UWP and Windows 8.1 (Phone).

// Portable Class
using Xamarin.Forms;

namespace ROIDU
{
    public class RoundedBoxView : BoxView
    {
        public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create<RoundedBoxView, double>(p => p.CornerRadius, 0);

        public double CornerRadius
        {
            get { return (double)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }
    }
}

// iOS
using ROIDU;
using ROIDU.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(RoundedBoxView), typeof(RoundedBoxViewRenderer))]
namespace ROIDU.iOS
{
    public class RoundedBoxViewRenderer : BoxRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            RoundedBoxView rbv = (RoundedBoxView)this.Element;
            if (Element != null)
            {
                Layer.MasksToBounds = true;
                Layer.CornerRadius = (float)rbv.CornerRadius;
            }
        }
    }
}

// Android
using Android.Graphics;
using ROIDU;
using ROIDU.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(RoundedBoxView), typeof(RoundedBoxViewRenderer))]
namespace ROIDU.Droid
{
    public class RoundedBoxViewRenderer : BoxRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            SetWillNotDraw(false);
            Invalidate();
        }

        public override void Draw(Canvas canvas)
        {
            var box = Element as RoundedBoxView;
            var rect = new Rect();
            var paint = new Paint()
            {
                Color = box.Color.ToAndroid(),
                AntiAlias = true,
            };

            GetDrawingRect(rect);
            var radius = (float)(rect.Width() / box.Width * box.CornerRadius);
            canvas.DrawRoundRect(new RectF(rect), radius, radius, paint);
        }
    }
}

// UWP
using ROIDU;
using ROIDU.UWP;
using Xamarin.Forms;
using Xamarin.Forms.Platform.UWP;

[assembly: ExportRenderer(typeof(RoundedBoxView), typeof(RoundedBoxViewRenderer))]
namespace ROIDU.UWP
{
    public class RoundedBoxViewRenderer : BoxViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            RoundedBoxView rbv = (RoundedBoxView)this.Element;
            if (Control != null)
            {
                Control.RadiusX = rbv.CornerRadius;
                Control.RadiusY = rbv.CornerRadius;
            }
        }
    }
}

// Windows 8.1 and Phone 8.1
using ROIDU;
using ROIDU.Windows;
using Xamarin.Forms;
using Xamarin.Forms.Platform.WinRT;

[assembly: ExportRenderer(typeof(RoundedBoxView), typeof(RoundedBoxViewRenderer))]
namespace ROIDU.Windows
{
    public class RoundedBoxViewRenderer : BoxViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
        {
            base.OnElementChanged(e);

            RoundedBoxView rbv = (RoundedBoxView)this.Element;
            if (Control != null)
            {
                Control.RadiusX = rbv.CornerRadius;
                Control.RadiusY = rbv.CornerRadius;
            }
        }
    }
}

skiasharp transform SKPath to the center of the canvas

$
0
0

I have a path drawn in left-top corner of the canvas. I want to it to be in the center.

For that, I do something like this

canvasMidPoint = new SKPoint(_canvasV.CanvasSize.Width / 2, _canvasV.CanvasSize.Height / 2);
MidPoint = new SKPoint(e.Info.Width / 2, e.Info.Height / 2);    // CanvasMidPoint and MidPoint both are equal. So I use MidPoint here.
SKRect computeRect = new SKRect();
initPath.GetTightBounds(out computeRect);
SKMatrix pathMatrix = SKMatrix.MakeIdentity();
SKMatrix.PostConcat(ref pathMatrix, SKMatrix.MakeTranslation(MidPoint.X - (computeRect.Width / 2), MidPoint.Y - (computeRect.Height / 2)));
initPath.Transform(pathMatrix);
canvas.DrawPath(initPath, borderPaint);

but path is drawn below center point. I think this adds translation x and y values in each point of the path.

Please help !
Thank you :smile:

How to get selected items from listview object sender xamarin

$
0
0

Hi

Using ListView Behaviors, How do I get values/object of selected item or selected row?

Below is what i tried and I get a property that says "SelectedItem" but i cant access it. What am I missing?

This what I tried

//portion of my listview below
<ListView.Behaviors>



</ListView.Behaviors>

//constructor
public BurialsViewModel()
{
_onItemSelected = new Command(OnSelectedItem);
}

//ViewModel

ICommand _onItemSelected;
public ICommand OnItemSelected
{
get { return _onItemSelected; }
}
void OnSelectedItem(object sender)
{
//I need values from sender
}

CarouselPage with progress bar

$
0
0

I have a registration page that has too many fields, that requires me to divide it into 4 pages,
I thought that the best experience is to have a CarouselPage with four ContentPages, that can be easily navigate through, and yet having one view with a corresponding view model.
Before asking the main question, I want to make sure that I'm taking the right decision, and I didn't miss any other option that is dedicated for such case that I'm not aware of (I'm still in my first steps in Xamarin).
if the CarouselPage is the way to go, then I want to have some indicator on the bottom of the screen, that shows the registration progress like a progress bar that increases by 25% on every next page, something that ties all the ContentPages together

MovieService throwing an OutOfMemoryException

$
0
0

Hello! I'm trying to run solution for the Netflix Roulette application. The MovieService keeps throwing an OutOfMemoryException every time I try to call the api. Does anyone know why this is happening?

Content View in Xamarin Forms used to work properly previously

$
0
0

Hi,

I have snippet like below:

<ContentView> <RelativeLayout> <Entry /> </RelativeLayout> </ContentView>

The problem is that the entry field gets rendered correctly but I am unable to enter anything in the field neither it responds to the tap.

Any idea what is causing the problem?

According to me this works well till Xamarin.Forms 2.3.4.270 update of nuget package but with the later ones its not working as expected.

Comet Chat

$
0
0

Has anyone successfully integrated Comet Chat into a forms application.

I've been back and forth with their support team for a month. Each time they send new DLLs in their SDK something else break.
Anyone have actual SDKs that works in Android & IOS?


Background Worker in Cross platform

$
0
0

am using xamarin cross paltforms (Android and IOS). i want to show local notification & push notification on specific interval of time, background worker should work in all state of my app ( I mean app is running & not running ).

Thanks

How to make Breakpoints working?

$
0
0

Hi,

i'm developing my first Xamarin.Forms (Crossplatform) app in Visual Studio 2017. I'm programming for android at the moment.
For some reasons no Breakpoints will be hit. I've googled a lot and this are the things i've already tried:

  • Deleting the bin and obj folder
  • Deleting *.user file
  • Clean the Projekt
  • Rebuild the Project
  • Tried it on an emulator as well on my Android phone with USB

nothing worked...can you give me an hint?

If the app crashes, the debugger just says "unhandeled exception" and no more information is given...it's a pain in the b*tt to write code without proper Exceptions and Breakpoints.

Modern appbar and "flicker"

$
0
0

Now I'm working on updating the UI of my app(XF for Android). I this UI solution for appbar(from source code Evolve 2016):

It looks beautiful and is implemented simply:

 <ContentPage.Content>
    <Grid RowSpacing="0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackLayout BackgroundColor={StaticResource Primary}/>
        <SearchBar Grid.Row=1/>

For existing navigation(Master-Detail) it works fine. But I add new toolbaritem "Test", by click I opened new page(no Master Detail):

 await Navigation.PushAsync(new SponsorsPage(), true);

When I click back from this page(SponsorsPage) I get short flicker. This is example:

it does not last long, a split second. then the white line disappears. But it's unpleasant to use.
Any ideas? How can I improve this?

Basic Local Storage - How to?

$
0
0

Hi,

I have seen sqlite but I am asking what if I want a simple local storage just to save one variable user_id to determine the user ID?

What's the best way yo do it so even if the user closes the app or the phone it will still be stored?

Kindly advise...

Thanks,
Jassim

Best FORMS starter project for Azure

$
0
0

I am looking for a robust starter project that uses Azure as a backend. I like the CRM and Sports samples on the site but they have not been touched in 2 years. Both seem to have compile errors.

I have spent some time on the GIT HUB, but many of them don't compile either.

My dev environment is latest VS on Mac or VS 2017 on Windows. I need to build a quick app for a non -profit on iOS and Android. Each user will have their own data and need to be identified in the application uniquely.

Thank you.

cannot open axml view in VS 2017 - error "Create session failed"

$
0
0

Has anyone seen this before? I get this when trying to view the layout in VS 2017. Seems to me that there is some configuration problem 32/64 bit but not sure what it is.

Thanks!

How to detect inactivity of all the platform in common

$
0
0

Hi Everyone,
I built the application for Xamarin forms and I need to handle the inactivity.

If the user and the application don't have the interaction more than 120 seconds, I have to trigger the alert that "Application logged out due to inactivity".

Is it possible to handle? Please suggest your comments in details.


Frame scaling

$
0
0

hello!,

i have an issue with my frame...

im triyng to scale my frame with the content inside of my listview it sorta looks like

<Frame Grid.Row="2" x:Name="framePeople" TranslationY="-100" HeightRequest="850">

    <StackLayout x:Name="StacklayoutPeople">

        <ListView x:Name="ListPoeple">

            <ListView.ItemTemplate>

                <DataTemplate>

                    <ViewCell>

                        <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="AUTO" />
                                                    <ColumnDefinition Width="AUTO" />
                                                    <ColumnDefinition Width="AUTO" />
                                                </Grid.ColumnDefinitions>

                        <Label Text="{Binding Voornaam}"
                                                        FontSize="Medium"
                                                           FontAttributes="Bold"
                                                        Grid.Column="0" />

                                                <Label Text="{Binding Achternaam}"
                                                           Grid.Column="1"
                                                           FontSize="Medium"
                                                           HorizontalOptions="Start" />
                                        </Grid>
                                    </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </StackLayout>
                </Frame>

i don't want to have a heightrequest that just says 850..i wan't to scale it with my current content..

is there an easy way to do this?

Detect Inactivity of the App

$
0
0

Hi,

 Can you people help us regarding, how to detect the inactivity or idle time in xamarin forms cross platform application. We have to do auto logout, after 15 mins on idle time.

Thanks & Regards,
Manigandan V.

apns-collapse-id in Xamarin Forms Ask Question

$
0
0

FCM _CollapseId_Bug(https://github.com/firebase/quickstart-ios/issues/68") Latest comment on the link says apns-collapse-id is now supported. I tried to send the request with apns-collapse-id in the request header using the postman, but still the FCM messages are not collapsing on iOS devices.

Has anyone tried and successfully implemented this.

TIA!

How to display the data in table format.

$
0
0

I want to display the data in table structure like shown in attachment. I want Table Header as constant and the data will scroll.

Thanks..

I created distribuition version but how can i do to distribute?

$
0
0

I followed this example
to generate a distribuition version of my App. Well, generated some files, but how do i distribute these files? What file my client do get to install? In my folder i have:

app-icons folder
mdbs folder
signed-apk folder
archieve.xml
com.inetglobal.autorizador.br.apk(file)

How my client will install in your device?

Viewing all 77050 articles
Browse latest View live


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