2012-04-10 111 views
0

enter image description hereWPFToolkit:拆分按鈕下拉按鈕禁用按鈕

我使用的是從

xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" 

的問題是我想要禁用,該按鈕「下一個繼承WPF拆分按鈕(右側按鈕'Conf'在下面的下圖中呈現),如果用戶點擊按鈕的左側,應該禁用版權並且按鈕(左側)背景應該變爲黃色。請在xaml下面找到我,我是使用wpf拆分按鈕,在這種情況下下拉內容。請讓我知道,如果你有任何想法

<extToolkit:SplitButton x:Name="ABCbutton" 
         VerticalAlignment="Center" 
         Command="{Binding ACommand}" 
         FontSize="16> 
    <TextBlock HorizontalAlignment="Center" 
       IsEnabled="{Binding IsEnabled, ElementName=AButton}" 
       Text="A"/> 
    <extToolkit:SplitButton.DropDownContent> 
     <StackPanel> 
      <Button Command="{Binding BCommand}" 
        Padding="3" 
        Style="{DynamicResource 
        DropDownButtonMenuButton}"> 
       <TextBlock Margin="0,3,6,3" 
          Text="B"/> 
      </Button> 
      <Button Command="{Binding BCommand}" 
        Padding="3" 
        Style="{DynamicResource 
        DropDownButtonMenuButton}"> 
       <TextBlock Margin="0,3,6,3" 
          HorizontalAlignment="Stretch" 
          Text="C"/> 
      </Button> 
     </StackPanel> 
    </extToolkit:SplitButton.DropDownContent> 
</extToolkit:SplitButton> 

回答

0

在這種情況下,您最好創建自己的控件。如果沒有進行大量修改,分割按鈕無法真正處理您正在談論的內容。

基本上,您的新控件將由兩個按鈕組成,這兩個按鈕的外觀樣式相似,因此它們看起來像是混合在一起。每個將有它自己的背景和啓用屬性。添加一個ViewModel來幫助控制行爲和設置屬性,我認爲你會做生意。請記住,任何工具箱,框架,控制包等中提供的所有控件都是使用圖形和框架元素(線條,矩形,邊框,內容展示器,面板等)的基本類型與專業行爲代碼。

我最終制作了很多自定義控件,因爲沒有一個完美地複製我想要的東西。

+0

嗨, 我也有一個新的要求一樣,當點擊拆分按鈕的右側以往,左側應切換IE瀏覽器的按鈕 以前,它有一個下拉列表內容(如下圖所示箭頭符號),現在它應該有一個單一的 按鈕代替下拉內容的'X'符號。請讓我知道我們如何實現它。 – user1304153 2012-04-15 11:45:29