2016-11-24 125 views
1

我正在使用來自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> 

但我的忙指示燈看起來像

before

,但我需要透明的忙指示這樣

After

我怎麼能這樣做?

+0

第一個問題是某些灰色被背景的顏色所掩蓋。第一張照片中沒有任何內容表明它不是透明的。 – BugFinder

+0

在wpftoolkit庫的源代碼中,我看到ContentPresenter的父元素是一個灰色背景的邊框。有什麼方法可以改變這個邊界的背景,除了源代碼更改嗎? – user2455111

+0

好的,我在這篇文章中發現瞭解決方案[there](http://stackoverflow.com/questions/18984371/silvelight-busyindicator-background-color-for-the-message-box)。我可以使用我自己的風格 – user2455111

回答

2

答案將是造型或更改模板。 Here是帶有顯示更改該控件的模板和樣式的答案的問題。

當然,魔鬼是在細節...你需要做一些研究,找出控制結構的具體內容,找出你想如何設計它。如果你還沒有做過這樣的事情,我應該管理你的期望,即可能需要一點時間來確定你需要做什麼。