2012-02-02 43 views
2

我正在使用WPF功能區,我剛剛遇到了一些奇怪的行爲。我有一個上下文選項卡,可以從「主頁」選項卡複製一些功能,以便我的用戶不必前後點擊。重新使用功能區上的圖像在XP上導致崩潰

我看到的問題是,如果我重新使用圖像,我的應用程序在啓動時崩潰,如果在Windows XP上運行。 Windows 7沒有問題。有什麼想法?

代碼:

<r:RibbonTab Header="Home"> 
      <r:RibbonGroup Header="Clipboard"> 
       <r:RibbonButton Label="Paste" LargeImageSource="Resources\Images\Paste.ico" Command="{Binding PasteCommand}"/> 
       <r:RibbonButton Label="Cut" SmallImageSource="Resources\Images\Cut.ico" Command="{Binding CutCommand}"/> 
       <r:RibbonButton Label="Copy" SmallImageSource="Resources\Images\Copy.ico" Command="{Binding CopyCommand}"/> 
      </r:RibbonGroup> 

.... Other Code... 

<r:RibbonTab Header="Options" ContextualTabGroupHeader="Options"> 
       <r:RibbonTab.Style> 
        <Style TargetType="r:RibbonTab"> 
         <Style.Triggers> 
          <Trigger Property="Visibility" Value="Visible"> 
           <Setter Property="IsSelected" Value="True" /> 
          </Trigger> 
         </Style.Triggers>       
        </Style>     
       </r:RibbonTab.Style> 

.... If I uncomment this next part it crashes on XP.... 
       <!--<r:RibbonGroup Header="Clipboard"> 
        <r:RibbonButton Label="Paste" LargeImageSource="Resources\Images\Paste.ico" Command="{Binding PasteCommand}"/> 
        <r:RibbonButton Label="Cut" SmallImageSource="Resources\Images\Cut.ico" Command="{Binding CutCommand}"/> 
        <r:RibbonButton Label="Copy" SmallImageSource="Resources\Images\Copy.ico" Command="{Binding CopyCommand}"/> 
       </r:RibbonGroup>--> 

如果我拿出它工作正常的LargeImageSource/SmallImageSource一部分。

回答

0

不知道這是否會幫助你。

它發生了一些與我的應用程序崩潰在WinXP類似的東西。事實證明,我用於我的Windows的圖標。似乎XP系統無法正確處理全綵色,透明,大圖標。更改爲小型非透明圖像,並開始工作。

+0

我可以試試。奇怪的是,雖然它工作正常,除非我使用相同的圖像兩次。它就像嘗試訪問圖片或其他東西時會發生衝突。不知道爲什麼。 – KrisTrip 2012-02-02 18:47:42

+0

我更改了我用於PNG的ico,它現在可以正常工作 – KrisTrip 2012-02-08 14:35:08

+0

重要提示:o) – NestorArturo 2012-02-08 16:26:16