C# mytoolkit:FixedHtmlBlock更改样式,xaml
因此,我正在开发一个WindowsPhone8应用程序,并使用mytoolkit:FixedHtmlBlock显示html内容。我的代码在下面C# mytoolkit:FixedHtmlBlock更改样式,xaml,c#,xaml,windows-phone-8,mytoolkit,C#,Xaml,Windows Phone 8,Mytoolkit,因此,我正在开发一个WindowsPhone8应用程序,并使用mytoolkit:FixedHtmlBlock显示html内容。我的代码在下面 我想定制h3标签的样式,我在这里找到了这个文档 它说我们可以使用下面的代码来定制样式 ((段落生成器)((HtmlTextBlock)html).Generators[“h2”]).FontSize=26; ((段落生成器)((HtmlTextBlock)html).Generators[“h3”]).FontSize=20; ((段落生成器)((Ht
我想定制h3标签的样式,我在这里找到了这个文档
它说我们可以使用下面的代码来定制样式
((段落生成器)((HtmlTextBlock)html).Generators[“h2”]).FontSize=26;
((段落生成器)((HtmlTextBlock)html).Generators[“h3”]).FontSize=20;
((段落生成器)((HtmlTextBlock)html).Generators[“h3”]).FontStyle=FontStyles.Italic代码>
但是我不知道如何使用它们,或者把它们放在哪里。有人能告诉我如何使用这些代码吗
更新:
因此,
位于下面给出的资源字典中,存储在Views/DataTemplates/Post1Detail.xaml中
<DataTemplate x:Name="Posts1DetailLayout">
<Grid Margin="10,5,5,5">
<ScrollViewer>
<StackPanel>
<mytoolkit:FixedHtmlTextBlock Html="{Binding Title}" FontSize="32" Foreground="{StaticResource AppForegroundColor}"/>
<mytoolkit:FixedHtmlTextBlock x:Name="pcd" Html="{Binding Content}" FontSize="24" Foreground="{StaticResource AppForegroundColor}" />
</StackPanel>
</ScrollViewer>
</Grid>
</DataTemplate>
我得到一个错误“名称pcd在当前上下文中不存在”。现在,我如何访问资源字典中的fixedhtmltextblock名称并在PostDetail构造函数中使用它
<mytoolkit:FixedHtmlTextBlock x:Name="YourHtmlBlock" Html="{Binding Content}" FontSize="24" Foreground="{StaticResource AppForegroundColor}" />
YourHtmlBlock.Generators["p"] = new ParagraphGenerator()
{
//change properties here :)
};
YourHtmlBlock.Generators[“p”]=新段落生成器()
{
//在此处更改属性:)
};
如果您想更改更多内容,可以创建自定义段落生成器。我在哪里使用您的HtmlBlock.Generators[“p”]=new ParagraphGenerator(){//change properties here:)};在页面的.xaml.cs文件中?如果需要添加任何程序集引用?如果可能,您可以给我详细的说明吗?请在页面构造函数中初始化后将其放入。这是我得到的错误吗找不到类型或命名空间名称“ParagraphGenerator”
我遇到了更多的问题。我已经发布了上述问题的更新,请检查。
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Navigation;
using System.Windows.Threading;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Net.NetworkInformation;
using Microsoft.Phone.Controls;
using MyToolkit.Paging;
using AppStudio.Data;
using AppStudio.Services;
using MyToolkit.Controls;
using MyToolkit.Controls.HtmlTextBlockImplementation.Generators;
using System.Windows.Resources;
using System.IO;
namespace AppStudio
{
public partial class PostsDetail
{
private bool _isDeepLink = false;
public PostsDetail()
{
InitializeComponent();
pcd.Generators["h3"] = new ParagraphGenerator()
{
FontSize = 26,
};
}
<mytoolkit:FixedHtmlTextBlock x:Name="YourHtmlBlock" Html="{Binding Content}" FontSize="24" Foreground="{StaticResource AppForegroundColor}" />
YourHtmlBlock.Generators["p"] = new ParagraphGenerator()
{
//change properties here :)
};