Esempio n. 1
0
        public static void SetBoundDocument(DependencyObject dp, string value)
        {
            var xaml = value;
            var html = HtmlFromXamlConverter.ConvertXamlToHtml(xaml, false);

            dp.SetValue(BoundDocument, html);
        }
Esempio n. 2
0
        private static void HandleTextChanged(object sender, RoutedEventArgs e)
        {
            // TODO: TextChanged is currently not working!
            //now only updates tag
            RichTextBox box = sender as RichTextBox;

            TextRange tr = new TextRange(box.Document.ContentStart,
                                         box.Document.ContentEnd);

            using (MemoryStream ms = new MemoryStream())
            {
                tr.Save(ms, DataFormats.Xaml);
                string xamlText = ASCIIEncoding.Default.GetString(ms.ToArray());
                //SetBoundDocument(box, xamlText);
                box.Tag = HtmlFromXamlConverter.ConvertXamlToHtml(xamlText, false);
            }
        }