Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:29:14+00:00 2026-05-23T04:29:14+00:00

Is there an event I can listen for when a listbox has completed loading

  • 0

Is there an event I can listen for when a listbox has completed loading it’s data? I have a textbox and a listbox, when the user hits enter, the listbox is populated with results from a web service. I’d like to run the progress bar while the listbox is loading and collapse it when it’s finished….

UPDATE

    <controls:PivotItem Header="food" Padding="0 110 0 0">

            <Grid x:Name="ContentFood" Grid.Row="2" >

                <StackPanel>
                    ...
                    ...

                    <toolkit:PerformanceProgressBar Name="ppbFoods" HorizontalAlignment="Left" 
                        VerticalAlignment="Center"
                        Width="466" IsIndeterminate="{Binding IsDataLoading}" 
                        Visibility="{Binding IsDataLoading, Converter={StaticResource BoolToVisibilityConverter}}"
                        />


                    <!--Food Results-->
                    <ListBox x:Name="lbFoods" ItemsSource="{Binding Foods}" Padding="5" 
                             SelectionChanged="lbFoods_SelectionChanged" Height="480" >
                        ....
                    </ListBox>

                </StackPanel>
            </Grid>


        </controls:PivotItem>

Here is my helper converter class….

    public class BoolToValueConverter<T> : IValueConverter
{
    public T FalseValue { get; set; }
    public T TrueValue { get; set; }

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value == null)
            return FalseValue;
        else
            return (bool)value ? TrueValue : FalseValue;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return value != null ? value.Equals(TrueValue) : false;
    }
}

public class BoolToStringConverter : BoolToValueConverter<String> { }
public class BoolToBrushConverter : BoolToValueConverter<Brush> { }
public class BoolToVisibilityConverter : BoolToValueConverter<Visibility> { }
public class BoolToObjectConverter : BoolToValueConverter<Object> { }

In my App.xaml….

    xmlns:HelperClasses="clr-namespace:MyVirtualHealthCheck.HelperClasses"
    ...
    <HelperClasses:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" TrueValue="Visible" FalseValue="Collapsed" />

The viewModel….

    ...
    public bool IsDataLoading
    {
        get;
        set;
    }
    ...
    public void GetFoods(string strSearch)
    {
        IsDataLoading = true;
        WCFService.dcFoodInfoCollection localFoods = IsolatedStorageCacheManager<WCFService.dcFoodInfoCollection>.Retrieve("CurrentFoods");

            if (localFoods != null)
            {
                Foods = localFoods;
            }
            else
            {
                GetFoodsFromWCF(strSearch);
            }
    }


    public void GetFoodsFromWCF(string strSearch)
    {
        IsDataLoading = true;
        wcfProxy.GetFoodInfosAsync(strSearch);
        wcfProxy.GetFoodInfosCompleted += new EventHandler<WCFService.GetFoodInfosCompletedEventArgs>(wcfProxy_GetFoodInfosCompleted);
    }

    void wcfProxy_GetFoodInfosCompleted(object sender, WCFService.GetFoodInfosCompletedEventArgs e)
    {
        WCFService.dcFoodInfoCollection foods = e.Result;
        if (foods != null)
        {
            //set current foods to the results from the web service
            this.Foods = foods;
            this.IsDataLoaded = true;

            //save foods to phone so we can use cached results instead of round tripping to the web service again
            SaveFoods(foods);
        }
        else
        {
            Debug.WriteLine("Web service says: " + e.Result);
        }
        IsDataLoading = false;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:29:15+00:00Added an answer on May 23, 2026 at 4:29 am

    There’s no built in functionality for this. You’ll have to update the progressbar when you’ve finished loading the data.
    Alternatively update a boolean dependency property in your view model and bind the progress bar to that.

    Update
    Some rough, example code, based on comments. This is written here and not checked but you should get the idea:

    The VM:

    public class MyViewModel : INotifyPropertyChanged
    {
        private bool isLoading;
        public bool IsLoading
        {
            get { return isLoading; }
    
            set
            {
                isLoading = value;
                NotifyPropertyChanged("IsLoading");
            }
        }
    
        public void SimulateLoading()
        {
            var bw = new BackgroundWorker();
    
            bw.RunWorkerCompleted += (s, e) => 
                Deployment.Current.Dispatcher.BeginInvoke(
                    () => { IsLoading = false; });
    
            bw.DoWork += (s, e) =>
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => { IsLoading = true; });
                Thread.Sleep(5000);
            };
    
            bw.RunWorkerAsync();
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
    

    XAML:

    <toolkit:PerformanceProgressBar IsEnabled="{Binding IsLoading}" 
                                    IsIndeterminate="{Binding IsLoading}"/>
    

    Set the DataContext of the page to an instance of the view model and then call SimulateLoading() on the view model instance.

    Update yet again:
    My mistake IsIndeterminate is a bool so a converter isn’t required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any intent/event that i can listen to when user slide out the
Is there an event or notifier that I can have my app listen for
Is there a way how modules can listen to parent application event? My current
Is there an event I can use to tell if a child form has
Is there a client event that I can use for when a DropDownList's data
Is there a WMI event you can subscribe to that will fire when a
Is there an event that I can tap into in Global.asax to execute some
Is there any event like OnValidate in LINQ where I can add my business
I'm looking for a DOM event that I can listen to with JavaScript for
Using the asp.net AjaxControlToolkit ModalPopupExtender is there a way listen to an event when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.