Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by Amit on Apr 2nd, 2009 | Filed under .Net, WPF | 5 Comments

Hi

 

Here is a problem that one of my colleagues who is just starting to use WPF got himself into. He was working on an application that displays items using an ItemsControl and uses a DataTemplate. Inside the DataTemplate he used an Image. Here is the Xaml code:

 

   1: <Window.Resources>
   2:         <Image Source="Creek.jpg" x:Key="IMG"></Image>
   3:     </Window.Resources>
   4:     <Grid>
   5:         <ItemsControl ItemsSource="{Binding}">
   6:             <ItemsControl.ItemTemplate>
   7:                 <DataTemplate>
   8:                     <Border BorderThickness="2" BorderBrush="Black" 
   9:                             CornerRadius="3" MinHeight="10">
  10:                         <ContentControl Content="{StaticResource IMG}"/>
  11:                     </Border>
  12:                 </DataTemplate>
  13:             </ItemsControl.ItemTemplate>
  14:         </ItemsControl>
  15:     </Grid>

This is a much simpler example, but the principal is the same.

 

Can you see what was he doing wrong?


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...

SVG (Scalable Vector Graphics) is an open W3C standard for graphics file format and Web development language based on XML. Those image are made up of lines, curves and other “smooth” elements so when you zoom in on a SVG it stays smooth (unlike GIF, JPEG, PNG). 

Imagine you can draw some of your user interface elements in a vector drawing application like: Adobe,   InkScape (free) or Skencil (free) and convert your work into WPF XAML or Silverlight XAML. ViewerSVG  (SVG to xaml converter) is your tool.

image


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