MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

oversize canvas cause radiabutton path render as oval

未关闭
#904 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug up-for-grabs
主要语言
C#
星标
16.3k
派生
3.5k
平均合并
1 天 22 小时
30 天内合并 PR
8

描述

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
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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 MaterialDesignTheme.RaidoButton.xaml 开始,检查 Graphic 和 InteractionEllipse 路径周围的 Viewbox 和 Canvas 尺寸设置。重现包含三个单选按钮的 UniformGrid 示例,然后比较不同单选按钮尺寸下的渲染结果。完成标准是:在报告的布局中以及更大的控件中,单选路径保持圆形而不是椭圆形。

由索引模型根据 Issue 内容生成。

评估

领域
design, desktop
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。