What is the best way to hide the screen while knockout js bindings are being built?

I was just googleing for this, and after using the observable way, I thought of another approach: <div style=”display: none” data-bind=”visible: true”> <ul data-bind=”foreach: items”> <li data-bind=”text: name”></li> </ul> </div> You don’t need an observable, the visible will always evaluate to true once the data binding is done.

How to pass the UI Dispatcher to the ViewModel

I have abstracted the Dispatcher using an interface IContext: public interface IContext { bool IsSynchronized { get; } void Invoke(Action action); void BeginInvoke(Action action); } This has the advantage that you can unit-test your ViewModels more easily. I inject the interface into my ViewModels using the MEF (Managed Extensibility Framework). Another possibility would be a … Read more

MVVM Routed and Relay Command

RoutedCommand is part of WPF, while RelayCommand was created by a WPF Disciple, Josh Smith ;). Seriously, though, RS Conley described some of the differences. The key difference is that RoutedCommand is an ICommand implementation that uses a RoutedEvent to route through the tree until a CommandBinding for the command is found, while RelayCommand does … Read more

WPF MVVM: How to close a window

I just completed a blog post on this very topic. In a nutshell, add an Action property to your ViewModel with get and set accessors. Then define the Action from your View constructor. Finally, invoke your action in the bound command that should close the window. In the ViewModel: public Action CloseAction { get; set;} … Read more

How to use data-binding in Dialog?

It is possible to use databinding in a Dialog, first to get the binding working on your Dialog you should inflate it first and pass it to the setContentView like this. DialogOlaBookingConfirmedBinding binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout. dialog_ola_booking_confirmed, null, false); setContentView(binding.getRoot()); Then you can pass the viewModel: binding.setViewModel(new ViewModel(this, event.olaBooking)); And now you can see it … Read more

WPF loading spinner

A very simple “plug and play” spinner could be one of the spinning icons from the Font Awesome Wpf Package (Spinning icons). The usage is quite simple, just install the nuget package: PM> Install-Package FontAwesome.WPF Then add the reference to the namespace xmlns:fa=”http://schemas.fontawesome.io/icons/” and use the ImageAwesome control. Set the Spin=”True” property and select one … Read more

Why use MVVM? [closed]

Summary The usage of all patterns is situational, and the benefit (if there is any) always lies in reduced complexity. MVVM guides us how to distribute responsibilities between classes in a GUI application. ViewModel projects the data from the Model into a format that fits the View. For trivial projects MVVM is unnecessary. Using only … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)