html dosyasını xaml çeviricisine yapmaya çalışıyorum ve this code as a starting point kullanın. Uygulamam Windows Phone 8.1 evrensel uygulama. Bu kod, köprüler dışında çok iyi çalışır. Bilinmeyen HyperlinkButton marjı/dolgu stili/şablonu
Tarzım burada: HyperlingButton bazı gizli marjı veya dolgu var ve kırmızı sınırına ile işaretlenmiştir 0.
köprü olarak ayarlayarak tarzında cant'saptamak gibi görünüyor
TextBlock için<Style TargetType="HyperlinkButton" x:Key="UnderlineHyperlinkButton">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="Padding" Value="0,0,0,0"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontFamily" Value="{ThemeResource PhoneFontFamilyNormal}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="HyperlinkButton">
<TextBlock Style="{StaticResource TextStylePostBody}">
<Underline>
<Run Text="{Binding Path=Content, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
</Underline>
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Stil:
<Style x:Key="TextStylePostBody" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Padding" Value="0,0,0,0"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="TextTrimming" Value="WordEllipsis"/>
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
</Style>
Ben marjıiçinde kodlanmış değerlerle düzeltebilirim 10 ama iyi görünmüyor. köprü oluşturur
kod buradadır: gözden kaçırdığım bir şey
private static Inline GenerateHyperLink(HtmlNode node)
{
Span s = new Span();
InlineUIContainer iui = new InlineUIContainer();
HyperlinkButton hb = new HyperlinkButton() { NavigateUri = new Uri(node.Attributes["href"].Value, UriKind.Absolute), Content = CleanText(node.InnerText) };
hb.Style = (Style)Application.Current.Resources[ "UnderlineHyperlinkButton" ];
iui.Child = hb;
s.Inlines.Add(iui);
return s;
}
var mı?
Güncelleme: bu XAML kodu ile ufak bir test mü:
<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock Foreground="Black" FontSize="18" FontWeight="Normal" FontFamily="Segroe UI">TextBlock</TextBlock>
<RichTextBlock>
<Paragraph>
<Run Foreground="Black" FontSize="18" FontWeight="Normal" FontFamily="Segroe UI">
<Run.Text>Run text</Run.Text>
</Run>
<InlineUIContainer>
<HyperlinkButton FontSize="18" FontFamily="Segroe UI" FontWeight="Normal" Margin="0" Padding="0,0,0,0">Link Text</HyperlinkButton>
</InlineUIContainer>
</Paragraph>
</RichTextBlock>
</StackPanel>
ve bu var: -9 HyperlinkButton
arasında Margin
ayarlanması
(Üst):
O HyperlinkButton
TextBlock
ile Düzeltmeler marjlarını değiştirerek diğer metin veya InlineUIContainer sorunu değil:
'TextBlock' stiliniz 'TextStylePostBody' nedir? Belki sorun var. – Pollitzer
Hayır, çok kolay olurdu. Metin bloğu stili eklendi. – crea7or
Köşenizi çevreleyen metnin stili nedir? –