Vertu cell phones - WTF??

Take a look at this picture. Those are not cell phones from 90x of 20th century, no, no.. Those are elite, luxury phones presented by Virtu:

Virtu phones

Now those phones cost tens thousands of green dollars. Why? No idea. Maybe they have nice set of features? Nope. So why? Look at the screenshot of small part of their site:

image

This locker took 2 years to design? C'mon! What you were designing there? Now definitely I know why this costs so much and why phone features are soooo low-tech.

del.icio.us Tags: ,

WPF: Adding text as a background of TextBox or ComboBox

One of those small things I liked in Vista is help text in the background of various text boxes, such as Search in Explorer:

1

When you click on it, the text disappears, leave it without typing anything, you again see the text. In many places this might be a useful thing - it helps user to determine what should be written inside and there is no additional place needed to put the label. So I wanted to figure out how to do this in pure XAML without any additional code. It turned out this was pretty simple.

There was a sample in MSDN describing how to do this using background image and code-behind. But I didn't want separate image nor any code written. So instead of using image, I took VisualBrush for background and triggers to hide/display it. Now it looks like:

2

And the code:

<ComboBox IsTextSearchEnabled="True" StaysOpenOnEdit="True" 
          Width="150" Height="24"  IsReadOnly="False" IsEditable="True">
  <ComboBox.Resources>
    <VisualBrush x:Key="HelpBrush" TileMode="None" Opacity="0.4" Stretch="None" AlignmentX="Left">
      <VisualBrush.Visual>
        <TextBlock FontStyle="Italic" Text="Type or select from list"/>
      </VisualBrush.Visual>
    </VisualBrush>
  </ComboBox.Resources>
  <ComboBox.Style>
    <Style TargetType="ComboBox">
      <Style.Triggers>
        <Trigger Property="Text" Value="{x:Null}">
          <Setter Property="Background" Value="{StaticResource HelpBrush}"/>
        </Trigger>
        <Trigger Property="Text" Value="">
          <Setter Property="Background" Value="{StaticResource HelpBrush}"/>
        </Trigger>
      </Style.Triggers>
    </Style>
  </ComboBox.Style>
  <ComboBoxItem>First item</ComboBoxItem>
  <ComboBoxItem>Another item</ComboBoxItem>
</ComboBox>

 

Technorati Tags: ,