Scroll WPF ListBox to the SelectedItem set in code in a view model

Have you tried using Behavior… Here is a ScrollInViewBehavior. I have used it for ListView and DataGrid….. I thinks it should work for ListBox…… You have to add a reference to System.Windows.Interactivity to use Behavior<T> class Behavior public class ScrollIntoViewForListBox : Behavior<ListBox> { /// <summary> /// When Beahvior is attached /// </summary> protected override void …

Read more

Android MVVM: Activity with multiple Fragments – Where to put shared LiveData?

Late answer but I asked myself the same question and found the answer in Google guide. Especially for fragments, it is mentioned on Google Documentations explicitly here class SharedViewModel : ViewModel() { val selected = MutableLiveData<Item>() fun select(item: Item) { selected.value = item } } class MasterFragment : Fragment() { private lateinit var itemSelector: Selector …

Read more

MVVM radiobuttons

Take a look here. I haven’t implemented the solution provided but it makes sense. The underlying framework control breaks you bindings when a click is performed. The solution is to override the method that does this and just rely on the bindings.