wpf busyindicator not showing up

大城市里の小女人 提交于 2019-12-01 19:29:09

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/6528438/wpf-busyindicator-not-showing-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!