WPF – Styles – Change Image Source

I don’t post in this section often because I don’t know the most common problems unless I receive an email from someone about a problem. You can understand the need with the number of results after searching about a specific problem. Many programmers have this issue, they find difficulties when they try to change the source of the image using datatriggers. This is because they try to put only the change in the trigger. In order for this to work you should also include the source property in the style as a setter for the default image source instead of initializing it in your image. If you initialize the source in the image tag like this <Image Source=”/Resources/OK.png” /> it will not work.

C# – Extension Methods – IsPalindrome

Extension Methods allow you to extend existing types by adding methods to them. The extension methods are special static methods and they are called the same way as type’s instance methods. In this example we will implement an extension method called IsPalindrome which extends strings and you can check them if they are palindrome. After that you can use the IsPalindrome() method just like any string method, for example Trim().