小编ell*_*lic的帖子

如何在Windows 8 Metro App中处理HTML内容

我正在设计一个Windows 8 Reader应用程序,我必须使用一个控件来显示HTML内容,这是从一些网站提要中获取的.因为这些HTML内容可能包含图像或其他一些格式化文本,现在我使用richtextblock来显示HTML内容,但是解析HTML内容需要花费大量时间.

所以我想知道是否有任何控件可以处理除WebView之外的HTML内容.

谢谢.

更新:我无法使用WebView的原因是我需要实现分页,如下图所示:

在此输入图像描述

html microsoft-metro windows-8

12
推荐指数
1
解决办法
2399
查看次数

禁用Windows Phone中scrollviewer的垂直滚动行为

我使用滚动查看器显示水平显示的一些按钮,我可以使用滚动查看器从左向右滚动,反之亦然.但是用户仍然可以向下拖动和滚动,尽管scrollViewer会自动滚动回到顶部.这提供了一个糟糕的UX,因此我想禁用scrollviewer的垂直滚动行为,用户可以只是水平滚动.有什么想法吗?谢谢.

<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" Width="auto" Height="100" Margin="0,12" VerticalAlignment="Bottom">
   <StackPanel Orientation="Horizontal">
                    <Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
<Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
<Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
</StackPanel>    
            </ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

v

scrollviewer vertical-scrolling windows-phone-7

5
推荐指数
1
解决办法
4011
查看次数

关于在windows phone中使用richtextbox的事情

我正在使用richtextbox在Windows Phone 7.1中显示一些Html内容.

html源代码如下:

Paragraph1</p>
<img src="http://www.ifanr.com/wp-content/uploads/2011/11/DSC_332401.jpg" alt="" width="600" height="338" /></p>
Paragraph2?</p>
<h3>Title h3</h3>
Paragraph3?
</p>
Run Code Online (Sandbox Code Playgroud)

然后我用了

"string[] sArray = Regex.Split(html, "</p>", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);"
Run Code Online (Sandbox Code Playgroud)

将它们分成一个数组.最后,我使用代码:

foreach (string array in sArray)
            {
                Paragraph parag = new Paragraph();
                Run run = new Run();
                Bold bold = new Bold();
                if (!Regex.IsMatch(array.ToString(), @"<img\b[^<>]*?\bsrc\s*=\s*[""']?\s*(?<imgUrl>[^\s""'<>]*)[^<>]*?/?\s*>"))
                {
                    //h3
                    if (array.ToString().Contains("</h3>"))
                    {
                        string hString = array.ToString();
                        hString = Regex.Replace(hString, "<h3>", "");
                        string[] hArray = Regex.Split(hString, "</h3>", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
                        bold.Inlines.Add(hArray[0].ToString());
                        parag.Inlines.Add(bold);
                        run.Text = hArray[1].ToString();
                        parag.Inlines.Add(run);
                    }
                    else …
Run Code Online (Sandbox Code Playgroud)

html c# richtextbox windows-phone-7

3
推荐指数
1
解决办法
3275
查看次数

如何控制Windows Phone中滚动查看器的滚动位置

我正在使用scrollviewer来显示内容,并向scrollviewer添加了一个"DoubleTap"事件.在doubleTap事件中,我想让scrollviewer自动向上滚动到scrollviewer的顶部,但我找不到任何属性来控制scrollviewer.有什么想法吗?

提前致谢.

            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
                <ScrollViewer x:Name="scrollViewer2" Height="auto">
                    <toolkit:GestureService.GestureListener>
                        <toolkit:GestureListener  DoubleTap="GestureListener_DoubleTap"/>
                    </toolkit:GestureService.GestureListener>
                    <StackPanel x:Name="stackPanel2" Height="auto">
                         <!--contents-->
                    </StackPanel>
                </ScrollViewer>
            </Grid>
Run Code Online (Sandbox Code Playgroud)

scrollviewer windows-phone-7

3
推荐指数
1
解决办法
4083
查看次数

在Windows 8 metro应用程序中禁用放大和缩小scrollviewer

我使用RichTextBlock显示一些文本,RichTextBlock在滚动查看器中,代码如下所示:

<ScrollViewer Grid.Column="0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Vertical" Margin="12,0">
                    <TextBlock x:Name="TitleRun" FontSize="26" FontWeight="SemiBold" />
                </StackPanel>
                <RichTextBlock x:Name="MRichTextBlock" Grid.Row="1" Padding="12" FontSize="18">
                </RichTextBlock>
            </Grid>
        </ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

当我的应用程序在平板电脑上运行时,只要我用两根手指在滚动查看器区域进行捏合,RichTextBlock就会放大或缩小,这是不可取的.

所以我想知道在这种情况下如何禁用缩放行为.

提前致谢.

scrollviewer zooming windows-8

2
推荐指数
1
解决办法
2255
查看次数