Bind data inside ListBox using code-behind in ReactiveUI

后端 未结 1 1992
我寻月下人不归
我寻月下人不归 2021-01-13 04:39

I have WPF listbox:


  
    
      

        
1条回答
  •  天涯浪人
    2021-01-13 05:26

    Is there any way to bind Url textbox inside the listbox using code-behind?

    Not at the moment. You can either use XAML bindings like you're doing now, or you can put your data templates inside UserControls.

    A consolation to this somewhat more cumbersome approach, is that if you register your data template UserControls and implement IViewFor on them:

    Splat.Locator.CurrentMutable.Register(typeof(MyView), typeof(IViewFor));
    

    Then, you can write the ListBox simply as:

    
    

    This line will automatically wire up a DataTemplate for you:

    this.OneWayBind(ViewModel, vm => vm.DownloadManager.FileDownloads, v => v.FileDownloads.ItemsSource);
    

    0 讨论(0)
提交回复
热议问题