Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Guest Post
Posted by Shahar Y on May 19th, 2009 | Filed under .Net, C# | 1 Comment

Let me share you with one of the weirdest errors I ever encountered. Recently, I have been working on a distributed application which is built from a server and some clients. The clients are Windows Forms applications. Yesterday, I spent a whole day chasing a very weird and strange error - I was getting an exception at the main method (unhandled exception) of the client application. Here is what I got:

image

The error description was:


Continue Reading...
Posted by Justin on Apr 14th, 2009 | Filed under ASP.Net, C#, Web Development | 10 Comments

Tab menus are a fairly common thing that I use in a lot of my applications. I like tabs because they help break up large chunks of, usually, related information.

 

At work we use RadControls for Telerik and they have a pretty nice tab menu control that is easy to use and looks good too. The only problem with these controls is that they only work in WebForms like even the default ASP.NET controls. So when I started playing with MVC I quickly realized I would need to spend some time building some of these controls myself.


Continue Reading...

Hi

 

I wanted to show the usage of these two very useful debugger attributes. If you don’t know them keep on reading, they are very useful.

 

DebuggerDisplay

This attribute allows you to customize the way an object is displayed. lets look at the following example:


Continue Reading...
Posted by Amit on Mar 17th, 2009 | Filed under C# | 1 Comment

p>Hey all.

 

This weekend I typed Dev102 on google just to see what I will get and guess what? We have joind the big league :) We have site links!! This is what you get when you type Dev102 in Google:

Dev102 Site Links

 

Now all we have to do is get the links to point to the interesting stuff.


Continue Reading...
Posted by Justin on Mar 12th, 2009 | Filed under .Net, ASP.Net, C#, Web Development | 2 Comments

Well we’ve arrived at the last part of our series on ASP.NET MVC. In this post we’ll be looking at Views, ViewData, and HTML Helpers. We’ll be discussing how to call Views from Controllers and how to use HTML Helpers to create your markup.

 

Views In A Nutshell

Suppose we receive the following request; http://yourdomain.com/Task/Show/23. The request would map to the following controller.

   1: public class TaskController : Controller 
   2: { 
   3:     public ActionResult Show() 
   4:     { 
   5:         return View(); 
   6:     } 
   7: } 


Continue Reading...
Posted by Amit on Mar 10th, 2009 | Filed under .Net, C#, WPF | Leave a Comment

Hi

 

A while ago Shahar wrote an article about whether WPF Data Binding is Thread safe. Shahar’s findings were that Even if you change a property from a different thread the PropertyChanged event will be called on the UI Thread making Binding Thread Safe.

I have created a Window with 2 TextBlocks, one of them is binded to a Dependency Property and the other is binded to a regular property:

The Window:

   1: <StackPanel>
   2:     <TextBlock Text="{Binding DpTxt}" Width="100" Margin="5"></TextBlock>
   3:     <TextBlock Text="{Binding Txt}" Width="100" Margin="5"></TextBlock>
   4:     <Button Content="Change Text" Margin="5" Click="Button_Click"></Button>
   5: </StackPanel>


Continue Reading...
Posted by Amit on Mar 5th, 2009 | Filed under .Net, C#, WPF | 2 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 Mar 3rd, 2009 | Filed under C# | 1 Comment

Hey all, Check out the top right corner of your screen! Dev102 has hit 1000 RSS readers!!!
Thank you all for reading
The Dev102 team.


Continue Reading...

Hi

 

While working on a complex UI application in WPF I noticed that because I was using DataTemplates both the Xaml and the Code Behind got very messy, that is because if you need to implement some events in the code behind you basically “mix” code from the template and code from the Window, plus you cannot access the elements in the template from the code behind.

Let’s look at the following example:


Continue Reading...

Hi.

 

As the Headline says, I will show you how to make a Drag and Drop / Move Content control. for this example I will use a canvas and an Image. But you can easily make it more generic by using a Content Control instead of the image.

 

It is actually very simple, let’s start with the Xaml Code.

   1: <Canvas Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" HorizontalAlignment="Stretch" 
   2:         VerticalAlignment="Stretch" x:Name="ImageHolder" >
   3:     <Image Canvas.Left="0" MouseWheel="Img_MouseWheel" MouseMove="Img_MouseMove" 
   4:            MouseDown="Img_MouseDown" MouseUp="Img_MouseUp" Panel.ZIndex="0" 
   5:            Cursor="Hand" Canvas.Top="0" Height="150" Width="150" Source="sketch.jpg" 
   6:            x:Name="Img">
   7:     </Image>
   8: </Canvas>

As you can see we are using a canvas and an Image.

 

Implementing Drag and Move

to implement the drag and move we will need to use the following events:

  • MouseDown
  • MouseMove
  • MouseUp
MouseDown event

Continue Reading...
Advertise on Dev102 Bitrix Site Manager

Read reviews and compare prices on : Laptops , Software Like Windows, Office Suites & Many More.

Advertise on Dev102
Write Article for Dev102

Write for us!

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

Learn More