/// <summary> /// Converts from a WPF FlowDocument to a decision code string. /// All comboboxes are translated to "selectedItem". /// </summary> public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) { System.Diagnostics.Trace.WriteLine("Converts from FlowDocument to string decision code."); if (value == null) { return(string.Empty); } // Get flow document from value passed in EnabledFlowDocument flowDocument = value as EnabledFlowDocument; string text = ConvertFlowDocumentDataToStringWithinSelection(flowDocument.ContentStart, flowDocument.ContentEnd); return(text); }
/// <summary> /// Converts from decision code to a WPF FlowDocument. /// </summary> public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) { System.Diagnostics.Trace.WriteLine("Converts from string decision code to FlowDocument"); var flowDocument = new EnabledFlowDocument(); string text = value as string; if (text != null) { using (StringReader reader = new StringReader(text)) { string newLine; while ((newLine = reader.ReadLine()) != null) { Paragraph paragraph = ConvertStringLineToParagraph(newLine); flowDocument.Blocks.Add(paragraph); } } } return(flowDocument); }