Archive for December, 2010

Tooltip: Multibinding failed because it has no valid converter

December 31, 2010

Maybe you forgot it everytime ToolTip is more than a simple text.

Here is an example of a simple TextBlock control:

  <TextBlock Text="{Binding Path=Person.NameSurname}" 
        ToolTip="{Binding Path=Persona.LocalAddress}" />

What would you do if you want have a reacher ToolTip…person’s mobile phone number too?

Well you can’t simply have something like this 😦

  <TextBlock Text="{Binding Path=Person.NameSurname}">
        <Multibinding StringFormat="{}{0} - m. {1}">
              <Binding Path="Person.LocalAddress" />
              <Binding Path="Person.Mobile" />

You get the error “Multibinding failed because it has no valid converter”.
Compare Text vs ToolTip MSDN page in TextBlock control …
you got it ?!?
Text is a String, ToolTip is an object, straight from FrameworkElement!

So you can define a style for it, a template, or something simpler … like this πŸ˜‰

  <TextBlock Text="{Binding Path=Person.NameSurname}">
                  <Multibinding StringFormat="{}{0} - m. {1}">
                      <Binding Path="Person.LocalAddress" />
                      <Binding Path="Person.Mobile" />

Easier, ain’t it? πŸ™‚

Technorati Tags: ,,,.

Silverlight 3: scrollbars not working

December 26, 2010

Silverlight and WPF share a lot… except for a few controls not jet available in SL3 😦
Based on my last post, Scrollbars not working, that solution doesn’t work SL3: DockPanel is not available 😦
So, what could we do? Β Replace that StackPanel with a Grid!
Here is an example:

    <RowDefinition Height="Auto" />
    <RowDefinition />
    <RowDefinition Height="35" />

  <!-- search form -->
  <Grid Grid.Row="0"> ...</Grid>

  <!-- listbox results -->
  <ListBox Grid.Row="1">...</ListBox>

  <!-- buttons -->
  <Button Grid.Row="2">... </Button>

A simple tuning with RowDefinition‘s Height property (*, Auto, fixed, none) does the remaining part of the job. πŸ™‚
but this is another post πŸ˜‰

ps: Listbox has its own scrollbars, don’t forget it!

Technorati Tags: ,,.

WPF: scrollbars not working

December 25, 2010

Do that ListBox doesn’t show scrollbars ? no vertical scrollbar ?!?!
Neither ScrollViewer seems work, really ?

Shortly … Β maybe are you collecting your controls in a StackPanel ?!??!
Well, it’s all due to that StackPanel … it has no limits, so those controls don’t know whether they are in-sight or out-of-sight.
Try a DockPanel instead, plus LastChildFill property is very helpfull.

More words about scrollbars, are here Use the Right Container for ListBox Scrolling . πŸ˜‰

Technorati Tags: ,,.

source control: branch per feature or …

December 19, 2010

… branch per feature!!! πŸ˜‰

It will be very messy with lots of people working together at the same time,
but this guideline keep trunk always ready ‘n clean.

Developer, this way, can mess they’re code 100 times/day without affecting each other;
of course, continuous integration, unit tests, testers, are still there πŸ˜‰

Here are 2 blog posts talking about:
Branch-per-feature, and it’s another world by Fabrizio Giudici
FeatureBranch by Martin Fowler

Technorati Tags: ,.

Ancient knowhow for a better programming

December 18, 2010

Ancient knowhow drove people thorught centuries, because made full of experience;
that’s what proverbs really are: day-by-day guideline, for your/out entire life.
Is it extreme?
Think how knowledge moved throught centuries till now, stories & tales living this era as 1 century ago, just because people keep telling them to each other, older to younger, … and so on.

Here are some 10 Programming Proverbs Every Developer Should Know … for a better programming.
No matter what your language is (Java, C#, ASM, …) they are full living knowledge. πŸ˜‰

Have a nice read.

update: “hit by bus” is in the list, so they are not just programming proverbs πŸ˜‰ “come PM, come! here is something you’ve never seen before!” πŸ˜€