透明忙碌指示灯
Transparent busy indicator
我正在使用 wpftoolkit 库中的忙碌指示器。这是我的代码:
<Window x:Class="BusyControl.MainWindow"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<xctk:BusyIndicator Name="ProgressIndicator" IsBusy="False" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
<xctk:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel>
<Image gif:ImageBehavior.AnimatedSource="Resources/loading.gif" Width="150" Height="50" />
<TextBlock Text="{Binding ElementName=ProgressIndicator, Path=BusyContent}" HorizontalAlignment="Center" Margin="3"></TextBlock>
</StackPanel>
</DataTemplate>
</xctk:BusyIndicator.BusyContentTemplate>
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
<Grid>
<Button Content="Click me" Click="ButtonBase_OnClick" Width="100" Height="50"></Button>
</Grid>
</xctk:BusyIndicator>
</Grid>
</Window>
但是我的繁忙指标看起来像
但我需要这样的透明忙碌指示器
我该怎么做?
答案是设置样式或更改模板。 Here 是一个带有答案的问题,显示更改该控件的模板和样式。
当然,细节决定成败...您需要进行一些研究,以具体了解控件的结构是什么,确定您希望如何设计它的样式。如果你没有做过这种事情,我应该管理你的期望,可能需要一点时间来弄清楚你需要做什么。
我正在使用 wpftoolkit 库中的忙碌指示器。这是我的代码:
<Window x:Class="BusyControl.MainWindow"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<xctk:BusyIndicator Name="ProgressIndicator" IsBusy="False" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
<xctk:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel>
<Image gif:ImageBehavior.AnimatedSource="Resources/loading.gif" Width="150" Height="50" />
<TextBlock Text="{Binding ElementName=ProgressIndicator, Path=BusyContent}" HorizontalAlignment="Center" Margin="3"></TextBlock>
</StackPanel>
</DataTemplate>
</xctk:BusyIndicator.BusyContentTemplate>
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
<Grid>
<Button Content="Click me" Click="ButtonBase_OnClick" Width="100" Height="50"></Button>
</Grid>
</xctk:BusyIndicator>
</Grid>
</Window>
但是我的繁忙指标看起来像
但我需要这样的透明忙碌指示器
我该怎么做?
答案是设置样式或更改模板。 Here 是一个带有答案的问题,显示更改该控件的模板和样式。
当然,细节决定成败...您需要进行一些研究,以具体了解控件的结构是什么,确定您希望如何设计它的样式。如果你没有做过这种事情,我应该管理你的期望,可能需要一点时间来弄清楚你需要做什么。