Jesse Johnston
{ ironic tagline here }

.NET 101

Monday, 26 October 2009 05:10 by jesse

If you find yourself wanting yourself to share some C# brilliance related to…images

  • The difference between Object.Equals() and ==
  • How string comparison is an interesting special case
  • Why class instance memory is not necessarily reclaimed when an instance goes out of scope
  • Which of Stream.Close() and Stream.Dispose() should be called (or both)

Please remember that it is not 2001.  Everyone knows these things (unless you’re in a .NET 101 class).  If you don’t know these things…may I suggest .NET U?

Seriously, though – how about something interesting like harnessing the power of IObservable<T>?  Bring on the new!

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList
Categories:   .NET
Actions:   E-mail | del.icio.us | Permalink | Comments (1) | Comment RSSRSS comment feed

Doing the Dishes

Friday, 2 October 2009 03:13 by jesse

You DO want to do more than the minimum don't you?While washing all of the coffee cups left in the office sink by others this morning, I was reminded of a lot of code I’ve seen lately.

How often do you open up a piece of code in Visual Studio to find something implemented in a completely ad hoc way, or only half done?  Swaths of code commented out, TODOs sprinkled throughout, all sorts of unrelated concerns mixed in.

These are dishes in the sink.  Someone went home early to get their weekend started and left the work for someone else to do.  This attitude can’t be tolerated in an organization that wants to win.

When hiring, I always look for people who go beyond the minimum.  These are the people who not only deliver great, complete code, but also mentor, blog, and develop their own works.  People who show up early and leave late because they love what they do and have a hard time walking away.  People who wear more than 15 pieces of flair.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList
Categories:  
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Where are the recent items in my Windows 7 jump list?

Thursday, 1 October 2009 11:49 by jesse

I just started adding support for the Windows 7 taskbar jumplist to my WPF application, using the excellent .NET wrappers in the Windows API Code Pack.

After creating the jump list, file selection via the Windows common file dialogs should automatically cause entries to appear in the Recent section of the jump list.

But no.  What's going on?

It turns out that everything is working as expected.  However, you need to have the "recent items" checkbox enabled for the taskbar:

 

 
Once clicked, the Recent items appear on the jump list. 
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList
Categories:   .NET | WPF
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Scrolling TextBox in WPF

Thursday, 1 October 2009 03:03 by jesse

If you put a TextBox inside a ScrollViewer, the TextBox will take as much width as it needs, even if you set TextWrapping to Wrap.  That means that a long line of text will just stretch out to the right, beyond the right edge of the ScrollViewer, instead of wrapping.

Fortunately, you can bind the Width of the TextBox to the ScrollViewer ViewportWidth.  This makes the text wrap at the right edge of the ScrollViewer.  If you hide the horizontal scrollbar, you get just what you'd expect - vertical scrolling and horizontal wrapping.  This also allows the ScrollViewer to participate in a flow style layout and still have the text wrap correctly.

<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">

<TextBox IsReadOnly="True" FontSize="14" TextWrapping="Wrap" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ScrollViewer}}, Path=ViewportWidth}"/>

</ScrollViewer>

 

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList
Categories:   .NET | Silverlight | WPF
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed