单选按钮中的顶部对齐项目符号
这里是 XAML 和 WP7 手机开发的新手。
我有一个单选按钮,其中有一个文本块。文本块中的文本跨越多行。发生这种情况时,项目符号位于文本中心,但我希望它与顶部对齐。我假设我需要覆盖该属性,但我似乎无法弄清楚。
这是我的单选按钮的 XAML。关于如何让项目符号与文本顶部对齐而不居中的任何想法?
<RadioButton x:Name="RadioButton1" Background="#BFD0A225" Margin="0,-12,0,-13" Checked="itsChecked" FontSize="32">
<TextBlock x:Name="TextBlockText" TextWrapping="Wrap">
<Run Text="This is line 1."/>
<LineBreak/>
<Run Text="This is line 2."/>
<LineBreak />
<Run Text="This is line 3."/>
</TextBlock>
</RadioButton>
Newbie to XAML and WP7 phone developement here.
I have a radio button that has a textblock in it. The text in the textblock spans across multiple lines. When this happens, the bullet is centered on the text, but I would like it to be aligned to the top. I'm assuming I need to override the property but I can't seem to figure it out.
Here's the XAML for my radio button. Any ideas on how I can get the bullet to align to the top of the text and not centered?
<RadioButton x:Name="RadioButton1" Background="#BFD0A225" Margin="0,-12,0,-13" Checked="itsChecked" FontSize="32">
<TextBlock x:Name="TextBlockText" TextWrapping="Wrap">
<Run Text="This is line 1."/>
<LineBreak/>
<Run Text="This is line 2."/>
<LineBreak />
<Run Text="This is line 3."/>
</TextBlock>
</RadioButton>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试将此样式应用到您的单选按钮吗?
Can you try and apply this style to your radio button?
您无需修改默认控件即可执行此操作。只需自定义您在
RadioButton
内使用的TextBlock
控件的边距即可:You don't need to modify the default control to do this. Simply customize the margin for the
TextBlock
control that you are using inside theRadioButton
: