wpf busyindicator not showing up

2019-02-24 00:24发布

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?

2条回答
劫难
2楼-- · 2019-02-24 01:12

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.

查看更多
3楼-- · 2019-02-24 01:16

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.

查看更多
登录 后发表回答