C# Predicate

Predicate is a pre-built delegate in the .NET framework class library. Delegates are used to store method which has same parameters and return types as specify in the delegate type. Predicate is a generic delegate. It takes one parameter and returns a boolean value. Predicate delegate is used for check whether a parameter meets specify condition or not. ...

Continue Reading

C# Reflection - What is Assembly?

Assembly is the main unit in .NET applications. Assembly is a collection of types and its information. There are two types of assemblies: Executable files (EXE) Libraries (DLL) Both type of assemblies includes information about types and its members in its metadata. There are three ways to get Assembly instances: Geting assembly instance from type...

Continue Reading

C# Reflection - Getting Constructors

C# reflection Type class provides two methods for getting the constructors in any Type. GetConstructors() //Returns all the constructors GetConstructor() //Returns only the specific constructor with match your given criteria. By default, all the above methods returns public constructors of a Type. To get the private, protected, and static constructors you have to u...

Continue Reading

C# Reflection - MemberInfo Class

MemberInfo class provides a quick look of all the members in a Type. Below is the same code to get all members of a Type. static void Main(string[] args) { Type type = typeof(Program); foreach(MemberInfo member in type.GetMembers()) { Console.WriteLine(member.Name + ":" + member.MemberType); } } MemberInfo MemberType property MemberInfo prov...

Continue Reading

C# Reflection - Type class

A Type class is an important class in C# reflection. Type class represents class types, interface types, array types, value types, enum types, type parameters, generic type definitions, and open/closed generic types. Type class helps you to find properties, methods, events, fields, and constructors declared in a type. It also provides us the Assembly in which the type is dec...

Continue Reading

Quick Tips to Filter ListView in WPF

WPF ListView does not support Filtering by default. ListView does not have their own methods to filter the bounded list. But WPF has a very special class CollectionViewSource which supports Filtering very effectively and in very easy way. What is CollectionViewSource class? CollectionViewSource is a class which we can use in WPF for filtering and sorting a bounded ...

Continue Reading

How to Apply WPF ListView ItemContainerStyle

ListView ItemContainerStyle specifies a style that is used by every generated ListViewItem for styling it. You can create a Style inline or in the Resources section and set the ItemContainerStyle property of ListView. You can set ItemContainerStyle as StaticResource or DynamicResource. When to Use? By default you cannot modify style of ListViewItem in WPF ListView....

Continue Reading

How to Hide WPF ListView Columns in MVVM?

ListView control is a very popular control among WPF developers. Developers use ListView control for showing the data in tabular format. Sometimes, we need to hide WPF ListView columns, but wpf does not provide any default implementation for hide WPF ListView columns. I have developed a WPF Behavior to hide WPF ListView columns through Attach property. An attached&...

Continue Reading

Start with MVVM Light Toolkit

MVVM Light toolkit is a lightweight toolkit for MVVM.  This toolkit provides very basic classes for developing your application in MVVM architecture. You can download the latest MVVM Light Toolkit from here. MVVM Light Toolkit comes with 2 main DLLs. GalaSoft.MvvmLight.dll GalaSoft.MvvmLight.Extras.dll Main classes in GalaSoft.MvvmLight.dll are:...

Continue Reading

MVVM Light Messenger

MVVM Light Messenger is a class that allows exchange messages between objects. Messenger class is mainly used for sending messages between viewmodels. Messenger class decreases coupling between viewmodels. Every viewmodel can communicate with another viewmodel without any association between them. Messenger is an implementation of Mediator pattern in MVVM Light tool...

Continue Reading

Join our newsletter and get an occasional email with a technology and DotNetPattern.com news update.