我放在Window.Resources我的圖片樣式的第一個按鈕圖像:圖像樣式沒有應用到工具欄
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3" />
</Trigger>
</Style.Triggers>
</Style>
,我有一個工具欄:
<ToolBarTray DockPanel.Dock="Top" Background="Transparent">
<ToolBar Band="0" BandIndex="0" x:Name="ToolbarCATIAAccess" Background="{DynamicResource linearGradBrushHellaTitanMenu}">
<Button Name="ButtonInsertIntoProduct">
<Image x:Name="ImageInsertIntoProduct" Source="/HKBEStandardsFromPDMLibrary;component/Resources/InsertIntoCATIAProduct.png"
ToolTip="insert files into active CATIA Product"/>
</Button>
<Button Name="ButtonCopyFilesToWIN">
<Image x:Name="ImageCopyFilesToWIN" Source="/HKBEStandardsFromPDMLibrary;component/Resources/CopyFilesToWIN.png"
ToolTip="copy files to WIN folder"></Image>
</Button>
</ToolBar>
</ToolBarTray>
此樣式適用於整個窗口以及其他應用程序中的所有圖像。 但它不適用於工具欄中的第一個圖像,並且哪一個先到達並不重要,不透明度不會在第一個設置。 如果我添加一個隱藏的(按鈕)圖像作爲第一個圖像到工具欄,它適用於第一個可見。
...
<Button Name="ButtonCopyFilesToWIN_" Visibility="Collapsed">
<Image x:Name="ImageCopyFilesToWIN_" Source="/HKBEStandardsFromPDMLibrary;component/Resources/CopyFilesToWIN.png"
ToolTip="copy files to WIN folder"></Image>
</Button>
<Button Name="ButtonInsertIntoProduct">
<Image x:Name="ImageInsertIntoProduct" Source="/HKBEStandardsFromPDMLibrary;component/Resources/InsertIntoCATIAProduct.png"
ToolTip="insert files into active CATIA Product"/>
</Button>
...
是否有人在這裏有一個想法可能是什麼問題,能幫幫我嗎? 謝謝
做** **所有的工具欄按鈕有'的IsEnabled = 「假」' ?您是否驗證了這一點(例如[Snoop](http://snoopwpf.codeplex.com/))? –