Aug
26th | 2008

Creating a 3D Border Style in WPF

Posted by Amit |
Filed under .Net, WPF |

Many times I want to make my WPF Controls have a 3D effect. For examples Headers of lists and such. Saddly there is no built in way to do it so we have to come up with a custom solution. I don’t want to use Bitmap effects due to performance reasons, I must say I don’t have much experience with them but from what I have I am not a big fan.

Here is my solution for a 3D effect on WPF Controls.

First of all a Quick demonstration. Which one looks better.

WPF 3D Border Style

I don’t know about you but the second one is much nicer with that 3D effect.

How is it done? As I said before I don’t like using Bitmap effects if I don’t have to, so this is done with combining 2 borders together. The simple upper  one is a regular border with TextBlock


Continue Reading...
Jun
20th | 2008

How To Create a WPF Custom Context Menu

Posted by Amit |
Filed under .Net, WPF |

How would you like your WPF application to have a Context Menu like this:

Context Menu Example

Well, It is not so hard. Here is how you do it:


Continue Reading...
May
14th | 2008

How To Add a MouseDoubleClick Event To Any WPF Control

Posted by Amit |
Filed under .Net, WPF |

Last week I was faced with a problem. I needed to implement a MouseDoubleClick Event on a WPF Grid. I said Ha, easy but as i went on to implement it i realized that the Grid has no MouseDoubleClick Event! So how am I supposed to implement it? I came up with 2 solutions and so here goes:

  1. the first thought i had was to create a User Control that held only a grid and implement the MouseDoubleClick on the User Control itself so what you will get is this Xaml code:
  2. <UserControl x:Class=”CustomDoubleClick.GridWrapper”
        xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
        xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
        Height=”300″ Width=”300″>
        <Grid>
    
        </Grid>
    </UserControl>
    Since the Grid takes the…


    Continue Reading...
Apr
21st | 2008

A Bug in WPF Static Resources?

Posted by Amit |
Filed under C#, WPF |

Yesterday I played around with WPF resources and stumbled on a very strange behavior. It seems that the order of the elements in the resources have some importance as to how the application handles them. A few code examples are attached


Continue Reading...

Search Dev102