Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wpf busyindicator not showing up

I have a wpf busy indicator like this on my window:

<Grid><Controls1:BusyIndicator  x:Name="busyIndicator2" IsBusy="False" Content="Please wait....." Visibility="Hidden"/>
</Grid>

And in the button click I m trying to set the visiblity,isBusy property of indicator to true and visible.

void button_click(object sender, RoutedEventArgs e)
{
   busyIndicator2.Visibility = System.Windows.Visibility.Visible;
   busyIndicator2.IsBusy = true;
}

but the indicaotr is not showing up.

Any idea why?

like image 679
alice7 Avatar asked Feb 24 '23 17:02

alice7


2 Answers

I've always wrapped other wpf content with the BusyIndicator, it then shows up centered over that content.

<BusyIndicator...>
  <Grid>....</Grid>
</BusyIndicator>

Try wrapping your layout control in the BusyIndicator and see if that does what you are after.

like image 124
Chris Sainty Avatar answered Feb 26 '23 06:02

Chris Sainty


Where is the BusyIndicator defined? For example, if your XAML looks like:

<Grid>
  <BusyIndicator ...>
  </BusyIndicator>

  <ListBox ...>
  </ListBox>
</Grid>

You'll never see the BusyIndicator because it's behind the ListBox. I would recommend using the BusyIndicator as suggested by Chris, otherwise, make sure it's not inadvertently behind other visuals.

like image 29
sellmeadog Avatar answered Feb 26 '23 07:02

sellmeadog