当前位置: 首页>>代码示例>>C#>>正文


C# Paragraph.SetValue方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Documents.Paragraph.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.SetValue方法的具体用法?C# Paragraph.SetValue怎么用?C# Paragraph.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Documents.Paragraph的用法示例。


在下文中一共展示了Paragraph.SetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateContentsView

        private void UpdateContentsView(IEnumerable<LineViewModel> lines)
        {
            Uri severBaseUri = LightKindomHtmlClient.SeverBaseUri;
            ContentTextBlock.Blocks.Clear();
            bool prevLineBreakFlag = false;
            foreach (var line in lines)
            {
                var para = new Paragraph();
                para.SetValue(ParagrahViewModelProperty, line);
                if (!line.IsImage || line.Content == null)
                {
                    //if (line.HasComments)
                    //	para.Inlines.Add(new InlineUIContainer
                    //	{
                    //		Child = new SymbolIcon { Symbol = Symbol.Message },
                    //		Foreground = (SolidColorBrush)App.Current.Resources["AppAcentBrush"]
                    //	});
                    var run = new Run { Text = line.Content };
                    para.Inlines.Add(new Run { Text = CommentIndicator, FontFamily = SegoeUISymbolFontFamily, Foreground = TransparentBrush });
                    para.Inlines.Add(run);
                    //para.TextIndent = ContentTextBlock.FontSize * 1;
                    prevLineBreakFlag = true;
                    para.Margin = new Thickness(0, 0, 0, 10);
                }
                else
                {
                    //para.LineHeight = 2;
                    Size padding = new Size(ContentTextBlock.Padding.Left + ContentTextBlock.Padding.Right, ContentTextBlock.Padding.Top + ContentTextBlock.Padding.Bottom);
                    //bitmap.DownloadProgress +=
                    //var img = new Image
                    //{
                    //	Source = bitmap,
                    //	//MaxWidth = ContentColumns.ColumnWidth - padding.Width - 1,
                    //	//Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin,
                    //	HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                    //	VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                    //	Stretch = Stretch.Uniform,
                    //};
                    //img.DataContext = img;
                    //Flyout.SetAttachedFlyout(img, this.Resources["ImagePreviewFlyout"] as Flyout);
                    //img.Tapped += Illustration_Tapped;
                    //GetLocalImageAsync(new Uri(severBaseUri, line.Content)).ContinueWith(async (task) =>
                    //{
                    //	await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,()=>{
                    //		if (task.IsFaulted || task.Result == null)
                    //		{
                    //			img.Source = new BitmapImage(new Uri(severBaseUri, line.Content));
                    //		}
                    //		else
                    //		{
                    //			var localUri = task.Result;
                    //			img.Source = new BitmapImage(localUri);
                    //		}
                    //	});
                    //});


                    //var illustration = new Border
                    //{
                    //	HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                    //	VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                    //	Width = ContentColumns.ColumnWidth - padding.Width - 1,
                    //	Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin,
                    //	Background = null,
                    //	BorderBrush = null,
                    //	Child = img,
                    //};

                    var illustration = LineViewCCGTemplate.LoadContent() as IllustrationView;
                    illustration.DataContext = line;
                    illustration.Width = ContentColumns.ColumnWidth - padding.Width - 1;
                    illustration.Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin;
                    illustration.LoadIllustrationLine(line);
                    //LoadItemIllustation(illustration, line);
                    (illustration.FindName("ImageContent") as Image).SizeChanged += Image_SizeChanged;
                    //var bitmap = (illustration.GetFirstDescendantOfType<Image>().Source as BitmapImage);
                    //var pb = illustration.GetFirstDescendantOfType<ProgressBar>();
                    //bitmap.SetValue(BitmapLoadingIndicatorProperty, pb);

                    var inlineImg = new InlineUIContainer
                    {
                        Child = illustration // img
                    };

                    //inlineImg.FontSize = 620;
                    para.TextAlignment = TextAlignment.Center;
                    if (prevLineBreakFlag)
                    {
                        para.Inlines.Add(new Run { Text = "\n" });
                        illustration.Margin = new Thickness(0, 5, 0, 0);
                        //img.Margin = new Thickness(0, 5, 0, 0);
                    }
                    else
                    {
                        para.Inlines.Add(new Run { Text = " \n", FontSize = 5 });
                    }
                    para.Inlines.Add(inlineImg);

                    prevLineBreakFlag = false;
                }
//.........这里部分代码省略.........
开发者ID:fuchu,项目名称:LightNovelClientWindows,代码行数:101,代码来源:ReadingPage.xaml.cs


注:本文中的Windows.UI.Xaml.Documents.Paragraph.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。