Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by Amit on Mar 5th, 2009 | Filed under .Net, C#, WPF | 3 Comments

Hi

 

Where do you locate your convertors? do you put them in the Window.Resources section? or in the UserControl they are being used for? Neither of these options is good. You should put it in the App.Xaml file and here is why:

Lets look at the following example:

Here is our Window:

   1: <Window x:Class="ConvertorLocation.Window1"
   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   4:         xmlns:my="clr-namespace:ConvertorLocation"
   5:     Title="Window1" Height="300" Width="300">
   6:     <Grid>
   7:         <ItemsControl ItemsSource="{Binding}">
   8:             <ItemsControl.ItemTemplate>
   9:                 <DataTemplate>
  10:                     <my:UserControl1></my:UserControl1>
  11:                 </DataTemplate>
  12:             </ItemsControl.ItemTemplate>
  13:         </ItemsControl>
  14:     </Grid>    
  15: </Window>

Continue Reading...
Posted by Amit on Sep 25th, 2008 | Filed under .Net, WPF | 6 Comments

Hi

In my previous post about WPF Binding Converters one of our readers (Thanks The Reddest) pointed our that a new converter instance is not created every time a call is made to the converter. I promised to test it again so here goes :)
I used the old converter code but added a static integer inside the converter to count the number of calls made to it. and then printed it out to the trace in the constructor.


Continue Reading...
Posted by Amit on Jul 17th, 2008 | Filed under WPF | 11 Comments

Hi all

As you all remember in my article about Custom WPF Context Menu I mentioned that my WPF Binding Converter was a singleton, and I promised to tell you why, so here comes the 3 ways I know of using WPF Binding Converters. We will start from the worst (in my opinion) and move on the the best.

To start off here is the Binding Converter:


Continue Reading...
Posted by Amit on Jun 20th, 2008 | Filed under .Net, WPF | 4 Comments

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...
Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More