Saturday, May 16, 2026
HomeiOS DevelopmentXamarin iOS - Textual content Modified occasion not exhibiting outcomes

Xamarin iOS – Textual content Modified occasion not exhibiting outcomes

[ad_1]

Xamarin iOS is testing me these days. I’ve a type which has as Entry worth for looking. This entry management has a textual content modified occasion. All works nice , occasion executes and values handed as anticipated nevertheless the outcomes dont seem on display.

If i rotate the gadget, on this case and ipad, the outcomes present. The whole lot in Android works as anticipated. Irritating

 CancellationTokenSource _cts;

    non-public void Search_TextChanged(object sender, TextChangedEventArgs e)
    {
        strive
        {
            _cts?.Cancel();     // cancel earlier search
        }
        catch { }  // in case earlier search accomplished

        ShowResults((Entry)sender);
    }

 non-public async void ShowResults(Entry entry)
    {
        utilizing (_cts = new CancellationTokenSource())
        {
            strive
            {
                await Job.Delay(TimeSpan.FromSeconds(1), _cts.Token);  // buffer

                utilizing (UserDialogs.Occasion.Loading("Loading. . ."))
                {
                    ObservableCollection<TMDB_Movie> itemSourceCollection = new ObservableCollection<TMDB_Movie>();
                    MovieSearchVM context = (MovieSearchVM)BindingContext;

                    strive
                    {
                        if (!IsPublicCollection)
                        {
                            var outcomes = PrivateCollection.The place(x => x.Title.Accommodates(entry.Textual content));
                            foreach (TMDB_Movie film in outcomes)
                            {
                                film.PublicCollection = true;
                                film.Kind = "Digital";
                                itemSourceCollection.Add(film);
                            }
                        }
                        else
                        {
                            if (PhysicalDevice.HasInternetConnection())
                            {
                                TMDB_Request request = new TMDB_Request();
                                TMDB_Movies motion pictures = await request.ByMovieName(entry.Textual content, CustomSettings.GetSettings().Language);

                                int i = 0;
                                foreach (var film in motion pictures.Outcomes)
                                {
                                    if (i < 10)
                                    {
                                        FanartTv television = new FanartTv();
                                        film.Movieposter = await television.GetSingleMoviePoster(film.Id);

                                        if (film.Release_date != null)
                                        {
                                            char[] Separator = new char[] { '-' };
                                            string[] yr = film.Release_date.Break up(Separator, StringSplitOptions.None);
                                            film.Release_year = yr[0];
                                        }
                                        film.PublicCollection = true;

                                        itemSourceCollection.Add(film);
                                        i++;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }

                        context.MovieCollection = itemSourceCollection;
                    }
                    catch { }
                }
            }
            catch { }
        }
    }

View Mannequin

non-public ObservableCollection<TMDB_Movie> _MovieCollection = new ObservableCollection<TMDB_Movie>();
    public ObservableCollection<TMDB_Movie> MovieCollection
    {
        get { return _MovieCollection; }
        set
        {
            _MovieCollection = worth;
            RaisePropertyChanged("MovieCollection");
        }
    }

XAML

                <Grid Model="{StaticResource StyleBaseGrid}" Grid.Row="2" HorizontalOptions="FillAndExpand" >

                    <SfListView:SfListView x:Title="GridMovieCollection"
                                           ItemsSource="{Binding MovieCollection}" 
                                           ItemTemplate="{StaticResource StandardPosterTemplate}"
                                           Margin="-5,0,0,0"
                                           ItemSize="125"
                                           ItemSpacing="0,0,0,0"
                                           AutoFitMode="None"
                                           SelectionBackgroundColor="Clear"
                                           ItemHolding="GridMovieCollection_ItemHolding"
                                           ItemTapped="GridMovieCollection_ItemTapped"   >

                        </SfListView:SfListView>

                </Grid>

I’ve no clue why rotation solves this however i assume it updates the controls width and peak properties and refreshes the display.

Any concepts how i can power refresh the display or if there’s something fallacious with my code?

Android look
enter image description here

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments