Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

WPF : How to use RelativeSource with WPF binding?

The RelativeSource is a markup extension that is used in for binding purpose in following scenarios : 1)  To bind a property of a given object to another property of the object itself 2)  To bind a property of a object to another one ...

WPF TreeView : Basic Understanding

A TreeView is used to represent data in a hierarchical fashion .It is often used to show  parent child relationship where a parent node can be expanded or collapsed. The TreeView tag is used to create  a WPF TreeView control in XAML....

WPF : Deselect items in TreeView

In this blog we will learn how to clear/deselect selected items in TreeView while working on a WPF application. There following scenarios need to be considered before coming up for a solution to the problem:   1) The TreeView is bound&...

WPF : Binding when DataContext not inherited

Introduction : The DataContext property in WPF is extremely useful because it is inherited by all children. However there are situations where  the DataContext is not accessible as the elements are not part of the visual/logical tree. In ...

WPF Converter : Show autoincrement number in ListBox

Introduction If you want to do data binding between  incompatible types, you need to use a converter. A converter converts the value from source type  to target type and vice versa. A value converter is a class, that implements the s...

Material UI in WPF-Part 2

Hi Friends, In the previous part we’ve seen some Material controls and they look pretty impressive. You don’t have to put extra effort for styling standard controls and need a little effort for out of the box controls like sliders ...

Material UI in WPF-Part 1

Hi Friends, I think most of you have heard of Angular Material UI and those who have seen it, they do like the clean and minimalistic idea and very simple layout which actually looks stunning. But that is for web. Now what if we want it for ou...

Circle checkbox style in WPF

Creating style for circle checkbox:   <Style TargetType="CheckBox" x:Key="CircleCheckbox"> <Setter Property="Cursor" Value="Hand"></Setter> <Setter Property="Content" Value=""></Se...

How to change button background image on click in WPF

In WPF, to change the background image on button click, we can use ToggleButton. In ToggleButton, we can check whether its checked or not. We use DataTrigger to check its property. Here, below is the example of this:   In XAML: &nb...

How to find all children controls in WPF.

I find child control using VisualTreeHelper in WPF. VisualTreeHelper provides all children in form nodes in a visual tree. Visual tree is used for rendering, routing and locating resource. Namespace of VisualTreeHelper is System.Windows.Med...

How to bind nested list in WPF

Here, below is the example of binding nested list in WPF. In below example, I am using nested item controls and WPF Expander to show nested list.  On click of first item, it display sub list of selected item. In these example , I bind ite...

Difference between Static Resource and Dynamic Resource in WPF

   Static Resource Dynamic Resource 1. Static resource can be evaluated only once.    1.  Dynamic resource can be evaluated every time when needed. 2. Static resource i...

How to bind XML Data using XmlDataProvider in WPF?

In WPF, we can easily bind WPF controls with xml data using XmlDataProvider. Using XmlDataProvider, we can bind xml data in XAML file itself without writing any code in code behind.   Here, below is the example of XmlDataProvider. F...

How to update xmlDataProvider when xml document changes at runtime in WPF?

Some time we need a situation where we bind WPF controls with XmlDataProvider and XML is changes dynamically at run time. Then we need to change the data in WPF controls automatically. for eg: we bind list of items with XmlDataProvider and user ...

Bind Combobox with XML Data

Combobox control is like a dropdown control which contains the list of items. By default it takes no value. There is a property itemsSource with which we bind the items. To bind combobox with the XML file,we will right click on the project and...

ItemsControl in WPF

WPF has so many controls to bind the data. They all have different shapes and perform different according to their functionality. There is a simplest control ItemsControl in WPF which is used to bind the list of items. There is no shape and st...

WPF Triggers

Introduction : A WPF trigger changes one or more properties of a control in response to an action when a pre-defined condition is met. For example, we can use a Trigger on IsMouseOver event to change the font of the control. Triggers allow y...

XAML Resources

XAML resources is a object that is a collection of properties. A resource can be reused in different places of WPF application. The example of resources are mainly Styles and Brushes which are used in your WPF application. Resources can be declar...

WPF : Dependency Property

Introduction :   A dependency property is a type of property which extends the CLR property by adding more functionality. The difference between the two is, that while the value of a .NET property is fetched directly from a private m...

WPF : Routed Events

Introduction:   WPF infrastructure provides support for routed events which allows events to tunnel down the visual tree to the leaf element or vice versa bubble up to the root element. Routed events typically appear as a pair and they...

Find all controls in WPF Window by type

Hi Friends! Often we need to loop through the controls (collection of TextBlocks in) to and find them by their types. We can find them in this way:- object control= LayoutRoot.FindName(txtname.Text); if (item is TextBox) { ...

How WPF is better than Winforms?

These are reasons that why WPF is better than Winforms: A->Any where Execution(XAML) : Any where Execution means you can create your UI once in WPF and then run it as window application or run it as web application. This is possible because...

What is Windows Presentation Foundation

Windows Presentation Foundation is a next level GUI framework as compared to WinForms, which provides impressive user interfaces in windows based applications. Earlier it was known as Avalon and was first released as a part of .NET 3.0 framewor...

Why switch to WPF?

WinForms still exists with WPF in Visual Studio. It is still in use but getting outdated as software user interfaces are getting more demanding in terms of speed and slick animations In this article It is mentioned that WPF is not created to repl...

Using Timer in WPF

This is the demonstration of how to use a dispatch timer in WPF using C#. private DispatcherTimer timer; // Declaring instance of DispatcherTimer class public Window1() { InitializeComponent(); Loaded += new RoutedEventHandler(Window...
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: