當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。