Key modifiers

by Brian Keating Tue, December 22 2009 22:32

Recently I used PInvoke to check if the SHIFT key was pressed while i was doing a drag operation......

what I should have done then and have done now is

 

if((Keyboard.Modifiers & ModifierKeys.Shift) != ModifierKeys.None)
  Trace.WriteLine("Shift is pressed");

Tags:

C# | windowsforms | WPF

A Custom Diagramming Library

by Brian Keating Sat, December 05 2009 21:40

Recently I've been working with a 3rd party diagramming library written in windows forms. It's been great and it's pretyt fast in building 80% of the applciation I'm working on.

However

I did say 80% yeah.. so, what of the other 20%, well one of the problems is that it doesn't support embedded diagrams and drill down. I can live with this for now, but in future they will become very important.
So, what to do?

Choices

  • Buy the source code for existing library
  • Write my own

Purchase

Cons..

The problem with this is an unfamiliar code base and it's probably already not the ideal architecture.
I've already replaced the node drawing with my ow GDI+ code with some custom code.
The pros..

Pros..

It got a team of dedicated developers...

 

Write

Cons..

Ain't got the foggiest how :-)

Pros..

If you're someone like me, for whom coding is more a hobby than a Job.. you'll understand..
If you're not someone like me..then.. read the blog from someone that can actuall spell Wink

Baby steps 

Lets start with something very easy..

Designer surface..

 Live demo will be here HERE

Stay tuned... "Diagramming"

Tags:

Diagramming | WPF

WPF Data Triggers

by Brian Keating Fri, December 04 2009 11:01

Today I needed to control the enabled property of a button "Remove Item" on my form depending on wheather there was a selected item in a Listbox.

Here's how 


<Button Content="Remove" Click="OnRemoveTranstion">
<Button.Style>
<Style>
    <Style.Triggers>
        <DataTrigger Binding ="{Binding ElementName=listDetails, Path=SelectedIndex}" Value="-1">
            <Setter Property="Button.IsEnabled" Value="false"/>
        </DataTrigger>
    </Style.Triggers>
</Style>
</Button.Style>
</Button>
 

Tags:

WPF

Converting your VS2008 projects to support xaml designer in Expression blend 3

by Brian Keating Thu, December 03 2009 22:58

If you've created a new WPF project in VS2008 and then you try to design your UX in Expressino Blend 3 you'll find that you get xaml view only.

What is required is to add

<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

 to the project file.

 

Tags: ,

Blend | WCF

.NET DateTime Webservices UTC

by Brian Keating Wed, December 02 2009 23:18

With .NET 1.1 when we receive a UTC DateTime in a SOAP response from a webservice it used to get converted to Local time.

With .NET 2.0 when we receive a UTC DateTime in a SOAP response it stayes in UTC.

If you need it in local time make sure to call .ToLocalTime()

 

** Edit: P.s. Have a look at this neat class in the framework XmlConvert

Tags: , ,

C# | WCF