Usercontrol using wrong Datacontext

前端 未结 4 1137
别跟我提以往
别跟我提以往 2021-01-24 11:23

I have a UserControl that is used in a parent control in this way:


         


        
4条回答
  •  余生分开走
    2021-01-24 11:51

    Once you set the DataContext your bindings will use it, so I would expect this behaviour -- looking for SelectedEntity.Name on the TranslationTextInputViewModel.

    There are a few ways to get this working. Personally, I like to model these relationships in the view-models themselves (view-models with view-model properties), but in this situation I'd probably try this, as unpleasant as it feels:

    
    

提交回复
热议问题