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

My code is very slow HELP

$
0
0

This is my code, and I test on S3 Neo , Can you help me, how speed up my app. Very slow If I click on button and open new page, draw button.
My code:

`

                    btn_subcategory.Clicked += (object senderr, EventArgs d) => 
                    {   
                        this.IsPresented= false;
                        stackIbro2.Children.Clear();
                        stackIbro.Children.Clear();
                        Array array = Array.CreateInstance(typeof(Article), Subcategory.Articles.Count);
                        for(int i = 0; i< Subcategory.Articles.Count; i++)
                        {
                            StackLayout articlesH = new StackLayout()
                            {
                                Orientation = StackOrientation.Horizontal
                            };


                            Button btn_article = new Button();
                            Label btn_Quantity = new Label();
                            array.SetValue(Subcategory.Articles[i], i);

                            btn_article.Text = Subcategory.Articles[i].Name;
                            btn_Quantity.Text = Subcategory.Articles[i].Quantity.ToString();

                            btn_article.HorizontalOptions = LayoutOptions.StartAndExpand;
                            btn_Quantity.HorizontalOptions = LayoutOptions.End;
                            articlesH.Children.Add(btn_article);
                            articlesH.Children.Add(btn_Quantity);
                            stackIbro2.Children.Add(articlesH);
                        }
                    };


                }
            };
        }`

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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