답변

0

저는 정적 데이터가 Items 속성에 직접 입력하는 내용이라고 가정합니다. 콤보 상자의 구문은 약간 다르지만 여기있다 : 단지 문자열로 속성의 이름이 위에

<ComboBox ItemsSource="{Binding Path=<your collection>,Mode=OneTime}" SelectedValuePath="<id-field>" DisplayMemberPath="<display-field>" SelectedItem="{Binding Path=<your-property>,Mode=TwoWay}" /> 

매개 변수는 PATH에 종료.

편집 : 당신이 사전을 사용하는 경우 사용합니다 :

<ComboBox ItemsSource="{Binding Path=<your dictionsry>,Mode=OneTime}" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedItem="{Binding Path=<your-int-property>,Mode=TwoWay}" /> 
+0

나는이 공용 사전을 테스트() {사전이사전 = 새 사전 (); dictionary.Add ("Cat", 2); dictionary.Add ("Dog", 1); dictionary.Add ("llama", 0); dictionary.Add ("iguana", -1); 귀환 사전; } wcf 쪽. 그래서 나는 e.result를 가진 클라이언트에서 getdictionary 것이다. 그 후에 내가 어떻게 묶을 수 있니? 죄송합니다, 실버 라이트 학습을 시작했습니다. – user270014

+0

답변을 업데이트했습니다. –

2

u는 요소 트리 예를 들어 필요의 DataContext/뷰 모델/페이지/UserControl을 검색 할 수을 RelativeSource를 사용할 수 있습니다 데이터 그리드는 ComBoxCollectionSource 근처에 정의 itemssource 뷰 모델 :

<ComboBox ItemsSource={Binding RelativeSource={RelativeSource AncestorType=sdk:DataGrid}, Path=DataContext.ComboBoxColloctionSource} /> 
+0

나는이 공개 사전을 가지고있다 test() {사전 사전 = 새 사전 (); dictionary.Add ("Cat", 2); dictionary.Add ("Dog", 1); dictionary.Add ("llama", 0); dictionary.Add ("iguana", -1); 귀환 사전; } wcf 쪽. 그래서 나는 e.result를 가진 클라이언트에서 getdictionary 것이다. 그 후에 내가 어떻게 묶을 수 있니? 죄송합니다, 실버 라이트를 배우기 시작했습니다. – user270014

+0

@Dmitry : 위의 질문에 대답하나요.이 콤보 박스에서 SelectedValue를 어떻게 설정합니까? SelectedValue = "{DataContext.SelectedPriorMonthsCoverage, Mode = TwoWay, RelativeSource = {RelativeSource AncestorType = sdk : DataGrid}'.하지만이 작동하지 않습니다 :-( – Shilpa

+0

내가 SelectedValue 그 컬렉션의 항목에있는 속성으로 즉, UR 컬렉션의 일부가 될 것 같아요. 그리고 의견을 통해 더 많은 토론으로 이어질 것입니다 대신 u ur 질문 n 더 컨텍스트에서 구문 n 데이터 형식에 대한 세부 정보. –

관련 문제