问题
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