MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit
oversize canvas cause radiabutton path render as oval
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 16.3k
- Forks
- 3.5k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 8
Description
In MaterialDesignTheme.RaidoButton.xaml file, the canvas is large than viewbox, it will cause multi radio button look like oval, not circle.
three radio in uniform grid with 3 columns
<Viewbox Width="18" Height="18" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Canvas Width="24" Height="24">
<Path x:Name="Graphic"
Data="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
Fill="{DynamicResource MaterialDesignCheckBoxOff}" />
<Ellipse x:Name="InteractionEllipse" Fill="{TemplateBinding Foreground}" Width="0" Height="0" Canvas.Top="12" Canvas.Left="12" Opacity="0" RenderTransformOrigin="0.5,0.5" >
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
</Canvas>
</Viewbox>
I wonder if there a easy way to fix it, such as just changing some property like uselayoutround.
However, it's not working.
Another way is change all canvas size to fix size 18*18, but it will not work properly in large radio button.
So, I think that replacing canvas to grid with 2 ellipse maybe a solution(just do as MahApps.Metro).
ref:
<Grid x:Name="PART_CHECKBOX">
<Rectangle Margin="-6 0" Fill="{DynamicResource TransparentWhiteBrush}" />
<Ellipse x:Name="normal"
Width="18"
Height="18"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
<Ellipse x:Name="Checked1"
Width="10"
Height="10"
Fill="{DynamicResource HighlightBrush}"
Opacity="0" />
<Ellipse x:Name="disabled"
Width="18"
Height="18"
Fill="{DynamicResource SemiTransparentWhiteBrush}"
Opacity="0"
StrokeThickness="{TemplateBinding BorderThickness}" />
</Grid>
Regards.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in MaterialDesignTheme.RaidoButton.xaml and inspect the Viewbox and Canvas sizing around the Graphic and InteractionEllipse paths. Reproduce the three-radio-button UniformGrid example, then compare the rendering at different radio-button sizes. Done means the radio paths remain circular rather than oval in the reported layout and larger controls.
Written by the indexing model from the issue text.
Assessment
- Domain
- design, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100
