Archive

Archive for the ‘.NET’ Category

Joining the ComponentOne Speaker Bureau

April 21, 2011 Comments off

I am pleased to announce that I have joined the ComponentOne Speaker Bureau.  The other current members of the bureau include Dane Morgridge, John Baird, and Michael Eaton.

The bureau is one way that ComponentOne gives back to the community by helping to sponsor a few speakers in our community efforts.  This makes it possible for us to travel a bit more and reach more people.

My thanks to ComponentOne for supporting the community and for putting their faith in me personally.  When you see them out and about, be sure to thank them yourself!

Categories: .NET

Philly Code Camp 2011.1

April 11, 2011 Comments off

As I come to work this morning I recognize all the signs that Spring is officially upon us: I did not wear a jacket to work this morning, The Masters is over, and this weekend was the first installment of Philly Code Camp 2011.  While I sacrificed being able to watch The Masters live to attend Code Camp this weekend, I was able to see it all thanks to the magic of DVR.

As always, Philly Code Camp was fantastic: the Philly team is constantly setting the bar higher and higher and this time was no exception.  I can only imagine the logistical nightmare of organizing and executing a code camp with almost 600 attendees, but these guys pull it off with flying colors!

Have you never been to a code camp? Are you wondering what all the fuss is about?  Check out this video posted on YouTube asking folks why they attend.  Then, get off your duff and find one close to you and sign up!

Practical MVVM

I had a full house for my session “Practical MVVM” and I truly appreciate the attendees: thanks for the nice notes and comments, if it helped you then it was all worthwhile.  If you saw it, please post a review at SpeakerWiki.  And remember you can download the Artifacts at http://practicalmvvm.com.

Categories: .NET

Chapter 4: Container Driven Design – understanding layout

April 8, 2011 Comments off

The MEAP for Expression Blend in Action was updated yesterday to include Chapter 4, “Container Driven Design – understanding layout”.  In the chapter I explain the methods I use to layout applications.  There is a deep discussion on mastering the Grid container and heavy focus on making child elements greedy.

If you haven’t purchased the book yet, you can use discount code exblend40 to get 40% off, but don’t tell anyone! 🙂

For those of you who have written a book before I’m sure you understand the dearth of articles on the blog of late.  It’s hard to imagine just how much work goes into a book length work.  And no matter how many people tell you that ahead of time, you still aren’t prepared for it!  The good news is that we are really in the thick of it now and things are going very well.  My sincerest thanks to all the friends and supporters of the book, please enjoy the newest chapter with my compliments!

Categories: .NET

Expression Blend in Action MEAP begun

March 11, 2011 1 comment

Hi folks!  Last week while I was attending the MVP Summit, the MEAP for my upcoming Manning Publication title “Expression Blend in Action” was launched.  If you aren’t familiar with MEAP, it is a great program that Manning does where you can purchase the book and receive the chapters as they are written.  You can then provide feedback and participate in the book forum: YOU can influence the content and quality of the book!  Plus you don’t have to wait for the whole thing to be printed – it’s a win win all around.

As a special offer, between now and April 1st, you can get 50% OFF by using the following discount code: exblend50.  Feel free to spread this around, but remember it’s only good in March, so don’t miss it!

I’m obviously doing a lot of writing for the book, so my blog is suffering, but I will keep you posted here regarding updates.  If you’ve already bought it I sincerely thank you for all your support!  If you haven’t picked it up yet, what are you waiting for? 🙂

Categories: .NET

Vote for my presentations at MIX!

January 25, 2011 3 comments

Hi friends!

Two of my sessions made the Open Call to present at MIX in April.  MIX presenters are primarily Microsofties but they include 10 presentations from community folks like me.  These are selected by public vote: the top 10 vote getters will have the chance to present at MIX.  This is my dream event so I’m hoping I can get enough votes to go, and that’s where you come in!

Would you please consider voting for my presentations?  It only takes a moment and I would really appreciate it.  Voting pages for the two sessions are here:

http://live.visitmix.com/OpenCall/Vote/Session/31 – Expression Blend and the Visual State Manager: A Deep Dive
http://live.visitmix.com/OpenCall/Vote/Session/32 – Container Driven Design with Blend

Thank you so much for your help and I hope to see you at MIX!

Categories: .NET

Announcing BlendSIG

December 10, 2010 Comments off

About BlendSIG

I am happy today to officially announce and launch BlendSIG,  a Virtual Blend Special Interest Group.  Inspired by LiDNUG (the LinkedIn .NET User Group) BlendSIG meetings are held online during working hours using LiveMeeting.  We hope that this will allow people from all over the world to join in and learn more about Blend. 

We will host monthly meetings on the 2nd Wednesday of each month at 2pm EST.  These meetings will be LiveMeeting screen casts.  Guests and presenters will be Blend professionals, such as members of the Microsoft Blend team, Blend MVPs, authors, and other knowledgeable parties.

Join the BlendSIG Group at http://blendsig.groups.live.com. Members of this group will receive notifications of events and interact with each other through the mailing list.  We also would like to encourage members to suggest topics and speakers.  Please join today!

You can also follow BlendSIG on Twitter: @blendsig.

The Inaugural Meeting

Our first meeting will be January 12, 2011, and I am happy to announce that Dante Gagne, Blend PM, will be our inaugural speaker.  Dante will be presenting on Behaviors and I’m really looking forward to it!

Registration for the January meeting is now live and available at http://www.eventbrite.com/event/1114544633

Please share this information with your user groups, companies, and interested parties.  I think together we could make this a rousing success!

Categories: .NET

SQL Saturday 61 Coming to DC

November 23, 2010 1 comment

If you are a regular reader then you know I spent some time this year learning SQL Server Integration Services (SSIS).  I’ve used it in several projects and have been very happy with the results, even if I have made a few mistakes along the way.  In fact, I was so enamored of what I was able to do in such a short time that I submitted to present not one, but two sessions at the upcoming SQL Saturday DC (#61), and to my surprise they were both selected!

Below is some information about the sessions, I hope to see you there!

SSIS for real: a walk through a real world project

Abstract: In this presentation I will walk though a complete real-world SSIS project that pulls data from an AS/400 and converts it to a SQL Server destination. In addition to specific AS/400 conversion issues I will also cover topics like dynamic OLEDB connections, and creating an effective work flow. Along the way we’ll take a look at how I use Derived Columns, Conditional Split, Lookup, and Script components to solve every day conversion issues.

The specific problem domain that SSIS solved for me was converting data from the EBCDIC world of the AS/400 (iSeries, System i, name-du-jour) to SQL Server.  Previously this had all been done with straight ADO.NET applications and performance was horrendous, to put it nicely.  Now with SSIS we have a solution that implements the Incremental Load pattern that is extremely performant. I’ll be discussing this project from start to finish.

Intro to C# for the SSIS Script Component

Abstract: The Script Component is an extremely powerful element in SSIS because it brings in the full capability of the .NET Framework. With first-class development tools and languages like C# you can solve problems that previously required very complex SQL or Expressions. If you’d like to learn enough C# to more effectively use the Script Component for Transformations, then this session is for you.

As a C# developer I was very happy to learn about the Script Component in SSIS 2008.  When I had to port my Package back to 2005 I discovered that it only supported Visual Basic.  I was able to make do, but it led me to the conclusion that there are probably plenty of SSIS folks who would like to know more about C#.  The session will include some C# basics and focus on things that you would find useful for data transformation, like string manipulation, data conversion, Regular expression matching, and more.

Categories: .NET

A Centered and Resizable Text Header

September 27, 2010 4 comments

Tweeted by @Pete_Brown recently:

Attention WPF (and SL4) Devs: Get back to blogging. You’re getting lost in the amazing amount of #wp7dev content 🙂

Well, when Pete says “Jump!”… I’ve actually been meaning to post this for a few months, so thanks to Pete for giving me a push 🙂

The Problem

A friend of mine is learning Silverlight and in prototyping a simple app he wanted to just use a TextBlock for his header.  When the application has a fixed size, it works fine, but when the size is flexible he ran into one of the issues with TextBlock: it doesn’t resize or scale.  When you set the properties for a TextBlock, you set the size of the font and it never changes.

Here is the default layout we are discussing:

image1

And here it is expanded to full screen on a large resolution:

image2

The text stays centered, but the size stays static.  It makes the header seem small and out of proportion.  And similarly when the window is much smaller the text seems too large and out of proportion.  If you get extreme you can even see some weird results:

image3

Some Ideas

One way to solve this would be to listen to the UserControl’s SizeChanged event and do some math to calculate the new FontSize, but that just feels so WinForm. I’d much rather find a way to do this without code behind.

You could try to bind the FontSize of the TextBlock to a property in the ViewModel, but you still have to find a way to trigger the action.  If you bound the UserControl width and height to the ViewModel you could have its Set method raise the PropertyChanged event for the FontSize property.  And of course, you’d still have to write all the code to calculate it, which I’m sure would include measuring the text, calculating buffer zones and margins, etc.

These are just ideas, I haven’t tried either approach.  You may find a situation where you need to do one of these things or come up with something different, but honestly, these ideas just somehow feel wrong in a XAML world.  In this particular case, where the Text is static, I have a better solution.

Convert Text To A Path

The solution starts with taking advantage of the vector graphic nature of XAML. While Text may not expand and contract as desired, a Path certainly will, so the first step is to convert the Text to a Path.

In Blend, select the TextBlock item and right click, select Path –> Convert to Path (or go to Object –> Path –> Convert to Path).  This will convert the text into a Path object (outlined in Red in the screen shot below).  You’ll also notice the Horizontal and Vertical alignments have both been changed to Stretch and the Margins have been set (outlined in Yellow).

image4

If you reset the Margins to 0, you will see the Text take up the entire space.  If you change both the alignments to Center it will look OK in Blend, but when you execute the application you’ll see we actually get the same behavior as the Stretch.  This is because of Width and Height are set to Auto, which is what we want: if we set these to fixed sizes we are right back where we started.

The good news is that if you resize the window now, either bigger or smaller, you’ll see the header resize itself, so we must be on the right track!

image5

Margins and Proportions

At least in this case, we don’t want the text bumping up against the edges of its Border: it’s distracting and not very clean.  Instead, we’d like a little space surrounding it on all sides. 

You might be thinking “No big deal, I’ll just add a Margin” and you wouldn’t be totally wrong.  The problem is that hard coding the Margin, like hard coding the Text’s FontSize, means it can never change.  So a Margin that looks good when the window is small doesn’t necessarily look good when the window is large. 

What we want is the effect of a Margin, but we want that Margin to be proportional to the available space.  We really can’t solve this with the Margin property, at least not without a lot of work and calculation, which I’m just too lazy to figure out.  So the real solution is not Margins, or even in the Text (now Path) itself: the real solution is in Layout.

Solving the Problem Using Layout

One of the things I see developers new to XAML struggling with is the power of layout.  I’ve started labeling my approach “Container Driven Design” which really relies on the containers to manage the size and spacing of it’s child elements.  It frequently involves nested containers, which is what we are going to use to solve this problem.

What we really want is for our Margins to float and resize in proportion to their parent container.  Fortunately we have a container type built in that is perfect for this: the Grid.  With a Grid, we can specify percentage based sized rows and columns.  (NOTE: Yes, I know they are not *really* percentage based, but an explanation of the Star system is beyond the scope of this article.)

So to solve this problem using layout we are going to wrap our header in a 9-celled Grid: three rows and three columns, with the center cell holding our header.  Right click the Path and select Group Into –> Grid.  If you look at your Objects and Timelines panel you will see the Path is now the child of a Grid:

image6

With Grid selected, you can use the blue bars along the top and left to position the rows and columns:

image7

While I avoid editing XAML, there are a few times that it is simply faster and easier: editing Grid row and column sizes is one of those times.  In the screen shot below, you’ll see that I’ve effectively created floating margins by defining star sizes for the top and bottom rows and right and left columns.  The center row and center column have no size definition, so they will take up the remaining available space.

image8

Execute this and you’ll find that as you resize the window the margins will resize themselves proportionally, the text will remain nicely centered and will also resize itself proportionally.

image9

Wrapping it Up

So there are a couple of lessons I would want you to take away from this exercise.  First, the problem we were having was with static text, so we solved that by turning that text into something else.  We found a graphical solution to our graphical problem! 

Second, we had a problem with Margins, so we used grid rows and columns instead of the Margin property.  We solved that issue by relying on a Layout Container instead of a single property.

In both cases, we found simple and elegant solutions by thinking outside the box.  I’ll grant that this example is not overly complex, but it does illustrate the power of XAML to solve design problems.  And of course, a chance to play around in Blend is always welcome!

Categories: .NET

Blend-O-Rama Update

August 18, 2010 Comments off

Hi Folks!  Hard to believe it has been almost a month since the first ever Blend-O-Rama event!  I’ve gotten lots of questions about the videos and the website, so I wanted to put this together to give everyone an update.

The BOR Videos

When I wrote about the LiveMeeting experience, I failed to discuss recording the sessions.  Kevin recorded the sessions, but the videos themselves are really small.  I’m sure this is partly because I had to set my resolution to 1024×768 for LiveMeeting to display well, and partly to limit storage size.  The actual WMV files came out as 704×528 – like I said, they are small.

They are so small that on my 1600 monitor they are almost unreadable. They view acceptably at 1024×768, so I hate to recommend it but you may want to resize your display in order to watch the videos.  They will be available for download on the BOR site when it goes live.

I hate to make people wait any longer, so the good news is you can download them now in an all-in-one Zip file.

The BOR Website

I’m in the process of moving service providers, so the BOR website has been on hold while I get that set up.  I’m also hampered a little bit by my lack of ASP.NET experience.  Fortunately, I have friends who know a little something about all this stuff! I can happily report that I am about 98% there, with the help of Kevin Griffin and the great team at OrcsWeb.

I have a handful of videos already out there but many more to produce.  Most of the content from the BOR sessions will be available in a series of shorter videos.  I’ll also take suggestions and requests, so for now if you have any put them in the comments here. 

At any rate, progress has been made, albeit not as swiftly as I would have liked.  Such is my never ending story.  Thanks as always to all the supporters out there, you guys make it all worthwhile!

Categories: .NET

Blend-O-Rama Redux

July 26, 2010 Comments off

In case you missed it, July 19-23rd we held the first ever Blend-O-Rama Event.  Hosted by HRNUG, moderated by Kevin Griffin (MVP and HRNUG President), and presented by yours truly, the event was a week of Lunch and Learn webcasts all about Expression Blend and presented over Microsoft Live Meeting.  This was the first event I’ve done of this type and scope, so I wanted to post my review of the event.

Lessons Learned: Live Meeting

This is my first time presenting over Live Meeting (LM), so I’ve definitely learned a few things. The experience itself is a little strange, and I feel disembodied not being able to see the attendees.  As a speaker, I frequently take cues from the audience: I can usually tell whether or not I need to reiterate something, or I can see that they get it and we can move on.  You’d be surprised how much you can get out of a few nodding heads!  Over LM, it’s just me staring at my screen and talking at the microphone, and I really miss the feedback.

We did some testing over LM before the event and intentionally slowed the pace down, but on Day 1 it wasn’t enough.  Day 2 was better and by Day 3 I’d say we had the pace just right.  One side effect is that I can’t cover as much material as I might with a live audience.  I also had to adjust the content I would usually share because Live Meeting has serious issues with things like gradients and animation. 

The hardest thing for me to get comfortable with was Context Switching.  I’m an Alt-Tab fanatic, my left hand is practically deformed from sitting in the Alt-Tab position.  In this case, I couldn’t use it because I took some advice from a friend of mine and did not share my entire desktop over Live Meeting.  This meant that I had to actively select the shared application every time I wanted to switch from one to another.  BTW – if you are a seasoned LM presenter, I’d love to hear how you handle this problem: post them in the comments below.

This also takes time and in the videos you will see a lot of “gray space” while I’m fumbling through the Live Meeting controls.  I found that narrating it helps: letting the attendees know what I’m doing not only helps them understand what they are seeing, it also helps fill the silence which made me feel like I wasn’t just sitting there all alone.

I’m really glad we did a test run using Live Meeting the week before with some unbiased attendees.  We also got some help from David Makogon who gave us some great tips for dealing with Live Meeting and also stepped in a couple of times to moderate when Kevin had other responsibilities.  The biggest lesson here is the Boy Scout Motto: Be Prepared.

Lessons Learned: The Event Itself

I also learned that this sort of commitment is tough.  While the presentations were “only” an hour and a half per day, the event really consumed my entire week.  I’ll admit to underestimating this when we set the event up, mostly because I had given the first 4 presentations many many times: only the last day contained new material.  The pressure I felt to deliver a quality event, however, made me spend all my free time prepping for the next day.

And it really bothered me when something went wrong, as it did nearly every day.  I try to joke about it, but nothing is more frustrating than something not working when other people are watching.  It’s especially tough when it’s something you’ve done a thousand times and for the life of you can’t figure out what’s wrong.  Lesson learned: Expect the Unexpected.

I haven’t done near as much in Silverlight as I have in WPF.  Usually that isn’t an issue, and in Blend it rarely causes a problem, but a few of the issues had to do with my lack of familiarity with Silverlight.  More specifically, I’m accustomed to doing things one way in WPF that I may have to do differently (or can’t do at all) in Silverlight.  In this case the point I was trying to illustrate was that Blend is essentially the same in both platforms, and I do think we succeeded there.

I also learned that I didn’t know as much as I thought I did.  I’ve never been afraid to say “I don’t know” during a presentation: it’s honest and fair.  But I haven’t had to say it so often as I did this week.  Some of the questions really stumped me: in fact, I said several times it was “Stump the Presenter” week.  While I wish I knew all the answers, I also appreciate the tough questions: it means the attendees were really paying attention and thinking about Blend.  What presenter could ask for more?

Day 1 – An Introduction to Blend

I watched the playback and realized I needed to go even slower: there were too many times when the speaking got ahead of the presentation, or when I could have hovered over an item longer to let the Tooltip show through.  I also learned that Gradients are a no-go.  If you watch the video they just show up as huge blocks of color.

Day 2 – Data Binding

They say every presentation has a glitch, and this one was no exception.  I ran into a problem near the end trying to bind a Grid’s DataContext to the SelectedItem of a ListBox.  I can’t tell you how many times I’ve done this, hundreds at least.  It is simple and straightforward… until today.  It just didn’t work and I tried it several times in different ways.  I finally cleared all the DataContexts and Bindings out of the details within the Grid and rebound the DataContext and finally everything worked.  I’m still not sure what the cause was, but I’m starting to think there was something left over from when I tested the Solution earlier that day.

Day 3 – Styling and Templating

I really think on this day we finally nailed the speed and delivery.  The only glitch that stands out in my mind was trying to get Smooth Scrolling to work in Silverlight.  Turns out this is one of those areas that just isn’t the same as WPF. The downside for me is that I feel I spent too much time trying to get it to work.

BTW, the solution is to go to the ItemsPanel Style and add a FluidMoveBehavior to the VirtualizingStackPanel.  Nifty trick!

Attendees: 98

Day 4 – Animations

So understanding that Gradients and things like that don’t work well over LM, I really wasn’t expecting much out of this session.  That being said, it turned out very well.  The Live Meeting video has some odd happenings between minutes 40 and 48, but the WMV file is just fine, so be sure to watch that.

Day 5 – Advanced Topics

By and far this was my favorite day.  As I said in the presentation, this stuff is just plain fun!  I think overall I was happiest with this presentation.  I’m sure some of that has to do with my growing familiarity with Live Meeting, but naturally just as I’m getting comfortable with the format we finish!  Based on the feedback, this one was as much a hit with the audience as it was with me, so  you can expect to see me presenting this one out on the road.

Conclusions

Overall, this was a great event.  I’ll admit, I was drained by the end of it, but the steady stream of thanks and nice messages from attendees tells me we did something worthwhile here.  So much so, in fact, that I think I’d like to have one s
ession a month on different topics. 

What are your thoughts?  Your suggestions and comments will determine what shape this takes going forward, so comment below, email, or Twitter (tag #BlendORama) and let us know what you think.

Thanks again to everyone who took part, and watch out soon for the launch of www.blend-o-rama.com.

Categories: .NET