

Here we're just using object as a placeholder, as we haven't created a model to represent posts yet. ObservableCollection Posts, which is the observable list of loaded posts.Properties: we need to expose a number of values to the UI, which we can do with either observable properties if they're values we intend to completely replace, or with properties that are themselves observable (eg.This will also allow us to potentially change the command type in the future without having to worry about any UI component relying on that specific type being used. Here we're exposing the command through the IAsyncRela圜ommand interface, to avoid strong references to the exact command type we're using. We can use the AsyncRela圜ommand type to wrap a private method that will fetch the posts from Reddit. Commands: we need the view to be able to request the viewmodel to reload the current list of posts from the selected subreddit.Let's start with the viewmodel that will power the subreddit widget and let's go over the tools we need: We'll just assign a sample text to all loaded posts and display that directly, to make things simpler. For the purposes of this sample, we don't need to be able to handle all the possible post types.We want the subreddit widget to also offer a refresh button to reload the current subreddit.We want users to be able to select a subreddit from a list of available options, and we want to save the selected subreddit as a setting and load it up the next time the sample is loaded.The two widget need to be self contained and without strong references to one another. A minimal Reddit browser made up of two "widgets": one showing posts from a subreddit, and the other one showing the currently selected post.Let's start by outlining exactly what we want to build: In this case, we want to build a very simple and minimalistic Reddit browser for a select number of subreddits. Now that we've outline all the different components that are available through the package, we can look at a practical example of them all coming together to build a single, larger example.
