2015-12-20 117 views
0

我想嘗試流暢的色帶控制。這就是爲什麼我已經下載並添加到我的wpf項目。我的xaml代碼是在流利的色帶按鈕上綁定單擊事件

<Fluent:RibbonWindow x:Class="Fluent.Sample.Foundation.Window" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"  
    Title="Fluent.Sample.Foundation" Width="800" Height="600" WindowStartupLocation="CenterScreen" > 


    <Fluent:Ribbon> 
     <!--Backstage--> 
     <Fluent:Ribbon.Menu> 
      <Fluent:Backstage></Fluent:Backstage> 
     </Fluent:Ribbon.Menu> 
     <!--Tabs--> 
     <Fluent:RibbonTabItem Header="Tab"> 
      <Fluent:RibbonGroupBox Header="Group"> 
       <Fluent:Button Name="buttonGreen" Header="Green" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" Click="btnClick" /> 
       <Fluent:Button Name="buttonGray" Header="Grey" Icon="Images\Gray.png" LargeIcon="Images\GrayLarge.png" /> 
      </Fluent:RibbonGroupBox> 
     </Fluent:RibbonTabItem> 
    </Fluent:Ribbon> 

</Fluent:RibbonWindow> 

我已經在流暢的功能區按鈕上添加了點擊事件。

Class MainWindow 
    Private Sub btnClick(sender As Object, e As RoutedEventArgs) 
     MsgBox("test") 
    End Sub 
End Class 

但我得到這個錯誤。

Type 'Fluent.RibbonWindow' is not defined. 
Type 'Fluent.Button' is not defined. 
'btnClick' is not a member of 'TestRibbon.Fluent.Sample.Foundation.Window'. 

當我改變Fluent.RibbonWindowGlobal.Fluent.RibbonWindowFluent.Button同樣的事情,它運作良好,並在一段時間後,再次顯示了同樣的錯誤,我不能瞭解爲何發生此錯誤'btnClick'不是'TestRibbon.Fluent.Sample.Foundation.Window'的成員。

任何人都可以幫我解決這個問題嗎?謝謝。

回答

0

您是否嘗試將以下內容添加到您的資源中?看看https://github.com/fluentribbon/Fluent.Ribbon的演練。

<Ribbon:RibbonWindow.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <!--Attach Default Fluent Control's Theme--> 
      <ResourceDictionary Source="/Fluent;Component/Themes/Generic.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" /> 
      <!--<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/office2013/generic.xaml" />--> 
     </ResourceDictionary.MergedDictionaries>      
    </ResourceDictionary>   
</Ribbon:RibbonWindow.Resources>