4

我的窗口上有一个这样的 wpf 繁忙指示器:

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

并在按钮中单击我试图将指示器的可见性、isBusy 属性设置为 true 和可见。

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

但指标没有出现。

知道为什么吗?

4

2 回答 2

6

我总是用 BusyIndi​​cator 包装其他 wpf 内容,然后它会以该内容为中心显示。

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

尝试将您的布局控件包装在 BusyIndi​​cator 中,看看它是否符合您的要求。

于 2011-06-29T23:37:22.367 回答
2

BusyIndi​​cator 在哪里定义?例如,如果您的 XAML 如下所示:

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

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

你永远不会看到,BusyIndicator因为它在 ListBox 后面。我建议BusyIndicator按照 Chris 的建议使用 ,否则,请确保它不会无意中落后于其他视觉效果。

于 2011-06-30T00:18:16.630 回答