views:

358

answers:

2

I'm using the latest version of the SL Toolkit for SL3. The TimePicker works great but is slightly too big. There's plenty of white space before the actual time.

I tried to resize the control by setting MinWidth and Width but the TextBox dislaying the time doesn't get resized below a width of 120 and therefore the right part gets hidden.

Did anyone encounter the same issue and has a fix for it? I tried overloading the ContentTemplate but without any luck.

+2  A: 

You need to actually set the TimeUpDownStyle instead, since the TimePicker control is a composite, it is actually the TimeUpDown control inside it (a template part) that has a MinWidth set to 100 inside it - and setting the style will help fix that.

Consider using code like this to make the new minimum width 30 for the TimeUpDown part of the control:

<Grid.Resources>
   <Style x:Key="smallMinimumWidth" TargetType="inputToolkit:TimeUpDown">
      <Setter Property="MinWidth" Value="30" />
   </Style>
</Grid.Resources>
<inputToolkit:TimePicker TimeUpDownStyle="{StaticResource smallMinimumWidth}" />

Hope this helps!

Jeff Wilcox
I have the same problem as the asker. I tried this fix, but it seems to change nothing.I'm a Silverlight neophyte so I could be overlooking some detail.
Brennan Vincent
I realized the issue: I needed to have MinWIdth set on the TimePicker (e.g., to 0), otherwise it defaults to 125.Upvoting because your answer got me most of the way to solving the problem, which could have taken me days of beating my head against the wall otherwise. Thanks, man!
Brennan Vincent
A: 

I have tried this and I can't get it to work. Because I had a problem with the TimePicker control - see this post http://forums.silverlight.net/forums/p/108539/246384.aspx#246384 - I already have a style for the TimeDownStyle. In it I modified the MinWidth to 30 but to no effect. I would like to reduce the size of the TimePicker control to reduce the amout of space that it uses. It does work if I put in a minimum width of 300 !

Stapes

related questions