I'm attempting to create a custom strikethrough line for WP7 (since it doesn't support the SL4/WPF strikethough).
I've done this by creating a 2px high rectangle, and placing it 33% from the bottom (as default for the Segeo WP font strikethrough).
However, this a rather strange issue with something that looks like a opacity mask.
The strikethrough is doing some masking on the textblock, and this is very much intendedly. So I'm looking for any ideas on how I can fix this.
Snippet of the XAML:
<TextBlock x:Name="ContentContainer"
Text="{TemplateBinding Content}"
Grid.Column="0"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Left"
Margin="0,0,0,0"
OpacityMask="{x:Null}"
Padding="{TemplateBinding Padding}"
FontSize="{StaticResource PhoneFontSizeLarge}" />
<Rectangle x:Name="CheckBorder"
Fill="{StaticResource PhoneDisabledBrush}"
Margin="0,26,0,15"
OpacityMask="{x:Null}"
Width="{Binding Width, ElementName=ContentContainer}"
Height="2"开发者_如何学运维/>
As you can see I've tried setting the OpacityMask to {x:Null}, but alas, this have no effect at all.
I'm not sure this is an OpacityMask problem - instead I think it's two sets of PhoneDisabledColor
brushes combining together.
From the resources, it looks like PhoneDisabledColor
is 40% opacity white
<Color x:Key="PhoneDisabledColor">#66FFFFFF</Color>
So when you place two objects with this opacity on top of each other then you get the drawing effect you've seen - sections with stronger than 40% opacity.
There is a solution for strikethrough listed here - http://forums.silverlight.net/forums/t/19749.aspx
Edit/Update - having looked at that solution, I think it might show the same problem you have seen.
Found via Strikeout text in Windows phone 7
精彩评论