Posts

Showing posts with the label WPF

Practical Example To Visualize Entities In Live Application Using MSAGL

Image
Finding it difficult to understand the complex relationship between the different objects which are part of an application? Think of Visualizing the objects and their state when the application is running, Seems exciting right?  Yes, It's possible with the little help from MSAGL(Microsoft Automatic Graph Layout) and some boilerplate code to do that. I have created a sample application demonstrating how it can be done, including the state of these objects in a live manner. I would recommend you to go through MSAGL Basics Check out the video here: 🎁 Want to try this yourself?   📦 Download the  Entity Visualizer Toolkit (MSAGL Source + Guide) → [Buy on Gumroad] Check out the code here: using Microsoft.Msagl.Drawing; using System; using System.Collections.Generic; using System.Linq; using System.Threading; namespace MSAGL_Demo { public interface INodeRepository { void AddNode(Node node); void OnActiveNodeChanged(string obj); } public class NodeRepository ...

How to Create Animation in WPF?

Image
  In some instances we need some animation to be shown in the User interface to improve the User Experience for example showing the progress bar indicating the live progress of some activity which is ongoing in the background. What is Animation? Animation is the process of changing the properties of an image/text such that it appears as moving in Realtime.  Animation helps to improve the overall user experience. In modern application we can see some kind of animation for every event which is happening in the application. Implementing Animation in WPF In this post lets understand how animation works in WPF with the help of Storyboard. Here we are going to discuss about basic animation like performing rotation of some shapes. Below code demonstrates the animation for the Spinner Control which is used to indicate that some background task is in progress. XAML Code In the above code we have taken an ellipse and made it into a circle with equal width and height. Since we are going ...

How to Load Data Asynchronously in WPF UI using MVVM Data Binding?

Image
  Most of the content which is displayed by the WPF Application is fetched from either the database or some Web service.  Why do we need to load Data Asynchronously? We might have seen that when we wait for the content to be available it tends to freeze our WPF Application/ Main Thread. Therefore to avoid that we need to fetch large content/Data in an asynchronous fashion from the Database or Remote Server. But the challenge there is how do we update the UI asynchronously. It is also desirable to show the loading progress to the user using some spinner control so that user gets the feeling that content is loading.  We know that if we query the Web service or the Windows Service for any result it returns a Task which encapsulates the result if we are using Asynchronous version of the API. We will not be able to do direct data binding with the task which is being returned as WPF does not supports it.  Evaluating Different ways to load data in an Async Fashion One way i...