zoukankan      html  css  js  c++  java
  • wpf xaml inlines

    string testBold = "<Bold>Sync Now</Bold>";
               var ele = System.Windows.Markup.XamlReader.Parse(testBold);
               textBlock2.Inlines.Add(ele as Bold);

               string str = (string)App.Current.Resources["IDS_TO_BEGIN_SYNC_FILES"];
               //str = str.Replace("(b)", "<Bold>");
               //str = str.Replace("(/b)", "</Bold>");
               //textBlock1.DataContext = str;
               // textBlock1.Inlines.Add(str);

               int index = str.IndexOf("(b)");
               while (index != -1)
               {
                   string run1 = str.Substring(0, index);
                   textBlock1.Inlines.Add(run1);
                   str = str.Substring(index + 3);
                   index = str.IndexOf("(/b)");
                   string bold = str.Substring(0, index);
                   textBlock1.Inlines.Add(new Bold(new Run(bold)));
                   str = str.Substring(index + 4);
                   index = str.IndexOf("(b)");
               }
               textBlock1.Inlines.Add(str);

  • 相关阅读:
    HTML 常见标签part1
    HTML 初始
    jenkins远程执行脚本不退出
    jenkins 持续集成工具安装
    jenkins 杀掉衍生进程解决办法
    日志分割工具-crononlog
    可视化库 pygal 生成png中文乱码
    可视化库 pygal 无法保存成本地文件
    一个很好用的ORM库--peewee
    3 种进度条 -- 记录
  • 原文地址:https://www.cnblogs.com/xiaokang088/p/4450802.html
Copyright © 2011-2022 走看看