2011-02-17 64 views
0

我有一個silverlight telerik RadComboBox。我正在設計一個主詳細信息頁面。Silverlight組合框綁定到元素

在網格中,我有人員列表 - 網格中的一列是Salutation。 當我點擊網格中的一個項目時,下面的所有文本框根據它們的綁定來填充。

但與組合框,我想知道你是否可以像這樣綁定它。

SelectedItem="{Binding ElementName=PersonGrid, Path=SelectedItem.SalutationLookupValue, Mode=TwoWay}" 

我猜你不能這樣做。我想這樣來做,但即時通訊思想,我需要selectedItem設置SelectedSalutation綁定,並設置時所選擇的項目設定爲電網的..

public Person SelectedPersonResult 
    { 
     get { return _selectedPersonResult; } 
     set 
     { 
      SetObject(ref _selectedPersonResult, value, "SelectedPersonResult"); 
      if (_selectedSalutationResult != null) 
      { 
       SelectedSalutation = SalutationList.Where(x => x.Value == SelectedPersonResult.SalutationLookupValue).FirstOrDefault(); 
      } 
     } 
    } 

重新編號喜歡做它的第一種方式(在XAML內),但我猜想做第二種方法是唯一的方法?

回答

0

如果您的ComboBox行爲與標準行爲類似,那麼第一種方法應該可行,但您不應該綁定到SelectedItem,正確的屬性將是SelectedValue。 (該組合框是否有這樣的屬性?)

+0

這應該工作,因爲我已經做了更多的在線閱讀有關它..但由於某種原因,我錯過了東西..這裏是組合框 gevjen 2011-02-17 22:29:41