quilty

Hello,

I'm desperately searching for a way to change the position of the bullet. Actually I only need to change the alignment of the bullet when the content of the RadioButton grows.
I already created a custom Template for the RadioButton but either I'm blind or just plain stupid since I can't find a way to change this. The Bullet is always vertical centered - I would like to have it on the top.

Any ideas Any samples where the look of a RadioButton was altered completely

Thanks,
quilty


Re: Windows Presentation Foundation (WPF) Position the bullet of a RadioButton

lee d

I am not sure how your template looks but try setting VerticalAlignment property to something other than Center






Re: Windows Presentation Foundation (WPF) Position the bullet of a RadioButton

quilty

My template is almost the default template, I just changed the look of the bullet to fit some design requirements.

Code Snippet

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<BulletDecorator Background="Transparent">
<BulletDecorator.Bullet >
<Border DockPanel.Dock="Top" x:Name="Border" Width="12" Height="12" CornerRadius="6" Background="{TemplateBinding Background}" BorderThickness="1" Padding="2">
<Border.BorderBrush>
<SolidColorBrush Color="{x:Static local:DefaultColors.BorderColor}" />
</Border.BorderBrush>
<Ellipse Visibility="Hidden" Fill="Black" x:Name="Dot" />
</Border>
</BulletDecorator.Bullet>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
</BulletDecorator>


I already tried to set the VerticalAlignment of the Border to Top, I also wrapped the Border inside a Grid, a DockPanel, ... with VerticalAligment set to Stretch and then positioned the Bullet inside to Top. Didn't help.
Playing around with some (background)colors I noticed, that the Bullet itself seems to be positioned centered/centered and I didn't found a way to change this behavior.

I already thought about writting a own Template for a BulletDecorator but I can't find a way to do this.

Phil






Re: Windows Presentation Foundation (WPF) Position the bullet of a RadioButton

lee d

did you set the height of the RadioButton , set it to say 40 and see




Re: Windows Presentation Foundation (WPF) Position the bullet of a RadioButton

quilty

lee d wrote:
did you set the height of the RadioButton , set it to say 40 and see


No change,

code like

Code Snippet

<RadioButton Height="40">
<Button Height="30">
</RadioButton>


will result in the Bullet vertical centered to the Button. And setting the Height of every RadioButton won't be a solution anyway.

Phil




Re: Windows Presentation Foundation (WPF) Position the bullet of a RadioButton

Carole Snyder

Does setting the VerticalAlignment of the ContentPresenter to Bottom not give you what you want