2013-12-23 38 views
0

嗨,我有這樣的組合框:錯誤使用卡利微組合框結合

<ComboBox x:Name="Orders" Width="150" Grid.Row="0" 
      HorizontalAlignment="Left" 
      SelectedItem="{Binding Order}" Margin="3" /> 

,這是在視圖模型代碼:

class MyFerViewModel : Screen, IMyFerViewModel 
    { 

     private string[] orders = { "ABC", "CDC", "EFR", "ACER" }; 

     private string order = "ABC";  

     public string[] Orders { get { return orders; } } 

     public string Order 
     { 
      get { return order; } 
      set 
      { 
       if (value != order) 
       { 
        order = value; 
        Reorder(); 
       } 
      } 
     } 

[..] 

爲什麼當我無法看到視圖和appere引導程序中的這個錯誤?

「找不到合同ABC的任何實例。」

回答

1

需要綁定的ItemsSource到ComboBox和進一步SelectedItem

<ComboBox x:Name="Orders" 
      Width="150" Grid.Row="0" 
      HorizontalAlignment="Left" 
      ItemsSource="{Binding Orders}" 
      SelectedItem="{Binding Order}"   
      Margin="3" /> 

希望它可以幫助..