diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/AutoSelectTextboxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/AutoSelectTextboxView.xaml.txt
index 1d7a3c92..3f84a275 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/AutoSelectTextboxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/AutoSelectTextboxView.xaml.txt
@@ -24,7 +24,7 @@
The AutoSelectTextBox allows the text content to be selected when the control get the focus. It also allows the Focus navigation behavior within the control to be affected.
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.cs.txt
index 34d193c6..d8372a4c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.cs.txt
@@ -14,9 +14,6 @@
************************************************************************************/
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Chart;
-#endif
using System.Windows.Media;
using System;
using System.Collections.ObjectModel;
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.txt
index 3eb9ddd4..fcd6c9f2 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartSeriesDataPointsBindingView.xaml.txt
@@ -26,57 +26,17 @@
The DataPoint objects of a chart's series can be set by binding with the Series.DataPointsSource property. From there, a DataPointBinding can be set on the X, Y, or Label property of a DataPoint.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.cs.txt
index a78475e2..4864490d 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.cs.txt
@@ -14,9 +14,6 @@
************************************************************************************/
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Chart;
-#endif
using System.Windows.Media;
using System.Windows.Controls;
using System;
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.txt
index 1350727e..f2d86a44 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingAxesGridView.xaml.txt
@@ -24,178 +24,32 @@
This sample shows how AxesGrid elements can be styled using a DataTemplate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.cs.txt
index 3ff2ac56..971cddae 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.cs.txt
@@ -14,9 +14,6 @@
*************************************************************************************/
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Chart;
-#endif
using System.Windows.Media;
using System.Windows.Controls;
using System.Diagnostics;
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.txt
index 16aa5efa..ca2fe617 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingColumnSeriesView.xaml.txt
@@ -25,175 +25,26 @@
This sample shows how a series with a column layout type and a legend can be styled using DataTemplates.
-
- Please move mouse on line and markers to see simple effects.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.cs.txt
index a46ed469..42191573 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.cs.txt
@@ -14,9 +14,6 @@
*************************************************************************************/
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Chart;
-#endif
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows;
@@ -34,16 +31,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Chart.Views
InitializeComponent();
}
-#if !OPEN_SOURCE
- #region Event Handler
- private void LegendButtonClick( object sender, RoutedEventArgs e )
- {
- Random r = new Random();
- _series.DataPoints.Add( new DataPoint( _series.DataPoints.Count, r.NextDouble() ) );
- }
- #endregion
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.txt
index 94fc0dcf..debe4076 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingLineSeriesView.xaml.txt
@@ -24,144 +24,23 @@
This sample demonstrates how a series with a line layout type and a legend can be styled via DataTemplates. The legend contains a button to add new DataPoints.
-
- Please move mouse along the line and over the markers to see simple effects.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.cs.txt
index 44ccffeb..2e22ccc9 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.cs.txt
@@ -14,9 +14,6 @@
*************************************************************************************/
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Chart;
-#endif
using System.Windows.Media;
using System.Windows.Controls;
using System;
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.txt
index b43180a5..4916d504 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChartStylingPieSeriesView.xaml.txt
@@ -24,175 +24,26 @@
This sample demonstrates how a series with a pie layout type can be styled via DataTemplates. The series, hint line, and hint label are all styled.
-
- Please move the mouse over the pie slices to view the tooltips of the pie layout DataTemplate.
-
-
-
-
-
- Mary
- Brad
- Anne
- Eric
- Lisa
- Carl
- Whole Team
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/CheckListsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/CheckListsView.xaml.txt
index 15d7ed74..038fd94c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/CheckListsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/CheckListsView.xaml.txt
@@ -26,7 +26,7 @@
The CheckListBox and CheckComboBox controls represent a list of selected items that are displayed as CheckBoxes. Besides the common SelectedItem and SelectedItems properties, these controls give developers more alternatives for managing and handling selections.
-
+
ID
@@ -34,7 +34,7 @@
LastName
-
+
@@ -56,7 +56,7 @@
-
+
@@ -98,7 +98,7 @@
HorizontalAlignment="Left"
IsEnabled="False"
Text="IsSelected" />
-
+
@@ -149,12 +149,12 @@
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChildWindowView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChildWindowView.xaml.txt
index 3c6b85f9..f76b6e8b 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChildWindowView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ChildWindowView.xaml.txt
@@ -25,7 +25,6 @@
The ChildWindow control can be used to create a window that is displayed within the bounds of a specific parent container.
-
-
+
@@ -54,7 +52,7 @@
-
+
@@ -84,7 +82,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ColorView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ColorView.xaml.txt
index e54b7228..3a6b5f62 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ColorView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ColorView.xaml.txt
@@ -39,7 +39,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DataGridView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DataGridView.xaml.txt
index 40e13ff5..22ecdffe 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DataGridView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DataGridView.xaml.txt
@@ -33,12 +33,12 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -148,7 +148,7 @@
-
+
@@ -156,7 +156,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt
index aa693294..9e2b3535 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt
@@ -27,7 +27,7 @@
The DateTimePicker and TimePicker controls let you select the date and the time in several ways. The TimePicker is used in the DateTimePicker.
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.Designer.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.Designer.cs.txt
index 34a83eec..667ee531 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.Designer.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.Designer.cs.txt
@@ -10,8 +10,8 @@
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
using System;
-
-
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -23,15 +23,15 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class DisplayLocalizationRes {
-
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal DisplayLocalizationRes() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
@@ -45,7 +45,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
@@ -59,7 +59,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
resourceCulture = value;
}
}
-
+
///
/// Looks up a localized string similar to Details.
///
@@ -68,7 +68,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("DetailsCategory", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Favorite actor 1 (no DisplayName).
///
@@ -77,7 +77,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor1", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to This property's type is an enum whose values have no DisplayName attributes. These values displayed are provided by the ToString() method..
///
@@ -86,7 +86,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor1Desc", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Favorite actor 2 (with DisplayName).
///
@@ -95,7 +95,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor2", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to This property's type is an enum whose values are decorated with the ExtendedDisplayName attribute. Combined with the EnumDisplayNameConverter, this allows display values to be customized..
///
@@ -104,7 +104,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor2Desc", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Favorite actor 3.
///
@@ -113,7 +113,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor3", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to "(Not listed)" enum value shows that enum values can also be localized..
///
@@ -122,7 +122,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FavoriteActor3Desc", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to First name.
///
@@ -131,7 +131,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FirstName", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to First name of that person.
///
@@ -140,7 +140,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("FirstNameDesc", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Information.
///
@@ -149,7 +149,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("InfoCategory", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Last name.
///
@@ -158,7 +158,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("LastName", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Usually the familly name of the person.
///
@@ -167,7 +167,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views {
return ResourceManager.GetString("LastNameDesc", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to (Not listed).
///
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.fr.resx.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.fr.resx.txt
new file mode 100644
index 00000000..3c7a52ca
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.fr.resx.txt
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Détails
+
+
+ Acteur favori 1 (aucun DisplayName)
+
+
+ Le type de cette propriété est un enum où les valeurs n'ont aucun attribut "DisplayName". Les valeurs affichées sont retournées par la méthode ToString().
+
+
+ Acteur favori 2 (avec DisplayName)
+
+
+ Le type de cette propriété est un enum où les valeurs sont décorés avec l'attribut "DisplayName". Les valeurs affichées sont celles spécifiées par l'attribut ExtendedDisplayName.
+
+
+ Acteur favori 3
+
+
+ La valeur "(Non proposé)" démontre que les valeurs des enums peuvent aussi être localisées.
+
+
+ Prénom
+
+
+ Prénom de la personne
+
+
+ Information
+
+
+ Nom de famille
+
+
+ Le nom de famille de la personne
+
+
+ (Non proposé)
+
+
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.resx.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.resx.txt
new file mode 100644
index 00000000..c38138ff
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DisplayLocalizationRes.resx.txt
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Details
+
+
+ Favorite actor 1 (no DisplayName)
+
+
+ This property's type is an enum whose values have no DisplayName attributes. These values displayed are provided by the ToString() method.
+
+
+ Favorite actor 2 (with DisplayName)
+
+
+ This property's type is an enum whose values are decorated with the ExtendedDisplayName attribute. Combined with the EnumDisplayNameConverter, this allows display values to be customized.
+
+
+ Favorite actor 3
+
+
+ "(Not listed)" enum value shows that enum values can also be localized.
+
+
+ First name
+
+
+ First name of that person
+
+
+ Information
+
+
+ Last name
+
+
+ Usually the familly name of the person
+
+
+ (Not listed)
+
+
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.cs.txt
index 81539c11..53bd8cdb 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.cs.txt
@@ -28,18 +28,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.FilePicker.Views
public FilePickerView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- _filePicker.SelectedFiles.CollectionChanged += this.SelectedFiles_CollectionChanged;
-#endif
}
-#if !OPEN_SOURCE
- private void SelectedFiles_CollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
- {
- //Refresh PrimitiveTypeCollectionControl.ItemsSource to be up to date with FilePicker.SelectedFiles.
- _primitiveTypeCollectionControl.ItemsSource = null;
- _primitiveTypeCollectionControl.ItemsSource = _filePicker.SelectedFiles;
- }
-#endif
}
-}
\ No newline at end of file
+}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.txt
index 42b66f1c..af502785 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/FilePickerView.xaml.txt
@@ -26,7 +26,6 @@
The FilePicker is a control that can be used to select one or more files in a browsing window.
-
-
-
-
- All files |*.*
- Text Files |*.txt
- Office Files |*.docx;*.xlsx;*.pptx
- Image files |*.jpg;*.jpeg
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/IconButtonView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/IconButtonView.xaml.txt
index a75428cd..a5384cea 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/IconButtonView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/IconButtonView.xaml.txt
@@ -29,7 +29,7 @@
-
+
-
+
@@ -96,7 +96,7 @@
SelectedItem="{Binding IconLocation, ElementName=_iconButton}"
Margin="5"
VerticalContentAlignment="Center" />
-
+
Supports implicit styles, so the entire listbox can be styled in minutes with a couple of lines of code. Also supports explicit styles and Expression Blend.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ShipName
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaskedTextboxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaskedTextboxView.xaml.txt
index 0479ffed..43b235de 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaskedTextboxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaskedTextboxView.xaml.txt
@@ -25,7 +25,7 @@
The MaskedTextBox control lets you display and edit values based on a mask.
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.cs.txt
index 4e281da5..c14c6ab4 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.cs.txt
@@ -31,13 +31,5 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void ModeComboBox_SelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- materialButton.Content = e.AddedItems[ 0 ].Equals( MaterialButtonModeEnum.Circle )
- ? ((ComboBoxItem)contentComboBox.Items.GetItemAt( 1 )).Tag
- : ((ComboBoxItem)contentComboBox.Items.GetItemAt( 0 )).Tag;
- }
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.txt
index 5314c036..ea6df55f 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialButtonView.xaml.txt
@@ -25,7 +25,6 @@
A Button with a raised animation on mouse over and a customizable ink animation on MousePress. It uses the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialCheckBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialCheckBoxView.xaml.txt
index fbebe6a1..24d054e0 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialCheckBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialCheckBoxView.xaml.txt
@@ -24,7 +24,6 @@
A CheckBox with transition animations when the checked state is changed. It uses the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialComboBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialComboBoxView.xaml.txt
index 431d839d..e8d34ce2 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialComboBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialComboBoxView.xaml.txt
@@ -26,7 +26,6 @@
MaterialComboBox is a ComboBox that is using the Material Brushes and contains MaterialComboBoxItems.
MaterialComboBoxItems are ComboBoxItems that are using the Material Brushes. They use an ink animation when they are selected.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.cs.txt
index 1c12f905..53fed7ff 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.cs.txt
@@ -19,12 +19,6 @@ using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
-#if !OPEN_SOURCE
-using System.Windows.Input;
-using System.Windows.Media.Animation;
-using System.Windows.Threading;
-using Xceed.Wpf.Toolkit.MaterialControls;
-#endif
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
{
///
@@ -32,15 +26,8 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
///
public partial class MaterialControlsView : MaterialDemoView
{
-#if !OPEN_SOURCE
- #region Members
- private Storyboard _toastStoryboard = new Storyboard();
- private Random _rand = new Random();
- private List _toastList = new List();
- #endregion
-#endif
#region Constructors
@@ -51,130 +38,22 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
#endregion
-#if !OPEN_SOURCE
- #region Private Methods
- private int GetRandomInteger( int max )
- {
- return _rand.Next( max );
- }
- private void PopToast()
- {
- MaterialAccentEnum accent;
- MaterialToastLocationEnum location;
- string text;
-
- switch( this.GetRandomInteger( 8 ) )
- {
- case 0: accent = MaterialAccentEnum.Blue; break;
- case 1: accent = MaterialAccentEnum.LightBlue; break;
- case 2: accent = MaterialAccentEnum.Cyan; break;
- case 3: accent = MaterialAccentEnum.Teal; break;
- case 4: accent = MaterialAccentEnum.Green; break;
- case 5: accent = MaterialAccentEnum.LightGreen; break;
- case 6: accent = MaterialAccentEnum.Lime; break;
- default: accent = MaterialAccentEnum.Yellow; break;
- }
- switch( this.GetRandomInteger( 6 ) )
- {
- case 0: location = MaterialToastLocationEnum.Bottom; break;
- case 1: location = MaterialToastLocationEnum.BottomLeft; break;
- case 2: location = MaterialToastLocationEnum.BottomRight; break;
- case 3: location = MaterialToastLocationEnum.Top; break;
- case 4: location = MaterialToastLocationEnum.TopLeft; break;
- default: location = MaterialToastLocationEnum.TopRight; break;
- }
- switch( this.GetRandomInteger( 6 ) )
- {
- case 0: text = "Warning"; break;
- case 1: text = "New Appointments"; break;
- case 2: text = "New Mail"; break;
- case 3: text = "New Message"; break;
- case 4: text = "Times Up!"; break;
- default: text = "Task Completed!";break;
- }
- var materialToast = new MaterialToast( _toastGrid );
- materialToast.MaterialAccent = accent;
- materialToast.Location = location;
- materialToast.Content = text;
- materialToast.DisplayTime = System.TimeSpan.FromMilliseconds( 3000 );
- materialToast.HideCompleted += this.MaterialToast_HideCompleted;
- _toastList.Add( materialToast );
- materialToast.ShowToast();
- }
- private void StartToastCircularProgressBar()
- {
- Storyboard storyboard = new Storyboard();
- var valueAnim = new DoubleAnimation( 0d, 100d, System.TimeSpan.FromMilliseconds( 3000 ) );
- Storyboard.SetTarget( valueAnim, _toastProgressBarCircular );
- Storyboard.SetTargetProperty( valueAnim, new PropertyPath( MaterialProgressBarCircular.ValueProperty ) );
- storyboard.Children.Add( valueAnim );
- storyboard.Completed += this.ToastCircularPropgressBarAnimation_Completed;
- storyboard.Begin( _toastProgressBarCircular );
- }
- #endregion
- #region Event Handlers
- private void MaterialProgressBar_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
- {
- var progressBar = sender as MaterialProgressBarBase;
- if( progressBar != null )
- {
- var storyboard = new Storyboard();
-
- // Animate ProgressBar
- var valueAnim = new DoubleAnimation( progressBar.Minimum, progressBar.Maximum, System.TimeSpan.FromMilliseconds( 4000 ) );
- Storyboard.SetTarget( valueAnim, progressBar );
- Storyboard.SetTargetProperty( valueAnim, new PropertyPath( MaterialProgressBarBase.ValueProperty ) );
- storyboard.Children.Add( valueAnim );
-
- storyboard.Begin( this );
- }
- }
- private void MaterialTabControl_SelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- var materialTabItem = e.AddedItems[ 0 ] as MaterialTabItem;
- if( (materialTabItem != null) && materialTabItem.Equals( _materialTabItem5 ) )
- {
- this.StartToastCircularProgressBar();
- }
- else
- {
- foreach( var toast in _toastList )
- {
- toast.HideToast();
- }
- }
- }
- private void MaterialToast_HideCompleted( object sender, RoutedEventArgs e )
- {
- _toastList.Remove( sender as MaterialToast );
- }
- private void MaterialToastButton_Click( object sender, RoutedEventArgs e )
- {
- this.PopToast();
- }
- private void ToastCircularPropgressBarAnimation_Completed( object sender, EventArgs e )
- {
- if( _materialTabControl.SelectedItem.Equals( _materialTabItem5 ) )
- {
- this.PopToast();
- this.StartToastCircularProgressBar();
- }
- }
- #endregion
-#endif
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.txt
index 2a609163..8bc7107c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialControlsView.xaml.txt
@@ -27,7 +27,6 @@
The Material controls include a set of complimentary accent brush and foreground.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDemoView.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDemoView.cs.txt
new file mode 100644
index 00000000..efd2b9cd
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDemoView.cs.txt
@@ -0,0 +1,41 @@
+/**************************************************************************************
+
+ Toolkit for WPF
+
+ Copyright (C) 2007-2016 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ For more features, controls, and fast professional support,
+ pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
+
+ Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
+
+ **************************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Media;
+
+namespace Xceed.Wpf.Toolkit.LiveExplorer
+{
+ public class MaterialDemoView : DemoView
+ {
+ #region Constructor
+
+ public MaterialDemoView()
+ {
+
+ }
+
+ #endregion
+
+
+
+
+
+ }
+}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDropDownView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDropDownView.xaml.txt
index d11c5ecb..a1917554 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDropDownView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialDropDownView.xaml.txt
@@ -24,7 +24,6 @@
A DropDownButton from the Xceed Wpf Toolkit with animations when opening the popup. It uses the MaterialButton animations and the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialFrameView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialFrameView.xaml.txt
index 06ea15a7..6b87ebdc 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialFrameView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialFrameView.xaml.txt
@@ -26,7 +26,6 @@
A ContentControl with a fully customizable shadow that can be modified through Shadow properties or with a Z property that enables predefined shadows.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.cs.txt
index 2bee2ede..479f55af 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.cs.txt
@@ -33,79 +33,15 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
#endregion
-#if !OPEN_SOURCE
- #region EventHandlers
- private void CheckedContentComboBox_SelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- if( materialHamburger == null )
- return;
-
- if( ( e.AddedItems != null ) && ( e.AddedItems.Count > 0 ) )
- {
- var selection = e.AddedItems[ 0 ] as ComboBoxItem;
- if( selection != null )
- {
- if( selection.Tag != null )
- {
- materialHamburger.CheckedContent = selection.Tag;
- }
- else
- {
- materialHamburger.ClearValue( MaterialHamburger.CheckedContentProperty );
- }
- }
- }
- }
- private void UncheckedContentComboBox_SelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- if( materialHamburger == null )
- return;
-
- if( ( e.AddedItems != null ) && ( e.AddedItems.Count > 0 ) )
- {
- var selection = e.AddedItems[ 0 ] as ComboBoxItem;
- if( selection != null )
- {
- if( selection.Tag != null )
- {
- materialHamburger.UncheckedContent = selection.Tag;
- }
- else
- {
- materialHamburger.ClearValue( MaterialHamburger.UncheckedContentProperty );
- }
- }
- }
- }
- private void MenuLocationComboBox_SelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- if( ( e.AddedItems != null ) && ( e.AddedItems.Count > 0 ) )
- {
- var menuLocation = ( HamburgerLocation )e.AddedItems[ 0 ];
- materialHamburgerMenu.CloseButtonLocation = ( menuLocation == HamburgerLocation.Right ) ? Location.Left : Location.Right;
- }
- }
- private void IconButton_Click( object sender, RoutedEventArgs e )
- {
- var button = sender as IconButton;
- if( button != null )
- {
- Process.Start( new ProcessStartInfo( button.Tag as string ) );
- }
- }
- private void ApplyButton_Click( object sender, RoutedEventArgs e )
- {
- materialHamburger.IsChecked = false;
- }
- #endregion
-#endif
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.txt
index 1e8ac673..47812583 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialHamburgerView.xaml.txt
@@ -26,7 +26,6 @@
A ToggleButton that pops a menu from left, right, top or bottom of a Window (or any FrameworkElement). The menu can be an animated HamburgerMenu or any customized content. It uses the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialListBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialListBoxView.xaml.txt
index 84e9cfb2..d641473c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialListBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialListBoxView.xaml.txt
@@ -27,7 +27,6 @@
MaterialListBox is a ListBox that is using the Material Brushes and contains MaterialListBoxItems.
MaterialListBoxItems are ListBoxItems that are using the Material Brushes. They use an ink animation when they are selected.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.cs.txt
index b349681f..81e27e05 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.cs.txt
@@ -33,45 +33,18 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
{
InitializeComponent();
-#if !OPEN_SOURCE
- this.Loaded += this.MaterialProgressBarCircularView_Loaded;
-#endif
}
#endregion
-#if !OPEN_SOURCE
- #region Private Methods
- private void AnimateDeterminateProgressBar()
- {
- var storyboard = new Storyboard();
- // Animate Determinate Circular ProgressBar
- DoubleAnimation valueAnim = new DoubleAnimation( materialDeterminateProgressBarCircular.Minimum, materialDeterminateProgressBarCircular.Maximum, System.TimeSpan.FromMilliseconds( 4000 ) );
- Storyboard.SetTarget( valueAnim, materialDeterminateProgressBarCircular );
- Storyboard.SetTargetProperty( valueAnim, new PropertyPath( MaterialProgressBarCircular.ValueProperty ) );
- storyboard.Children.Add( valueAnim );
- storyboard.Begin( this );
- }
- #endregion
- #region Event Handlers
- private void MaterialProgressBarCircularView_Loaded( object sender, RoutedEventArgs e )
- {
- this.AnimateDeterminateProgressBar();
- }
- private void ResetButton_Click( object sender, RoutedEventArgs e )
- {
- this.AnimateDeterminateProgressBar();
- }
- #endregion
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.txt
index ab1b5d57..2b959a9f 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarCircularView.xaml.txt
@@ -25,7 +25,6 @@
A circular ProgressBar that uses the Material Brushes. It contains properties to animate the indeterminate state.
-
@@ -45,181 +43,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.cs.txt
index 83bf8eaa..07bbdb0c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.cs.txt
@@ -32,46 +32,19 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
public MaterialProgressBarView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- this.Loaded += this.MaterialProgressBarView_Loaded;
-#endif
}
#endregion
-#if !OPEN_SOURCE
- #region Private Methods
- private void AnimateDeterminateProgressBar()
- {
- var storyboard = new Storyboard();
- // Animate Determinate ProgressBar
- DoubleAnimation valueAnim = new DoubleAnimation( materialDeterminateProgressBar.Minimum, materialDeterminateProgressBar.Maximum, System.TimeSpan.FromMilliseconds( 4000 ) );
- Storyboard.SetTarget( valueAnim, materialDeterminateProgressBar );
- Storyboard.SetTargetProperty( valueAnim, new PropertyPath( MaterialProgressBarCircular.ValueProperty ) );
- storyboard.Children.Add( valueAnim );
- storyboard.Begin( this );
- }
- #endregion
- #region Event Handlers
- private void MaterialProgressBarView_Loaded( object sender, RoutedEventArgs e )
- {
- this.AnimateDeterminateProgressBar();
- }
- private void ResetButton_Click( object sender, RoutedEventArgs e )
- {
- this.AnimateDeterminateProgressBar();
- }
- #endregion
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.txt
index b3f19334..71f7fa02 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialProgressBarView.xaml.txt
@@ -25,7 +25,6 @@
A linear ProgressBar that uses the Material Brushes. It contains properties to animate the indeterminate state.
-
-
+
@@ -45,150 +43,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialRadioButtonView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialRadioButtonView.xaml.txt
index 4149f075..0d5d3198 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialRadioButtonView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialRadioButtonView.xaml.txt
@@ -25,7 +25,6 @@
A RadioButton with transition animations when the checked state is changed. It uses the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSliderView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSliderView.xaml.txt
index 941489f6..60f559ae 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSliderView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSliderView.xaml.txt
@@ -26,7 +26,6 @@
A Slider with customizable and animated thumb and bubble that is using the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSwitchView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSwitchView.xaml.txt
index 0d9efca9..a2d2b50e 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSwitchView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialSwitchView.xaml.txt
@@ -25,7 +25,6 @@
A ToggleSwitch from the Xceed WPF Toolkit with thumb animations when Checked state is changed and that is using the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTabsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTabsView.xaml.txt
index 72a11a1c..878864fb 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTabsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTabsView.xaml.txt
@@ -27,7 +27,6 @@
MaterialTabControl is a a TabControl with animated transitions when the current selection is changed. Is is using the Material Brushes and contains MaterialTabItems.
MaterialTabItems are TabItems that are using the Material Brushes and who contains customizable ink animations on mouse press.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTextFieldView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTextFieldView.xaml.txt
index f92121c0..119bc30d 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTextFieldView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialTextFieldView.xaml.txt
@@ -26,7 +26,6 @@
A TextBox containing a customizable animated watermark that remains active when text is entered. It uses the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.cs.txt
index 6c38ff2f..5ddc4cb9 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.cs.txt
@@ -30,21 +30,5 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void ToastButton_Click( object sender, RoutedEventArgs e )
- {
- var materialToast = new MaterialToast( ( ( ComboBoxItem )toastOwnerComboBox.SelectedItem ).Tag as FrameworkElement );
- materialToast.MaterialAccentBrush = (SolidColorBrush)toastMaterialAccentBrushComboBox.SelectedItem;
- materialToast.Location = ( MaterialToastLocationEnum )toastLocationComboBox.SelectedItem;
- materialToast.SlidingDirection = ( Orientation )toastSlidingDirectionComboBox.SelectedItem;
- materialToast.Content = "Simple Toast";
- materialToast.DisplayTime = System.TimeSpan.FromMilliseconds( toastDisplayTimeIntegerUpDown.Value.Value );
- materialToast.HideOnClick = toastHideOnclickCheckBox.IsChecked.Value;
- materialToast.IsCloseButtonVisible = toastIsCloseButtonVisibleCheckBox.IsChecked.Value;
- materialToast.CloseButtonStyle = ( ( ComboBoxItem )toastClosebuttonStyleComboBox.SelectedItem ).Tag as Style;
- materialToast.CornerRadius = new CornerRadius( toastCornerRadiusIntegerUpDown.Value.Value );
- materialToast.ShowToast();
- }
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.txt
index 0b6dc052..c57494a2 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToastView.xaml.txt
@@ -25,7 +25,6 @@
A ContentControl that can be customized to display a content in any corner of any window or FrameworkElement. It is using the Material Brushes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToolTipView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToolTipView.xaml.txt
index f63d5407..3b6ba35f 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToolTipView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MaterialToolTipView.xaml.txt
@@ -25,7 +25,6 @@
A ToolTip with animations when opening. It is using the Material Brushes.
-
-
+
@@ -45,70 +43,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.cs.txt
index afec49a0..e6f2523b 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.cs.txt
@@ -28,100 +28,18 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.MultiCalendar.Views
{
public MultiCalendarView()
{
-#if !OPEN_SOURCE
- this.Initialized += new EventHandler( this.MultiCalendarView_Initialized );
-#endif
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void MultiCalendarView_Initialized( object sender, EventArgs e )
- {
- int year = System.DateTime.Now.Year;
- int month = System.DateTime.Now.Month;
- _multiCalendar.DisplayDateStart = new System.DateTime( year - 1, 1, 1 );
- _multiCalendar.DisplayDateEnd = new System.DateTime( year + 3, 12, 31 );
-
- _multiCalendar2.DisplayDateStart = new System.DateTime( year, month, 1 );
- var endYear = (month <= 9) ? year : year + 1;
- var endMonth = (month + 3) % 12;
- var endDay = System.DateTime.DaysInMonth( endYear, endMonth );
- var endDate = new System.DateTime( endYear, endMonth, endDay );
- _multiCalendar2.DisplayDateEnd = endDate;
- _multiCalendar2.HighlightedDates.Add( new System.DateTime( year, month, 12 ) );
- _multiCalendar2.HighlightedDates.Add( new System.DateTime( year, month, 20 ) );
- _multiCalendar2.SelectedDates.Add( new System.DateTime( year, month, 21 ) );
- _multiCalendar2.SelectedDates.Add( new System.DateTime( year, month, 22 ) );
- _multiCalendar2.SelectedDates.Add( new System.DateTime( year, month, 23 ) );
- var blackoutStart = _multiCalendar2.DisplayDateStart.AddMonths( 1 );
- blackoutStart.AddDays( 10 );
- _multiCalendar2.BlackoutDates.Add( new CalendarDateRange( blackoutStart.AddDays( 10 ), blackoutStart.AddDays( 15 ) ) );
- }
- private void BlackoutDates_Click( object sender, RoutedEventArgs e )
- {
- var cb = sender as CheckBox;
- _multiCalendar.BlackoutDates.Clear();
-
- if( cb.IsChecked.HasValue && cb.IsChecked.Value )
- {
- //We don't want to blackout selected dates
- _multiCalendar.SelectedDates.Clear();
-
- var firstDate = _multiCalendar.FirstDisplayedDate;
- // Current Month
- var startDate = new System.DateTime( firstDate.Year, firstDate.Month, 8 );
- var endDate = new System.DateTime( firstDate.Year, firstDate.Month, 14 );
- _multiCalendar.BlackoutDates.Add( new CalendarDateRange( startDate, endDate ) );
-
- // Next Month
- startDate = startDate.AddMonths( 1 );
- endDate = endDate.AddMonths( 1 );
- _multiCalendar.BlackoutDates.Add( new CalendarDateRange( startDate, endDate ) );
- }
- }
- private void HighlightedDates_Click( object sender, RoutedEventArgs e )
- {
- var cb = sender as CheckBox;
- _multiCalendar.HighlightedDates.Clear();
-
- if( cb.IsChecked.HasValue && cb.IsChecked.Value )
- {
- for( int i = 0; i < 3; i++ )
- {
- System.DateTime date = _multiCalendar.FirstDisplayedDate.AddMonths( i );
-
- for( int j = 1; j < 5; j++ )
- {
- _multiCalendar.HighlightedDates.Add( new System.DateTime( date.Year, date.Month, j * 5 ) );
- }
- }
- }
- }
- private void MonthlyBackgrounds_Click( object sender, RoutedEventArgs e )
- {
- var cb = sender as CheckBox;
- _multiCalendar2.MonthlyBackgrounds.Clear();
-
- if( cb.IsChecked.HasValue && cb.IsChecked.Value )
- {
- // TODO : Replace these test images with our own custom examples
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 1, new SolidColorBrush( System.Windows.Media.Color.FromArgb(128, 0, 0, 255 ) ) ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 2, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/February.jpg", UriKind.RelativeOrAbsolute ), 0.2 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 3, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/March.jpg", UriKind.RelativeOrAbsolute ), 0.5 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 4, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/April.jpg", UriKind.RelativeOrAbsolute ), 0.2 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 5, new SolidColorBrush( System.Windows.Media.Color.FromArgb( 128, 0, 255, 0 ) ) ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 6, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/June.jpg", UriKind.RelativeOrAbsolute ), 0.5 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 7, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/July.jpg", UriKind.RelativeOrAbsolute ), 0.2 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 8, new SolidColorBrush( System.Windows.Media.Color.FromArgb( 128, 255, 0, 0 ) ) ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 9, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/September.jpg", UriKind.RelativeOrAbsolute ), 0.5 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 10, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/October.jpg", UriKind.RelativeOrAbsolute ), 0.2 ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 11, new SolidColorBrush( System.Windows.Media.Color.FromArgb( 128, 255, 255, 255 ) ) ) );
- _multiCalendar2.MonthlyBackgrounds.Add( new MonthlyBackgroundData( 12, new Uri( "pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/MultiCalendar/Resources/December.jpg", UriKind.RelativeOrAbsolute ), 0.5 ) );
- }
- }
-#endif
+
+
+
+
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.txt
index d7f1cb9f..de14f5f8 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiCalendarView.xaml.txt
@@ -30,7 +30,6 @@
The Background/Foreground of any CalendarDayButton can be easily customized based on its state(selected/highlighted/blackout/mouseOver/focused/today) and the background of any Calendar can be customized with an image or a brush.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.cs.txt
index 3db0c23c..1cbf8761 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.cs.txt
@@ -30,32 +30,9 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.DataGrid.Views
{
public MultiColumnComboBoxView()
{
-#if !OPEN_SOURCE
- this.DataContext = SampleDataProvider.GetOrders();
-#endif
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void OnGroupCheck( object sender, System.Windows.RoutedEventArgs e )
- {
- DataGridCollectionView collectionView = ( DataGridCollectionView )_combo.ItemsSource;
- bool isChecked = ( ( CheckBox )sender ).IsChecked.GetValueOrDefault( false );
- bool isGrouped = ( collectionView.GroupDescriptions.Count > 0 );
-
- if( isGrouped != isChecked )
- {
- if( isChecked )
- {
- collectionView.GroupDescriptions.Add( new PropertyGroupDescription( "ShipCountry" ) );
- collectionView.GroupDescriptions.Add( new PropertyGroupDescription( "ShipCity" ) );
- }
- else
- {
- collectionView.GroupDescriptions.Clear();
- }
- }
- }
-#endif
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.txt
index 2d2e6136..f224c295 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiColumnComboBoxView.xaml.txt
@@ -24,137 +24,25 @@
The multi-column combo box uses the power of Xceed's datagrid control to create an advanced ComboBox.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiLineTextEditorView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiLineTextEditorView.xaml.txt
index 7cd51930..5e56e2ca 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiLineTextEditorView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MultiLineTextEditorView.xaml.txt
@@ -26,7 +26,7 @@
The MultiLineTextEditor is a TextBox that allows you to edit text that is too long to display in a regular TextBox. The popup is resizable to accommodate any text.
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/NumericView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/NumericView.xaml.txt
index 274ad159..9f46a868 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/NumericView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/NumericView.xaml.txt
@@ -35,7 +35,7 @@
All these numeric types support the following properties.
-
+
@@ -57,7 +57,7 @@
-
+
@@ -78,12 +78,12 @@
-
+
Infinity and -Infinity input will not be accepted if Maximum and/or Minimum values does not allow them.
HexNumber is not a valid choice when used with a DoubleUpDown (current control used in this sample). It will work with the following controls: IntegerUpDown, ByteUpDown, LongUpDown, and ShortUpDown.
-
+
@@ -115,7 +115,7 @@
-
+
@@ -127,21 +127,21 @@
-
+
-
+
-
+
-
+
@@ -160,11 +160,11 @@
-
+
-
+
@@ -179,7 +179,7 @@
-
+
@@ -210,11 +210,11 @@
DefaultValue="10"
Value="25" />
-
+
-
+
@@ -223,7 +223,7 @@
-
+
-
-
+
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieProgressView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieProgressView.xaml.txt
index 176c6cb1..4508b383 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieProgressView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieProgressView.xaml.txt
@@ -24,7 +24,7 @@
The Pie control properties can be animated to create various effects and controls like this circular progress bar.
-
+
@@ -69,7 +69,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieView.xaml.txt
index 2185ead5..e478b0d5 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PieView.xaml.txt
@@ -25,7 +25,7 @@
The Pie shape is a WPF shape that represents a portion of an ellipse. It is in the same shape as a slice of pie (hence the name). More precisely, the Pie shape is represented as either a full ellipse (Slice = 1.0), nothing (Slice = 0.0), or an arc of an ellipse joined to its center by two line segments.
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PileFlowPanelView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PileFlowPanelView.xaml.cs.txt
index fd31a350..688d0464 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PileFlowPanelView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PileFlowPanelView.xaml.cs.txt
@@ -37,140 +37,30 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PileFlowPanel.Views
public PileFlowPanelView()
{
-#if !OPEN_SOURCE
- this.DataContext = SampleDataProvider.SharedEmployees;
-#endif
InitializeComponent();
-#if !OPEN_SOURCE
- _pileFlowPanel.PileFlowItemActivated += new Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowItemActivatedHandler( this.PileFlowItemActivated );
- _pileFlowPanel.PileFlowItemDeactivated += new Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowItemDeactivatedHandler( this.PileFlowItemDeactivated );
-
- ObservableCollection products = SampleDataProvider.GetProducts();
- foreach( Product product in products )
- {
- this.AddImage( product );
- }
-#endif
+
}
#endregion
-#if !OPEN_SOURCE
- #region Event Handlers
- private void PileFlowItemActivated( object sender, Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowActivationEventArgs e )
- {
- //# Modify the text label.
- _pileFlowPanel.ContentLabel.Visibility = Visibility.Visible;
- _pileFlowLabel.Text = e.Item.Element.Tag as string;
-
- //# Enable the first PileFlowItem.
- if( object.Equals( ( ( PileFlowItem )sender ).Element, _employeesPileFlowCard ) )
- {
- _employeeListBox.IsEnabled = true;
- }
- }
- private void PileFlowItemDeactivated( object sender, EventArgs e )
- {
- //# Hide the text Label.
- _pileFlowPanel.ContentLabel.Visibility = Visibility.Collapsed;
- _pileFlowLabel.Text = null;
-
- //# Enable the first PileFlowItem.
- if( object.Equals( ( ( PileFlowItem )sender ).Element, _employeesPileFlowCard ) )
- {
- _employeeListBox.IsEnabled = false;
- }
- }
- private void OnEmployeeButtonPress( object sender, EventArgs e )
- {
- Xceed.Wpf.Toolkit.MessageBox.Show( "Employee data has been saved.", "Employee", MessageBoxButton.OK, MessageBoxImage.Asterisk);
- }
- private void OnShowReflectionsClick( object sender, RoutedEventArgs e )
- {
- CheckBox checkBox = ( CheckBox )sender;
- foreach( UIElement item in _pileFlowPanel.Children )
- {
- if( item is PileFlowCard )
- {
- (( PileFlowCard )item).ShowReflection = ( bool )checkBox.IsChecked;
- }
- }
- }
- private void OnBeginReflectionOpacityChanged( object sender, RoutedPropertyChangedEventArgs
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridBindingToStructsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridBindingToStructsView.xaml.txt
index 58ddc60d..b90730ca 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridBindingToStructsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridBindingToStructsView.xaml.txt
@@ -31,13 +31,13 @@
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCategoryOrderView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCategoryOrderView.xaml.txt
index 4db4c1c0..f01f369c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCategoryOrderView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCategoryOrderView.xaml.txt
@@ -31,7 +31,7 @@
The PropertyGrid on the right uses the CategoryOrder attribute to order the categories in the desired order.
-
+
@@ -43,7 +43,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCustomEditorsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCustomEditorsView.xaml.txt
index 0f831a45..a34189fe 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCustomEditorsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridCustomEditorsView.xaml.txt
@@ -27,7 +27,7 @@
This example demonstrates the various methods of assigning custom editors to the properties. You can supply your own editor DataTemplate based on a Type, a property name, or both. To supply your own editor for a property, you must create an EditorDefinition for the PropertyGrid.
-
+
@@ -56,7 +56,7 @@
-
+
@@ -45,13 +43,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt
index 645b28ca..bdbecc44 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt
@@ -64,9 +64,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
selectedObject.UInt16 = (ushort)9;
selectedObject.UInt32 = (uint)10;
selectedObject.UInt64 = (ulong)11;
-#if !OPEN_SOURCE
- selectedObject.File = new FileInfo( "c:\\MyFile.txt" );
-#endif
this.DataContext = selectedObject;
}
@@ -146,11 +143,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
[Category( "Non-Numeric Editors" )]
[Description( "This property uses a Char as the default editor." )]
public Char Char { get; set; }
-#if !OPEN_SOURCE
- [Category( "Non-Numeric Editors" )]
- [Description( "This property uses a FilePicker as the default editor." )]
- public FileInfo File { get; set; }
-#endif
[Category( "Non-Numeric Editors" )]
[Description( "This property uses a PrimitiveTypeCollectionEditor as the default editor." )]
public List ListOfStrings { get; set; }
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.txt
index 27f54865..94621894 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.txt
@@ -28,7 +28,7 @@
IList<T> (primtive type), IList<T> (custom type),
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.cs.txt
index 99e498eb..61fe5aa5 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.cs.txt
@@ -28,26 +28,8 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
public PropertyGridDefinitionKeyView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- var person = new Person();
- person.FirstName = "John";
- person.LastName = "Smith";
- person.ReferenceNo = 252521;
-
- this.DataContext = person;
-#endif
- }
-#if !OPEN_SOURCE
- private class Person
- {
- [DefinitionKey( "nameType" )]
- public string FirstName { get; set; }
- [DefinitionKey( "nameType" )]
- public string LastName { get; set; }
- [DefinitionKey( typeof( int? ) )]
- public object ReferenceNo { get; set; }
}
-#endif
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.txt
index bc18056b..09790441 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefinitionKeyView.xaml.txt
@@ -32,7 +32,6 @@
It can also be used to specify a specific default editor when a property type does not resolve to a valid editor (e.g., Object).
-
@@ -56,13 +54,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.cs.txt
index e4eddcbd..70be6b93 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.cs.txt
@@ -20,9 +20,6 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
-#if !OPEN_SOURCE
-using Xceed.Wpf.Toolkit.Core.Attributes;
-#endif
using Xceed.Wpf.Toolkit.Core;
using System.Windows.Controls;
using System.Globalization;
@@ -41,90 +38,16 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
public PropertyGridDisplayLocalizationView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- var person = new Person();
- person.FirstName = "John";
- person.LastName = "Doe";
- person.FavoriteActor1 = ActorNoDisplayName.billcosby;
- person.FavoriteActor2 = ActorWithDisplayName.bradpitt;
- person.FavoriteActor3 = ActorWithDisplayName.NotInThisList;
-
- _propertyGrid.SelectedObject = person;
-#endif
- }
-#if !OPEN_SOURCE
- private void ComboBox_SelectionChanged( object sender, System.Windows.Controls.SelectionChangedEventArgs e )
- {
- DisplayLocalizationRes.Culture = object.Equals(( ( ComboBox )sender ).SelectedItem,"French" )
- ? new CultureInfo( "fr" )
- : CultureInfo.InvariantCulture;
-
- // This will refresh the PropertyGrid.
- if( _propertyGrid != null )
- {
- var selected = _propertyGrid.SelectedObject;
- _propertyGrid.SelectedObject = null;
- _propertyGrid.SelectedObject = selected;
- }
}
- public enum ActorNoDisplayName
- {
- alpacino,
- arnoldschwarzenegger,
- benaffleck,
- billcosby,
- bradpitt,
- NotInThisList
- };
-
- [TypeConverter(typeof(EnumDisplayNameConverter))]
- public enum ActorWithDisplayName
- {
- [ExtendedDisplayName( "Al Pacino" )]
- alpacino,
- [ExtendedDisplayName( "Arnold Schwarzenegger" )]
- arnoldschwarzenegger,
- [ExtendedDisplayName( "Ben Affleck" )]
- benaffleck,
- [ExtendedDisplayName( "Bill Cosby" )]
- billcosby,
- [ExtendedDisplayName( "Brad Pitt" )]
- bradpitt,
- [LocalizedDisplayName( "NotListed", typeof(DisplayLocalizationRes) )]
- NotInThisList
- };
-
- [CategoryOrder( "InfoCategory", 1 )]
- [CategoryOrder( "DetailsCategory", 2 )]
- public class Person
- {
- [LocalizedDisplayName( "FirstName", typeof( DisplayLocalizationRes ) )]
- [LocalizedDescription( "FirstNameDesc", typeof( DisplayLocalizationRes ) )]
- [LocalizedCategory( "InfoCategory", typeof( DisplayLocalizationRes ) )]
- public string FirstName { get; set; }
-
- [LocalizedDisplayName( "LastName", typeof( DisplayLocalizationRes ) )]
- [LocalizedDescription( "LastNameDesc", typeof( DisplayLocalizationRes ) )]
- [LocalizedCategory( "InfoCategory", typeof( DisplayLocalizationRes ) )]
- public string LastName { get; set; }
-
- [LocalizedDisplayName( "FavoriteActor1", typeof( DisplayLocalizationRes ) )]
- [LocalizedDescription( "FavoriteActor1Desc", typeof( DisplayLocalizationRes ) )]
- [LocalizedCategory( "DetailsCategory", typeof( DisplayLocalizationRes ) )]
- public ActorNoDisplayName FavoriteActor1 { get; set; }
-
- [LocalizedDisplayName( "FavoriteActor2", typeof( DisplayLocalizationRes ) )]
- [LocalizedDescription( "FavoriteActor2Desc", typeof( DisplayLocalizationRes ) )]
- [LocalizedCategory( "DetailsCategory", typeof( DisplayLocalizationRes ) )]
- public ActorWithDisplayName FavoriteActor2 { get; set; }
-
- [LocalizedDisplayName( "FavoriteActor3", typeof( DisplayLocalizationRes ) )]
- [LocalizedDescription( "FavoriteActor3Desc", typeof( DisplayLocalizationRes ) )]
- [LocalizedCategory( "DetailsCategory", typeof( DisplayLocalizationRes ) )]
- public ActorWithDisplayName FavoriteActor3 { get; set; }
- }
-#endif
+
+
+
+
+
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.txt
index 3bf1112b..c590a92c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDisplayLocalizationView.xaml.txt
@@ -31,46 +31,17 @@
LocalizedDisplayName, LocalizedDescription, LocalizedCategory:
Theses attributes allow to easily localize the DisplayName, Description, and Category attributes values using standard Resx resource files.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- English (Default)
- French
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.cs.txt
index 57a3a257..faad6d7f 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.cs.txt
@@ -32,58 +32,10 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
public PropertyGridEditorDefinitionsView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- var selectedObject = new EditorDefinitionsSampleObject();
- selectedObject.Boolean = true;
- selectedObject.Color = Colors.Red;
- selectedObject.ColorCombo = Colors.Blue;
- selectedObject.DateTime = System.DateTime.Now;
- selectedObject.Int32 = 42;
- selectedObject.PersonTemplate = new Person() { FirstName = "John", LastName = "Smith" };
- selectedObject.String = "This is a string";
- selectedObject.StringCombo = "String Value 1";
- selectedObject.File = new FileInfo("MyFile.txt");
- this.DataContext = selectedObject;
-#endif
}
-#if !OPEN_SOURCE
- public class EditorDefinitionsSampleObject
- {
- [PropertyOrder( 0 )]
- public string String { get; set; }
- [PropertyOrder( 1 )]
- public bool Boolean { get; set; }
- [PropertyOrder( 2 )]
- public int Int32 { get; set; }
- [PropertyOrder( 3 )]
- public System.DateTime DateTime { get; set; }
- [PropertyOrder( 4 )]
- public System.Windows.Media.Color? Color { get; set; }
- [PropertyOrder( 5 )]
- public string StringCombo { get; set; }
- [PropertyOrder( 6 )]
- public System.Windows.Media.Color? ColorCombo { get; set; }
- [PropertyOrder( 7 )]
- public Person PersonTemplate { get; set; }
- [PropertyOrder( 8 )]
- public FileInfo File { get; set; }
- }
- public class Person
- {
- public string FirstName { get; set; }
- public string LastName { get; set; }
- }
-#endif
- }
-#if !OPEN_SOURCE
- public class ColorSampleItem
- {
- public System.Windows.Media.Color? Color { get; set; }
- public string DisplayString { get; set; }
}
-#endif
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.txt
index d19de312..c2c2b579 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridEditorDefinitionsView.xaml.txt
@@ -24,28 +24,10 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
VerticalScrollBarVisibility="Disabled"
Title="Ready-to-use EditorDefinitions">
-
-
-
-
- String Value 1
- String Value 2
- String Value 3
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
Using the various EditorDefinitions provided with the PropertyGrid, you can easily customize and reuse the existing default editor to suit your needs. Style the editing element or use one of the common properties directly provided on the editor definition class. The provided editor definitions are the following:
@@ -72,7 +54,6 @@
EditorIntegerUpDownDefinition
EditorDoubleUpDownDefinition
-
etc.
@@ -89,13 +69,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.cs.txt
index 33f86311..03ece539 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.cs.txt
@@ -13,7 +13,7 @@
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
************************************************************************************/
-
+
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -28,185 +28,24 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
{
InitializeComponent();
-#if !OPEN_SOURCE
- var supervisor = new Supervisor()
- {
- Name = "Micheal Jones",
- Department = DepartmentEnum.Production,
- Managers = new List()
- {
- new Manager()
- {
- Name = "Ken Clark",
- Skills = "Negociation",
- Workers = new ObservableCollection()
- {
- new Worker()
- {
- Name = "Martina Kanes",
- YearExperience = 5
- },
- new Worker()
- {
- Name = "Kelly Stewart",
- YearExperience = 3
- },
- new Worker()
- {
- Name = "Mark Applebum",
- YearExperience = 7
- }
- }
- },
- new Manager()
- {
- Name = "Julia Benetton",
- Skills = "Creative",
- Workers = new ObservableCollection()
- {
- new Worker()
- {
- Name = "John Quick",
- YearExperience = 1
- },
- new Worker()
- {
- Name = "Martha Adrian",
- YearExperience = 2
- },
- new Worker()
- {
- Name = "Kevin Stevens",
- YearExperience = 5
- }
- }
- }
- },
- Info = new Info()
- {
- Address = "64 Main Street",
- City = "New York",
- Country = "USA",
- Phone = "1-800-555-9636"
- }
- };
-
- this.DataContext = supervisor;
-#endif
+
}
}
-#if !OPEN_SOURCE
- public enum DepartmentEnum
- {
- Production,
- Marketing,
- Sales,
- Accounting
- }
- public class Supervisor
- {
- public string Name
- {
- get;
- set;
- }
- public DepartmentEnum Department
- {
- get;
- set;
- }
- public List Managers
- {
- get;
- set;
- }
- public Info Info
- {
- get;
- set;
- }
- }
- public class Manager
- {
- public string Name
- {
- get;
- set;
- }
- public string Skills
- {
- get;
- set;
- }
- public ObservableCollection Workers
- {
- get;
- set;
- }
- public override string ToString()
- {
- return this.Name;
- }
- }
- public class Worker
- {
- public string Name
- {
- get;
- set;
- }
- public int YearExperience
- {
- get;
- set;
- }
- public override string ToString()
- {
- return this.Name;
- }
- }
- public class Info
- {
- public string Address
- {
- get;
- set;
- }
- public string Phone
- {
- get;
- set;
- }
- public string City
- {
- get;
- set;
- }
- public string Country
- {
- get; set;
- }
- public override string ToString()
- {
- return "Info";
- }
- }
-#endif
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.txt
index 6fd7f912..1ce42493 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridExpandingNonPrimitivesView.xaml.txt
@@ -26,68 +26,21 @@
The PropertyGrid allows you to expand non-primitive type properties from the SelectedObject to view or edit their sub-properties. It also allows you to expand collections or lists properties to view their items and drill down on these items properties, directly from the propertyGrid, instead of passing by the CollectionEditor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.cs.txt
index e7a31ea8..69e5426b 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.cs.txt
@@ -39,9 +39,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
public PropertyGridMultiSelectedObjectsView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- _propertyGrid.SelectedObjectsOverride = new List() { _textBox, _button, _comboBox };
-#endif
}
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.txt
index 1c1f634c..fa2e6572 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridMultiSelectedObjectsView.xaml.txt
@@ -24,51 +24,18 @@
When many objects are assigned to a PropertyGrid, the PpropertyGrid will show all the common properties so that they can be changed simultaneously on each object.
-
-
-
-
-
- Green
- Red
- Blue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.cs.txt
index 0afe6f3b..72383712 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.cs.txt
@@ -32,59 +32,10 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
public PropertyGridPropertiesSourceView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- var list = new ObservableCollection();
- list.Add( new MyData( "string", "First text" ) );
- list.Add( new MyData( "Second string", "Second text" ) );
- list.Add( new MyData( "Color", Colors.Blue ) );
- list.Add( new MyData( "DateTime", System.DateTime.Now ) );
- list.Add( new MyData( "TimeSpan", System.TimeSpan.FromMinutes( 120 ) ) );
- list.Add( new MyData( "HorizontalAlignment", System.Windows.HorizontalAlignment.Center ) );
- list.Add( new MyData( "bool", true ) );
- list.Add( new MyData( "decimal", ( decimal )1 ) );
- list.Add( new MyData( "int", ( int )2 ) );
- list.Add( new MyData( "Second int", ( int )2 ) );
- list.Add( new MyData( "short", ( short )3 ) );
- list.Add( new MyData( "long", ( long )4 ) );
- list.Add( new MyData( "float", ( float )5 ) );
- list.Add( new MyData( "byte", ( byte )6 ) );
- list.Add( new MyData( "sbyte", ( sbyte )7 ) );
- list.Add( new MyData( "uint", ( uint )8 ) );
- list.Add( new MyData( "ulong", ( ulong )8 ) );
- list.Add( new MyData( "ushort", ( ushort )10 ) );
- list.Add( new MyData( "FontFamily", Fonts.SystemFontFamilies.First() ) );
- list.Add( new MyData( "FontStyle", FontStyles.Italic ) );
- list.Add( new MyData( "FontStretch", FontStretches.ExtraExpanded ) );
-
- // PropertyGrid PropertiesSource property is bound to the DataContext
- this.DataContext = list;
-#endif
- }
-#if !OPEN_SOURCE
- private void InsertProperty( object sender, RoutedEventArgs e )
- {
- ( ( IList )this.DataContext ).Insert( 0, new MyData( "New string", "new data" ) );
}
- private void RemoveProperty( object sender, RoutedEventArgs e )
- {
- if( _propertyGrid.SelectedProperty != null )
- {
- ( ( IList )this.DataContext ).Remove( _propertyGrid.SelectedProperty );
- }
- }
- private class MyData
- {
- public MyData( string name, object value )
- {
- this.MyName = name;
- this.MyValue = value;
- }
- public string MyName { get; set; }
- public object MyValue { get; set; }
- }
-#endif
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.txt
index 68522784..54633cae 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesSourceView.xaml.txt
@@ -24,7 +24,6 @@
When setting the PropertiesSource or Properties property, you can provide your own data to be displayed in the PropertyGrid. This allows you to easily insert and remove properties at runtime. The usage scheme is similar to the one used for the standard ItemsControl.
-
-
+
@@ -45,13 +43,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.cs.txt
index 988916fd..f62e2574 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.cs.txt
@@ -34,17 +34,5 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
InitializeComponent();
}
}
-#if !OPEN_SOURCE
- public class Employee
- {
- public string Name { get; set; }
- public bool IsConfirmed { get; set; }
- public string Department { get; set; }
- }
- public class Representent : Employee
- {
- public string Details { get; set; }
- }
-#endif
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.txt
index ce9af76a..ab2992d7 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertiesView.xaml.txt
@@ -28,7 +28,6 @@
The sample also demonstrate the usage of CategoryGroupDescription to control the categorization of the elements.
-
-
+
@@ -48,13 +46,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.cs.txt
index ff12d900..c65d08a6 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.cs.txt
@@ -37,7 +37,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
var selObject = new Person();
selObject.Friend = new Person();
-
+
this.DataContext = selObject;
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.txt
index 5f8ee0de..b3660262 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridPropertyItemStyleView.xaml.txt
@@ -29,7 +29,7 @@
PreparePropertyItem event to customize the display of the PropertyGrid content.
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.cs.txt
index cb1ba151..379a8f49 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.cs.txt
@@ -87,8 +87,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views
set;
}
- //# TODODOC
- //# Those attribute will be overrien in xaml
[Category( "Information" )]
[DisplayName( "Favorite Color" )]
[Description( "This property uses the ColorPicker as the default editor." )]
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.txt
index f37b7589..5afda6d8 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridSpecifyingPropertiesView.xaml.txt
@@ -26,26 +26,14 @@
By default the propertyGrid will autogenerate all the properties for a given object. You can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.
-
+
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.cs.txt
index 025dbef0..ecb507b7 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.cs.txt
@@ -32,32 +32,9 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Gauge.Views
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void BackgroundPortionsButton_Click( object sender, RoutedEventArgs e )
- {
- CollectionControlDialog diag = new CollectionControlDialog();
- diag.ItemsSource = _gauge.BGPortions;
- diag.NewItemTypes = new List() { typeof( GaugePortion ) };
- diag.ShowDialog();
- }
- private void BorderPortionsButton_Click( object sender, RoutedEventArgs e )
- {
- CollectionControlDialog diag = new CollectionControlDialog();
- diag.ItemsSource = _gauge.BorderPortions;
- diag.NewItemTypes = new List() { typeof( BorderGaugePortion ) };
- diag.ShowDialog();
- }
- private void MarkersButton_Click( object sender, RoutedEventArgs e )
- {
- CollectionControlDialog diag = new CollectionControlDialog();
- diag.ItemsSource = _gauge.Markers;
- diag.NewItemTypes = new List() { typeof( Marker ) };
- diag.ShowDialog();
- }
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.txt
index 1ed76b7c..33e6a26f 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RadialGaugeView.xaml.txt
@@ -27,7 +27,6 @@
The RadialGauge is a fully customizable gauge that can be used to display a current value on a radial or partially radial scaled circle. Markers can be added to highlight specific values. Background portions or border portions of the Radial gauge can also be customized and the pointer can be animated when moving from one value to a new one.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,0 3,30 6,0
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,0 1,20 2,0
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,0 1,15 2,0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0,90 5,0 10,90
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RangeSliderView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RangeSliderView.xaml.txt
index 0ffb7edd..ddaf1451 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RangeSliderView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RangeSliderView.xaml.txt
@@ -817,4 +817,4 @@
-
\ No newline at end of file
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.cs.txt
index 4ebc75e5..7d36095e 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.cs.txt
@@ -30,40 +30,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Rating.Views
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void ValueType_SelectionChanged( object sender, System.Windows.Controls.SelectionChangedEventArgs e )
- {
- if( _valueType.SelectedValue != null )
- {
- if( _valueType.SelectedValue.ToString() == RatingValueType.Exact.ToString() )
- {
- _rating.Value = 2.5;
- _rating.ValueType = RatingValueType.Exact;
- _value.Visibility = System.Windows.Visibility.Visible;
- _percentage.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- _rating.Value = 0.5;
- _rating.ValueType = RatingValueType.Percentage;
- _value.Visibility = System.Windows.Visibility.Collapsed;
- _percentage.Visibility = System.Windows.Visibility.Visible;
- }
- }
- }
- private void RatingItemsButton_Click( object sender, System.Windows.RoutedEventArgs e )
- {
- CollectionControlDialog diag = new CollectionControlDialog();
- diag.ItemsSource = _rating.Items;
- diag.NewItemTypes = new List() { typeof( RatingItem ) };
- diag.ShowDialog();
- }
- private void Rating_RatingValueChanged( object sender, System.Windows.RoutedPropertyChangedEventArgs e )
- {
- // add custom handling here
- }
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.txt
index 9b20a497..9c37a261 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RatingView.xaml.txt
@@ -26,7 +26,6 @@
The Rating control fills icons to represent a value on a scale. It can be interactive and is also fully customizable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.cs.txt
index 9b0e1e96..e446d13b 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.cs.txt
@@ -27,7 +27,8 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views
{
PlainText,
Rtf,
- Xaml
+ Xaml,
+ Html
};
///
@@ -63,6 +64,10 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views
{
_richTextBox.TextFormatter = new XamlFormatter();
}
+ else if (object.Equals(TextFormatterEnum.Html, tagValue))
+ {
+ _richTextBox.TextFormatter = new HtmlFormatter();
+ }
}
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.txt
index f46c2268..43155a51 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/RichTextboxView.xaml.txt
@@ -27,7 +27,7 @@
The RichTextBox is a TextBox that allows you to edit formatted text based on TextFormatters. The RichTextBoxFormatBar is a contextual formatting toolbar that mimics the behavior of the Microsoft Office 2010 formatting bar on selection.
-
+
@@ -49,6 +49,7 @@
Plain Text
RTF
Xaml
+ Html
pictures = new ObservableCollection();
- for (int i = 1; i <= 9; i++)
- {
- BitmapImage image = new BitmapImage();
- image.BeginInit();
- string filename = ("pack://application:,,,/Xceed.Wpf.Toolkit.LiveExplorer;component/Samples/SlideShow/Resources/photo_" + i + ".jpg");
- image.UriSource = new Uri(filename, UriKind.RelativeOrAbsolute);
- pictures.Add(new PictureItem("Picture " + i , image));
- image.EndInit();
- }
- foreach (PictureItem picItem in pictures)
- {
- SlideShowItem aSlideShowItem = new SlideShowItem();
- Image image = new Image();
- image.Source = picItem.Photo;
- image.Stretch = Stretch.Fill;
- aSlideShowItem.Item = image;
- aSlideShowItem.Description = picItem.Description;
- _slideShow.Items.Add(aSlideShowItem);
- }
-#endif
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SlideShowView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SlideShowView.xaml.txt
index 1777a20e..ddc3fe14 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SlideShowView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SlideShowView.xaml.txt
@@ -26,7 +26,6 @@
The SlideShow is used to display SlideShowItems in a fashion similar to a diaporama. SlideShowItems are not limited to images and can be built using any UIElement.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.cs.txt
index b47a0e54..b9b403a7 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.cs.txt
@@ -47,80 +47,28 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Views
private const string MessageBoxStyleKey = "messageBoxStyle";
private const string WindowControlStyleKey = "windowControlStyle";
private const string WindowButtonStyle = "FancyButtonStyle";
-#if OPEN_SOURCE
private const string StyleableWindowMessage = "StyleableWindow is a standalone window that can be styled just like ChildWindow or MessageBox. This is a feature of the \"Plus\" version.";
-#else
- private const string StyleableWindowNoStyleKey = "styleableWindowNoStyle";
- private const string StyleableWindowStyleKey = "styleableWindowStyle";
- private StyleableWindow _styleableWindow;
-#endif
public StyleableWindowView()
{
InitializeComponent();
-#if !OPEN_SOURCE
- this.Unloaded += new RoutedEventHandler( OnSampleUnloaded );
-#endif
this.UpdateWindowsStyles(null,null);
}
-#if !OPEN_SOURCE
- private void OnSampleUnloaded( object sender, RoutedEventArgs e )
- {
- //# Be sure to close the window
- if( _styleableWindow != null )
- {
- _styleableWindow.Close();
- }
- }
-#endif
private void OnStyleableWindow_Click( object sender, RoutedEventArgs e )
{
-#if OPEN_SOURCE
var msgBox = new Xceed.Wpf.Toolkit.MessageBox();
msgBox.DataContext = this.DataContext;
msgBox.Text = StyleableWindowMessage;
msgBox.Caption = StyledMsgBoxTitle;
msgBox.Style = ( _enableStyleCheckBox.IsChecked.GetValueOrDefault() ) ? ( Style )this.Resources[ MessageBoxStyleKey ] : null;
msgBox.ShowDialog();
-#else
- if( _styleableWindow == null )
- {
- _styleableWindow = new StyleableWindow();
- _styleableWindow.Width = 500;
- _styleableWindow.Height = 300;
- _styleableWindow.Title = StyleableWindowTitle;
- _styleableWindow.DataContext = this.DataContext;
- _styleableWindow.Left = Application.Current.MainWindow.Left + ( Application.Current.MainWindow.ActualWidth / 2 );
- _styleableWindow.Top = Application.Current.MainWindow.Top + ( Application.Current.MainWindow.ActualHeight / 2 );
- _styleableWindow.Closed += new EventHandler( OnStyleableWindowClosed );
- _styleableWindow.Topmost = true;
-
- _styleableWindow.Content = new TextBlock()
- {
- Text = StyleableWindowContent,
- TextWrapping = TextWrapping.Wrap
- };
-
- _styleableWindow.Style = ( _enableStyleCheckBox.IsChecked.GetValueOrDefault() )
- ? ( Style )this.Resources[ StyleableWindowStyleKey ]
- : ( Style )this.Resources[ StyleableWindowNoStyleKey ];
-
- _styleableWindow.Show();
- }
-#endif
- }
-#if !OPEN_SOURCE
- private void OnStyleableWindowClosed( object sender, EventArgs e )
- {
- _styleableWindow.Closed -= new EventHandler( OnStyleableWindowClosed );
- _styleableWindow.Style = null;
- _styleableWindow.DataContext = null;
- _styleableWindow = null;
+
+
}
-#endif
+
private void StandardMessageBoxButton_Click( object sender, RoutedEventArgs e )
{
System.Windows.MessageBox.Show( StandardMsgBoxMessage, StandardMsgBoxTitle );
@@ -150,15 +98,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Views
{
_childWindow.ClearValue( ChildWindow.StyleProperty );
}
-
-#if !OPEN_SOURCE
- if( _styleableWindow != null )
- {
- _styleableWindow.Style = ( styled )
- ? ( Style )this.Resources[ StyleableWindowStyleKey ]
- : ( Style )this.Resources[ StyleableWindowNoStyleKey ];
- }
-#endif
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.txt
index fe426a29..1468cc84 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/StyleableWindowView.xaml.txt
@@ -28,12 +28,10 @@
The "Plus" version provides a new control called StyleableWindow, which consists of a window that has all the functions of a normal window, but which can be styled in the same way as ChildWindow or MessageBox.
-
@@ -57,11 +55,6 @@
-
-
-
-
-
@@ -73,35 +66,10 @@
-
-
-
-
-
-
-
+
+
@@ -192,11 +158,6 @@
WindowState="Open"
CloseButtonVisibility="{Binding CloseButtonVisibility}"
WindowStyle="{Binding WindowStyle}" >
-
-
-
-
-
This is the content of the child window.
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.cs.txt
index 2cccef5c..0aa5347d 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.cs.txt
@@ -24,9 +24,7 @@ using Xceed.Wpf.Toolkit;
using System.Text.RegularExpressions;
using System.IO;
using System.Diagnostics;
-#if OPEN_SOURCE
using System.Windows.Media.Imaging;
-#endif
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Panels.Views
{
@@ -37,9 +35,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Panels.Views
{
#region Members
-#if !OPEN_SOURCE
- private DependencyObject _textBlockIdentifier;
-#endif
#endregion
@@ -52,7 +47,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Panels.Views
private void OnLayoutComboSelectionChanged( object sender, RoutedEventArgs e )
{
-#if OPEN_SOURCE
ComboBox comboBox = sender as ComboBox;
bool isPlusPanel = (comboBox.SelectedIndex >= 2);
@@ -130,524 +124,64 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Panels.Views
if( _openSourceScreenShotDesc != null )
_openSourceScreenShotDesc.Text = desc;
}
-#endif
}
private void OnSwitchPanelLayoutChanged( object sender, RoutedEventArgs e )
{
-#if !OPEN_SOURCE
- SwitchPanel switchPanel = sender as SwitchPanel;
- if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.Canvas )
- {
- InitCanvasPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.DockPanel )
- {
- InitDockPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.Grid )
- {
- InitGridPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.StackedStackPanel )
- {
- InitStackedStackPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.RelativeCanvas )
- {
- InitRelativeCanvasPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.RadialCanvas )
- {
- InitRadialCanvasPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.CameraPanel )
- {
- InitCameraPanel( switchPanel );
- }
- else if( switchPanel.ActiveLayout is Xceed.Wpf.Toolkit.Panels.AnimatedTimelinePanel )
- {
- InitAnimatedTimelinePanel( switchPanel );
- }
-#endif
}
-#if !OPEN_SOURCE
- private void OnCanvasMoveItemComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- SetItemPositionOnCanvas( _textBlockIdentifier, coordinate.X, coordinate.Y );
- }
- private void OnDockComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo != null) && (combo.SelectedItem is Dock) )
- SetItemPositionOnDockPanel( _textBlockIdentifier, (Dock)combo.SelectedItem );
- }
- private void OnGridComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- SetItemPositionOnGrid( _textBlockIdentifier, (int)coordinate.X, (int)coordinate.Y );
- }
- private void OnStackedStackComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo != null ) && ( combo.SelectedItem is int ) )
- SetItemPositionOnStackedStackPanel( _textBlockIdentifier, (int)combo.SelectedItem );
- }
- private void OnStackedStackPanelStackLengthChanged( object sender, EventArgs e )
- {
- DoubleUpDown doubleUpDown = sender as DoubleUpDown;
- if( doubleUpDown.Value.HasValue )
- {
- _stackedStackPanel.DefaultStackLength = double.IsNaN( doubleUpDown.Value.Value )
- ? StackLength.Auto
- : new StackLength( doubleUpDown.Value.Value );
- }
- }
- private void OnRelativeLeftTopComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- SetItemPositionOnRelativeCanvas( _textBlockIdentifier, coordinate.X, coordinate.Y, null, null, null );
- }
- private void OnRelativeWidthHeightComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- SetItemPositionOnRelativeCanvas( _textBlockIdentifier, null, null, coordinate.X, coordinate.Y, null );
- }
- private void OnRelativePinPointComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- Point pinPoint = new Point( coordinate.X, coordinate.Y );
- SetItemPositionOnRelativeCanvas( _textBlockIdentifier, null, null, null, null, pinPoint );
- }
- private void OnRadialCanvasCenterComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- _radialCanvas.Center = new Point( coordinate.X, coordinate.Y );
- }
- private void OnRadialCanvasAngleComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo != null ) && ( combo.SelectedItem is int ) )
- {
- if( _textBlockIdentifier != null )
- Xceed.Wpf.Toolkit.Panels.RadialCanvas.SetAngle( _textBlockIdentifier, ( int )combo.SelectedItem );
- }
- }
- private void OnRadialCanvasRadiusComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo != null ) && ( combo.SelectedItem is int ) )
- {
- if( _textBlockIdentifier != null )
- Xceed.Wpf.Toolkit.Panels.RadialCanvas.SetRadius( _textBlockIdentifier, ( int )combo.SelectedItem );
- }
- }
- private void OnRadialCanvasPinPointComboBoxChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo == null ) || !( combo.SelectedItem is Coordinates ) )
- {
- throw new InvalidDataException( "ComboBox should contain a coordinate." );
- }
- Coordinates coordinate = combo.SelectedItem as Coordinates;
- Point pinPoint = new Point( coordinate.X, coordinate.Y );
- SetItemPositionOnRadialCanvas( _textBlockIdentifier, null, null, pinPoint );
- }
- private void OnAnimatedTimelineUnitTimeSpanChanged( object sender, EventArgs e )
- {
- IntegerUpDown integerUpDown = sender as IntegerUpDown;
- if( integerUpDown.Value.HasValue )
- {
- _animatedTimeLinePanel.UnitTimeSpan = (integerUpDown.Value.Value == 0)
- ? System.TimeSpan.Zero
- : new System.TimeSpan( integerUpDown.Value.Value, 0, 0, 0 );
- }
- }
- private void OnAnimatedTimelineDatesChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox combo = sender as ComboBox;
- if( ( combo != null ) && ( combo.SelectedItem is string ) )
- {
- string selectionContent = ( string )combo.SelectedItem;
- string[] dateContent = selectionContent.Split( new string[]{ "to" }, StringSplitOptions.RemoveEmptyEntries );
- if( dateContent.Length != 2 )
- throw new InvalidDataException( "ComboBox should contain 2 date strings." );
- if( ( _textBlockIdentifier != null ) && ( _textBlockIdentifier is TextBlock ) )
- {
- TextBlock textBlock = _textBlockIdentifier as TextBlock;
- ResetItemContent( textBlock );
- AddToItemContent( textBlock, dateContent[ 0 ], dateContent[ 1 ] );
- }
- SetItemPositionOnAnimatedTimelinePanel( _textBlockIdentifier, System.DateTime.Parse( dateContent[ 0 ] ), System.DateTime.Parse( dateContent[ 1 ] ) );
- }
- }
- private void OnAnimatedTimelinePanelDeactivated( object sender, RoutedEventArgs e )
- {
- AnimationPanel animationPanel = sender as AnimationPanel;
- if( animationPanel != null )
- {
- ResetItemContent( "_item1" );
- ResetItemContent( "_item2" );
- ResetItemContent( "_item3" );
- ResetItemContent( "_item4" );
- ResetItemContent( "_item5" );
- ResetItemContent( "_item6" );
- ResetItemContent( "_item7" );
- ResetItemContent( "_item8" );
- }
- }
-#endif //!OPEN_SOURCE
#endregion
#region Methods (Private)
- #if !OPEN_SOURCE
- private void InitCanvasPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item8" ) as DependencyObject;
- SetItemPositionOnCanvas( switchPanel, "_item1", 0, 200 );
- SetItemPositionOnCanvas( switchPanel, "_item2", 150, 0 );
- SetItemPositionOnCanvas( switchPanel, "_item3", 180, 180 );
- SetItemPositionOnCanvas( switchPanel, "_item4", 12, 50 );
- SetItemPositionOnCanvas( switchPanel, "_item5", 400, 30 );
- SetItemPositionOnCanvas( switchPanel, "_item6", 500, 200 );
- SetItemPositionOnCanvas( switchPanel, "_item7", 260, 50 );
- SetItemPositionOnCanvas( switchPanel, "_item8", 600, 0 );
- }
- }
- private void InitDockPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item2" ) as DependencyObject;
- }
- private void InitGridPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item4" ) as DependencyObject;
- SetItemPositionOnGrid( switchPanel, "_item1", 1, 2 );
- SetItemPositionOnGrid( switchPanel, "_item2", 3, 0 );
- SetItemPositionOnGrid( switchPanel, "_item3", 2, 1 );
- SetItemPositionOnGrid( switchPanel, "_item4", 3, 2 );
- SetItemPositionOnGrid( switchPanel, "_item5", 3, 1 );
- SetItemPositionOnGrid( switchPanel, "_item6", 2, 0 );
- SetItemPositionOnGrid( switchPanel, "_item7", 0, 0 );
- SetItemPositionOnGrid( switchPanel, "_item8", 1, 1 );
- }
- }
- private void InitStackedStackPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item5" ) as DependencyObject;
- SetItemPositionOnStackedStackPanel( switchPanel, "_item1", 1 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item2", 3 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item3", 2 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item4", 3 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item5", 2 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item6", 2 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item7", 0 );
- SetItemPositionOnStackedStackPanel( switchPanel, "_item8", 1 );
- }
- }
- private void InitRelativeCanvasPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item6" ) as DependencyObject;
- SetItemPositionOnRelativeCanvas( switchPanel, "_item1", 0.3, 0.1 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item2", 0.55, 0 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item3", 0.6, 0.75 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item4", 0.05, 0.2 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item5", 0.45, 0.9 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item6", 0.2, 0.7 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item7", 0.5, 0.4 );
- SetItemPositionOnRelativeCanvas( switchPanel, "_item8", 0.85, 0.8 );
- }
- }
- private void InitRadialCanvasPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item7" ) as DependencyObject;
- SetItemPositionOnRadialCanvas( switchPanel, "_item1", 278, 0 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item2", 100, 145 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item3", 125, 270 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item4", 200, 335 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item5", 200, 30 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item6", 25, 0 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item7", 175, 200 );
- SetItemPositionOnRadialCanvas( switchPanel, "_item8", 300, 175 );
- }
- }
- private void InitCameraPanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item3" ) as DependencyObject;
- SetItemPositionOnCameraPanel( switchPanel, "_item1", 50, 100, 100 );
- SetItemPositionOnCameraPanel( switchPanel, "_item2", 400, 175, 25 );
- SetItemPositionOnCameraPanel( switchPanel, "_item3", 250, 300, 200 );
- SetItemPositionOnCameraPanel( switchPanel, "_item4", 75, 0, 50 );
- SetItemPositionOnCameraPanel( switchPanel, "_item5", 500, 150, 2 );
- SetItemPositionOnCameraPanel( switchPanel, "_item6", 25, 300, 90 );
- SetItemPositionOnCameraPanel( switchPanel, "_item7", 0, 200, 300 );
- SetItemPositionOnCameraPanel( switchPanel, "_item8", 450, 250, 100 );
- }
- }
- private void InitAnimatedTimelinePanel( SwitchPanel switchPanel )
- {
- if( ( switchPanel != null ) && ( switchPanel.ActiveLayout != null ) )
- {
- _textBlockIdentifier = switchPanel.ActiveLayout.FindName( "_item2" ) as DependencyObject;
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item1", new System.DateTime( 2012, 1, 1 ), new System.DateTime( 2012, 1, 1 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item2", new System.DateTime( 2012, 1, 3 ), new System.DateTime( 2012, 1, 3 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item3", new System.DateTime( 2012, 1, 1 ), new System.DateTime( 2012, 1, 4 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item4", new System.DateTime( 2012, 1, 4 ), new System.DateTime( 2012, 1, 4 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item5", new System.DateTime( 2012, 1, 1 ), new System.DateTime( 2012, 1, 1 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item6", new System.DateTime( 2012, 1, 7 ), new System.DateTime( 2012, 1, 7 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item7", new System.DateTime( 2012, 1, 5 ), new System.DateTime( 2012, 1, 7 ) );
- SetItemPositionOnAnimatedTimelinePanel( switchPanel, "_item8", new System.DateTime( 2012, 1, 6 ), new System.DateTime( 2012, 1, 6 ) );
- }
- }
- private void SetItemPositionOnCanvas( SwitchPanel switchPanel, string itemName, double left, double top )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnCanvas( ( DependencyObject )item, left, top );
- }
- }
-
- private void SetItemPositionOnCanvas( DependencyObject item, double left, double top )
- {
- if( item != null )
- {
- Xceed.Wpf.Toolkit.Panels.Canvas.SetLeft( item, left );
- Xceed.Wpf.Toolkit.Panels.Canvas.SetTop( item, top );
- }
- }
- private void SetItemPositionOnDockPanel( DependencyObject item, Dock dock )
- {
- if( item != null )
- Xceed.Wpf.Toolkit.Panels.DockPanel.SetDock( item, dock );
- }
- private void SetItemPositionOnGrid( SwitchPanel switchPanel, string itemName, int row, int column )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnGrid( ( DependencyObject )item, row, column );
- }
- }
- private void SetItemPositionOnGrid( DependencyObject item, int row, int column )
- {
- if( item != null )
- {
- Xceed.Wpf.Toolkit.Panels.Grid.SetRow( item, row );
- Xceed.Wpf.Toolkit.Panels.Grid.SetColumn( item, column );
- }
- }
- private void SetItemPositionOnStackedStackPanel( SwitchPanel switchPanel, string itemName, int stacked )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnStackedStackPanel( ( DependencyObject )item, stacked );
- }
- }
- private void SetItemPositionOnStackedStackPanel( DependencyObject item, int stacked )
- {
- if( item != null )
- Xceed.Wpf.Toolkit.Panels.StackedStackPanel.SetStack( item, stacked );
- }
- private void SetItemPositionOnRelativeCanvas( SwitchPanel switchPanel, string itemName, double left, double top )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnRelativeCanvas( ( DependencyObject )item, left, top, null, null, null );
- }
- }
- private void SetItemPositionOnRelativeCanvas( DependencyObject item, double? left, double? top, double? width, double? height, Point? pinPoint )
- {
- if( item != null )
- {
- if( left.HasValue )
- Xceed.Wpf.Toolkit.Panels.RelativeCanvas.SetLeft( item, left.Value );
- if( top.HasValue )
- Xceed.Wpf.Toolkit.Panels.RelativeCanvas.SetTop( item, top.Value );
- if( width.HasValue )
- Xceed.Wpf.Toolkit.Panels.RelativeCanvas.SetRelativeWidth( item, width.Value );
- if( height.HasValue )
- Xceed.Wpf.Toolkit.Panels.RelativeCanvas.SetRelativeHeight( item, height.Value );
- if( pinPoint.HasValue )
- Xceed.Wpf.Toolkit.Panels.RelativeCanvas.SetPinPoint( item, pinPoint.Value );
- }
- }
- private void SetItemPositionOnRadialCanvas( SwitchPanel switchPanel, string itemName, int radius, int angle )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnRadialCanvas( ( DependencyObject )item, radius, angle, null );
- }
- }
- private void SetItemPositionOnRadialCanvas( DependencyObject item, int? radius, int? angle, Point? pinPoint )
- {
- if( item != null )
- {
- if( radius.HasValue )
- Xceed.Wpf.Toolkit.Panels.RadialCanvas.SetRadius( item, radius.Value );
- if( angle.HasValue )
- Xceed.Wpf.Toolkit.Panels.RadialCanvas.SetAngle( item, angle.Value );
- if( pinPoint.HasValue )
- Xceed.Wpf.Toolkit.Panels.RadialCanvas.SetPinPoint( item, pinPoint.Value );
- }
- }
- private void SetItemPositionOnCameraPanel( SwitchPanel switchPanel, string itemName, double left, double top, int depth )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- SetItemPositionOnCameraPanel( ( DependencyObject )item, left, top, depth );
- }
- }
- private void SetItemPositionOnCameraPanel( DependencyObject item, double left, double top, int depth )
- {
- if( item != null )
- {
- Xceed.Wpf.Toolkit.Panels.CameraPanel.SetLeft( item, left );
- Xceed.Wpf.Toolkit.Panels.CameraPanel.SetTop( item, top );
- Xceed.Wpf.Toolkit.Panels.CameraPanel.SetDepth( item, depth );
- }
- }
- private void SetItemPositionOnAnimatedTimelinePanel( SwitchPanel switchPanel, string itemName, System.DateTime date, System.DateTime dateEnd )
- {
- if( switchPanel != null )
- {
- object item = switchPanel.ActiveLayout.FindName( itemName ) as object;
- AddToItemContent( item, date.ToShortDateString(), dateEnd.ToShortDateString() );
- SetItemPositionOnAnimatedTimelinePanel( ( DependencyObject )item, date, dateEnd );
- }
- }
- private void SetItemPositionOnAnimatedTimelinePanel( DependencyObject item, System.DateTime date, System.DateTime dateEnd )
- {
- if( item != null )
- {
- Xceed.Wpf.Toolkit.Panels.AnimatedTimelinePanel.SetDate( item, date );
- Xceed.Wpf.Toolkit.Panels.AnimatedTimelinePanel.SetDateEnd( item, dateEnd );
- }
- }
- private void AddToItemContent( object o, string date1, string date2 )
- {
- if( o is TextBlock )
- {
- string addedString = "\n" + date1 + "\nto " + date2;
- ( ( TextBlock )o ).Text += addedString;
- }
- }
- private void ResetItemContent( object o )
- {
- if( o is TextBlock )
- {
- TextBlock textBlock = ( TextBlock )o;
- //# Only keep the first line
- int endIndex = textBlock.Text.IndexOf( '\n' );
- if( endIndex > 0 )
- textBlock.Text = textBlock.Text.Substring( 0, endIndex );
- }
- }
- private void ResetItemContent( string itemName )
- {
- if( ( _switchPanel != null ) && ( _switchPanel.ActiveLayout != null ) )
- {
- object textBlock = _switchPanel.ActiveLayout.FindName( itemName );
- ResetItemContent( textBlock );
- }
- }
-#endif //!OPEN_SOURCE
-
+
+
#endregion
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.txt
index f0c6bc1c..1aae6579 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/SwitchPanelView.xaml.txt
@@ -29,7 +29,7 @@
The SwitchPanel allows you to animate the children between different layouts.
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.cs.txt
index f805d677..b0ee0a49 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.cs.txt
@@ -20,11 +20,6 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using Xceed.Wpf.Toolkit;
-#if !OPEN_SOURCE
-using Xceed.Wpf.Themes;
-using Xceed.Wpf.DataGrid.Themes.Metro;
-using Xceed.Wpf.DataGrid.Themes;
-#endif
using System.Windows.Controls.Primitives;
using System;
using Xceed.Wpf.Samples.SampleData;
@@ -41,103 +36,21 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Theming.Views
///
public partial class ThemingDataGridView : DemoView
{
-#if !OPEN_SOURCE
- #region Members
- private Brush _accentBrush = new SolidColorBrush( System.Windows.Media.Color.FromRgb( 255, 152, 29 ) );
- #endregion
-#endif
public ThemingDataGridView()
{
-#if !OPEN_SOURCE
- this.DataContext = SampleDataProvider.GetOrders();
-#endif
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void RadioButton_Checked( object sender, RoutedEventArgs e )
- {
- RadioButton button = sender as RadioButton;
-
- if( button == null )
- return;
-
- _accentBrush = button.Background;
- if( _accentBrush == null )
- return;
-
- if( themeComboBox.SelectedItem.Equals( metroDarkComboBoxItem ) )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.DataGrid.Themes.Metro.MetroDarkThemeResourceDictionary() );
- }
- else if( themeComboBox.SelectedItem.Equals( metroLightComboBoxItem ) )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.DataGrid.Themes.Metro.MetroLightThemeResourceDictionary() );
- }
- }
- private void ThemeComboBoxSelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox comboBox = sender as ComboBox;
- if( (comboBox != null) && (_dataGrid != null) )
- {
- switch( comboBox.SelectedIndex )
- {
- case 1:
- this.ChangeTheme( new Xceed.Wpf.DataGrid.Themes.Office2007BlueTheme() );
- break;
- case 2:
- this.ChangeTheme( new Xceed.Wpf.DataGrid.Themes.Office2007BlackTheme() );
- break;
- case 3:
- this.ChangeTheme( new Xceed.Wpf.DataGrid.Themes.Office2007SilverTheme() );
- break;
- case 4:
- this.ChangeTheme( new Xceed.Wpf.DataGrid.Themes.Windows10Theme() );
- break;
- case 5:
- //# TODODOC
- // Using a new instance of Brush to prevent the bug of AccentBrush in MetroTheme :
- // if using the same instance of AccentBrush, ThemeKey won't make the difference
- // between MetroLight and MetroDark and new Theme won't be applied (see case 156588).
- _accentBrush = _accentBrush.Clone();
- this.ChangeMetroTheme( new Xceed.Wpf.DataGrid.Themes.Metro.MetroDarkThemeResourceDictionary() );
- break;
- case 6:
- _accentBrush = _accentBrush.Clone();
- this.ChangeMetroTheme( new Xceed.Wpf.DataGrid.Themes.Metro.MetroLightThemeResourceDictionary() );
- break;
- default:
- this.ChangeTheme( null );
- break;
- }
- }
- }
- private void ChangeTheme( Theme dataGridTheme )
- {
- _accentColorPanel.Visibility = Visibility.Hidden;
- _dataGrid.View.Theme = dataGridTheme;
- }
- private void ChangeMetroTheme( DataGridMetroThemeResourceDictionaryBase metroDataGridThemeResourceDictionary )
- {
- _accentColorPanel.Visibility = Visibility.Visible;
-
- if( metroDataGridThemeResourceDictionary != null )
- {
- if( !string.IsNullOrEmpty( Xceed.Wpf.Toolkit.Licenser.LicenseKey ) )
- {
- metroDataGridThemeResourceDictionary.LicenseKey = Xceed.Wpf.Toolkit.Licenser.LicenseKey;
- }
-
- metroDataGridThemeResourceDictionary.AccentBrush = _accentBrush;
- _dataGrid.View.Theme = new Xceed.Wpf.DataGrid.Themes.Metro.MetroTheme( metroDataGridThemeResourceDictionary );
- }
- }
-#endif
+
+
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.txt
index 5a5c5a44..d35fa0ec 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingDataGridView.xaml.txt
@@ -27,529 +27,52 @@
Changes the themes of the datagrid control. Available themes are System, Office2007, Windows10 and Metro with accent color. The Xceed.Wpf.DataGrid.Themes.Office2007.dll or Xceed.Wpf.DataGrid.Themes.Metro.dll assemblies are necessary to use these themes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.cs.txt
index 7bc669f5..fb43cb02 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.cs.txt
@@ -16,12 +16,6 @@
using System.Diagnostics;
using System.Windows;
-#if !OPEN_SOURCE
-using Xceed.Wpf.Themes;
-using Xceed.Wpf.Toolkit.Themes.Office2007;
-using Xceed.Wpf.Toolkit.Themes.Metro;
-using Xceed.Wpf.Themes.Metro;
-#endif
using System;
using System.Windows.Controls;
using System.Windows.Media;
@@ -35,122 +29,31 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Theming.Views
///
public partial class ThemingExtendedToolkitView : DemoView
{
-#if !OPEN_SOURCE
- #region Members
- private Brush _accentBrush = new SolidColorBrush( System.Windows.Media.Color.FromRgb( 255, 152, 29 ) );
- private Brush whiteBrush = new SolidColorBrush( Colors.White );
- private Brush blackBrush = new SolidColorBrush( Colors.Black );
- #endregion
-#endif
public ThemingExtendedToolkitView()
{
-#if !OPEN_SOURCE
- this.Initialized += new EventHandler( ToolkitControlsThemes_Initialized );
-#endif
InitializeComponent();
}
-#if !OPEN_SOURCE
- private void RadioButton_Checked( object sender, RoutedEventArgs e )
- {
- RadioButton button = sender as RadioButton;
- if( button == null )
- return;
-
- _accentBrush = button.Background;
- if( _accentBrush == null )
- return;
-
- if( themeComboBox.SelectedItem == null )
- return;
-
- if( themeComboBox.SelectedItem.Equals( metroDarkComboBoxItem ) )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.Toolkit.Themes.Metro.ToolkitMetroDarkThemeResourceDictionary()
- , blackBrush );
- }
- else if( themeComboBox.SelectedItem.Equals( metroLightComboBoxItem ) )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.Toolkit.Themes.Metro.ToolkitMetroLightThemeResourceDictionary()
- , whiteBrush );
- }
- }
- private void ToolkitControlsThemes_Initialized( object sender,EventArgs e )
- {
- themeComboBox.SelectedIndex = 0;
- }
- private void SystemComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeTheme( null );
- }
- private void Office2007BlueComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeTheme( new Xceed.Wpf.Toolkit.Themes.Office2007.Office2007BlueResourceDictionary() );
- }
- private void Office2007SilverComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeTheme( new Xceed.Wpf.Toolkit.Themes.Office2007.Office2007SilverResourceDictionary() );
- }
- private void Office2007BlackComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeTheme( new Xceed.Wpf.Toolkit.Themes.Office2007.Office2007BlackResourceDictionary() );
- }
- private void Windows10ComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeTheme( new Xceed.Wpf.Toolkit.Themes.Windows10.Windows10ResourceDictionary() );
- }
- private void MetroDarkComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.Toolkit.Themes.Metro.ToolkitMetroDarkThemeResourceDictionary()
- , blackBrush );
- }
- private void MetroLightComboBoxItem_Selected( object sender, RoutedEventArgs e )
- {
- this.ChangeMetroTheme( new Xceed.Wpf.Toolkit.Themes.Metro.ToolkitMetroLightThemeResourceDictionary()
- , whiteBrush );
- }
- private void ChangeTheme( ThemeResourceDictionary toolkitTheme)
- {
- _accentColorPanel.Visibility = Visibility.Hidden;
- SampleBorder.Resources.MergedDictionaries.Clear();
- if( toolkitTheme != null )
- {
- SampleBorder.Resources.MergedDictionaries.Add( toolkitTheme );
- }
- SampleBorder.Background = SystemColors.WindowBrush;
- TextElement.SetForeground( SampleBorder, blackBrush );
- }
- private void ChangeMetroTheme( MetroThemeResourceDictionaryBase metroToolkitThemeResourceDictionary
- , Brush sampleBrush)
- {
- _accentColorPanel.Visibility = Visibility.Visible;
- if( metroToolkitThemeResourceDictionary != null )
- {
- metroToolkitThemeResourceDictionary.AccentBrush = _accentBrush;
- SampleBorder.Resources.MergedDictionaries.Clear();
- SampleBorder.Resources.MergedDictionaries.Add( metroToolkitThemeResourceDictionary );
- }
- SampleBorder.Background = sampleBrush;
- TextElement.SetForeground( SampleBorder, ( sampleBrush == blackBrush ) ? whiteBrush : blackBrush );
- }
-#endif
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.txt
index ede0ba82..7dc29259 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingExtendedToolkitView.xaml.txt
@@ -25,507 +25,42 @@
Changes the themes of the Toolkit for WPF controls. Available themes are System, Office2007, Windows10 and Metro with accent color. The Xceed.Wpf.Toolkit.Themes.Office2007.dll, Xceed.Wpf.Toolkit.Themes.Windows10.dll or Xceed.Wpf.Toolkit.Themes.Metro.dll assemblies are necessary to use the themes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Blue
- Red
- Yellow
- Green
- White
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.cs.txt
index e512e831..da396978 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.cs.txt
@@ -20,14 +20,6 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using Xceed.Wpf.Toolkit;
-#if !OPEN_SOURCE
-using Xceed.Wpf.ListBox.Themes.Windows10;
-using Xceed.Wpf.ListBox.Themes.Office2007;
-using Xceed.Wpf.ListBox.Themes.LiveExplorer;
-using Xceed.Wpf.ListBox.Themes.Metro;
-using Xceed.Wpf.ListBox.Themes.WMP11;
-using Xceed.Wpf.ListBox;
-#endif
using System.Windows.Controls.Primitives;
using System;
using Xceed.Wpf.Samples.SampleData;
@@ -38,177 +30,41 @@ using System.Windows.Threading;
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Theming.Views
{
-#if !OPEN_SOURCE
- public enum ThemesEnum
- {
- System,
- Office2007Blue,
- Office2007Black,
- Office2007Silver,
- Windows10,
- LiveExplorer,
- MetroDark,
- MetroLight,
- MediaPlayer
- }
-#endif
///
/// Interaction logic for ThemingListBoxView.xaml
///
public partial class ThemingListBoxView : DemoView
{
-#if !OPEN_SOURCE
- #region Members
- private Brush _accentBrush = new SolidColorBrush( System.Windows.Media.Color.FromRgb( 255, 152, 29 ) );
- private ThemesEnum _selectedTheme = ThemesEnum.System;
- private DispatcherTimer _dispatcherTimer;
- #endregion
-#endif
#region Initialization
public ThemingListBoxView()
{
-#if !OPEN_SOURCE
- this.DataContext = SampleDataProvider.GetOrders();
-#endif
InitializeComponent();
-#if !OPEN_SOURCE
- //Add the default GroupDescriptions to the ListBox's GroupDescriptions collection.
- _listBox.GroupDescriptions.Add( this.Resources[ "shipCountryGroupDescription" ] as GroupDescription );
- _listBox.GroupDescriptions.Add( this.Resources[ "shipCityGroupDescription" ] as GroupDescription );
-#endif
}
#endregion
-#if !OPEN_SOURCE
- #region EventHandlers
- private void ThemeComboBoxSelectionChanged( object sender, SelectionChangedEventArgs e )
- {
- ComboBox comboBox = sender as ComboBox;
- if( ( comboBox != null ) && ( _listBox != null ) )
- {
- _selectedTheme = ( ThemesEnum )((ComboBoxItem)comboBox.SelectedItem).Tag;
-
- // Use a DispatcherTimer to update the Theme on the ListBox
- // to avoid changing Theme very often.
- if( _dispatcherTimer == null )
- {
- _dispatcherTimer = new DispatcherTimer();
- _dispatcherTimer.Tick += new EventHandler( this.DispatcherTimer_Tick );
- _dispatcherTimer.Interval = System.TimeSpan.FromMilliseconds( 250d );
- }
-
- _dispatcherTimer.Start();
- }
- }
- private void RadioButton_Checked( object sender, RoutedEventArgs e )
- {
- RadioButton button = sender as RadioButton;
- if( button == null )
- return;
-
- _accentBrush = button.Background;
- if( _accentBrush == null )
- return;
-
- // Use a DispatcherTimer to update the Theme on the ListBox
- // to avoid changing Theme very often.
- if( _dispatcherTimer == null )
- {
- _dispatcherTimer = new DispatcherTimer();
- _dispatcherTimer.Tick += new EventHandler( this.DispatcherTimer_Tick );
- _dispatcherTimer.Interval = System.TimeSpan.FromMilliseconds( 250d );
- }
-
- _dispatcherTimer.Start();
- }
- private void DispatcherTimer_Tick( object sender, EventArgs e )
- {
- DispatcherTimer timer = sender as DispatcherTimer;
- // Make sure the timer is still active.
- if( timer == null || !timer.IsEnabled )
- return;
- timer.Stop();
- this.ChangeTheme();
- }
- #endregion
-#endif
-#if !OPEN_SOURCE
- private void ChangeTheme()
- {
- _listBox.Resources.MergedDictionaries.Clear();
-
- ThemeResourceDictionary themeResourceDictionary;
-
- switch( _selectedTheme )
- {
- case ThemesEnum.Office2007Blue:
- themeResourceDictionary = new Office2007BlueThemeResourceDictionary();
- this.InitTheme();
- break;
- case ThemesEnum.Office2007Black:
- themeResourceDictionary = new Office2007BlackThemeResourceDictionary();
- this.InitTheme();
- break;
- case ThemesEnum.Office2007Silver:
- themeResourceDictionary = new Office2007SilverThemeResourceDictionary();
- this.InitTheme();
- break;
- case ThemesEnum.Windows10:
- themeResourceDictionary = new Windows10ThemeResourceDictionary();
- this.InitTheme();
- break;
- case ThemesEnum.LiveExplorer:
- themeResourceDictionary = new LiveExplorerThemeResourceDictionary();
- this.InitTheme();
- break;
- case ThemesEnum.MetroDark:
- _accentColorPanel.Visibility = Visibility.Visible;
- MetroThemeResourceDictionaryBase metroDarkThemeResourceDictionary = new MetroDarkThemeResourceDictionary();
- metroDarkThemeResourceDictionary.AccentBrush = _accentBrush;
- themeResourceDictionary = metroDarkThemeResourceDictionary;
- break;
- case ThemesEnum.MetroLight:
- _accentColorPanel.Visibility = Visibility.Visible;
- MetroThemeResourceDictionaryBase metroLightThemeResourceDictionary = new MetroLightThemeResourceDictionary();
- metroLightThemeResourceDictionary.AccentBrush = _accentBrush;
- themeResourceDictionary = metroLightThemeResourceDictionary;
- break;
- case ThemesEnum.MediaPlayer:
- themeResourceDictionary = new WMP11ThemeResourceDictionary();
- this.InitTheme();
- break;
- default:
- _accentColorPanel.Visibility = Visibility.Hidden;
- themeResourceDictionary = null;
- break;
- }
-
- if( themeResourceDictionary != null )
- {
- _listBox.Resources.MergedDictionaries.Add( themeResourceDictionary );
- }
- }
- private void InitTheme()
- {
- _accentColorPanel.Visibility = Visibility.Hidden;
- _listBox.ItemTemplate = Resources[ "orderListBoxItemTemplate" ] as DataTemplate;
- }
-#endif
+
+
+
+
+
+
+
+
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.txt
index 4173ee68..5e1ba250 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ThemingListBoxView.xaml.txt
@@ -30,395 +30,29 @@
Supports implicit styles, so the entire listbox can be styled in minutes with a couple of lines of code. Also supports explicit styles and Expression Blend. Available themes are System, Office2007, LiveExplorer, MediaPlayer, Windows10 and Metro with accent color. The Xceed.Wpf.ListBox.Themes.xxx.dll assembly is necessary to use the themes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ShipCountry
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimelinePanelView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimelinePanelView.xaml.txt
index a697f2d3..f2ef0d32 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimelinePanelView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimelinePanelView.xaml.txt
@@ -26,7 +26,7 @@
TimelinePanel is a WPF panel at arranges it's children along a timeline. Items are placed along the timeline based on the Date attached property, which is set on each item.
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ToggleSwitchView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ToggleSwitchView.xaml.txt
index b8db00ec..83929a86 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ToggleSwitchView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/ToggleSwitchView.xaml.txt
@@ -27,7 +27,6 @@
The ToggleSwitch control is a fully customizable on/off switch that can be used to enhance the UI experience.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.cs.txt
index 9a0f9cac..350bfaa0 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.cs.txt
@@ -30,13 +30,6 @@ using System.Windows.Shapes;
using System.ComponentModel;
using System.Data;
using System.Collections.ObjectModel;
-#if !OPEN_SOURCE
-using Xceed.Wpf.Themes;
-using Xceed.Wpf.Toolkit.Themes.Office2007;
-using Xceed.Wpf.Toolkit.Themes.Metro;
-using Xceed.Wpf.Themes.Metro;
-using Xceed.Wpf.Samples.SampleData;
-#endif
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.TokenizedTextBox.Views
@@ -46,107 +39,25 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.TokenizedTextBox.Views
///
public partial class TokenizedTextBoxView : DemoView
{
-#if !OPEN_SOURCE
- #region Members
- private static ObservableCollection m_Records;
- #endregion
-#endif
public TokenizedTextBoxView()
{
-#if !OPEN_SOURCE
- InitDataSource();
- DataContext = this;
-#endif
InitializeComponent();
}
-#if !OPEN_SOURCE
- void InitDataSource()
- {
- NorthwindCollections northwind = new NorthwindCollections();
- m_Records = new ObservableCollection();
- foreach( var employee in northwind.Employees )
- {
- m_Records.Add( new Record( employee.FirstName, employee.LastName ) );
- }
- }
- public static ObservableCollection EmployeeList
- {
- get
- {
- return m_Records;
- }
- }
- private void OnDeleteToken( object sender, RoutedEventArgs e )
- {
- object item = ( ( FrameworkElement )e.OriginalSource ).DataContext;
- this.customTokenizedTextBox.SelectedItems.Remove( item );
- }
-#endif
}
-#if !OPEN_SOURCE
- public class Record : INotifyPropertyChanged
- {
- public Record()
- {
- }
- public Record( string pFirstName, string pLastName )
- {
- FirstName = pFirstName;
- LastName = pLastName;
- }
- private string m_firstName;
- public string FirstName
- {
- get
- {
- return m_firstName;
- }
- set
- {
- m_firstName = value;
- OnPropertyChanged( "FirstName" );
- }
- }
- private string m_lastName;
- public string LastName
- {
- get
- {
- return m_lastName;
- }
- set
- {
- m_lastName = value;
- OnPropertyChanged( "LastName" );
- }
- }
- #region INotifyPropertyChanged Members
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged( string name )
- {
- PropertyChangedEventHandler handler = PropertyChanged;
- if( handler != null )
- {
- handler( this, new PropertyChangedEventArgs( name ) );
- }
- }
- #endregion
- }
-#endif
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.txt
index 799ff705..fa70303c 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TokenizedTextBoxView.xaml.txt
@@ -26,7 +26,6 @@
The TokenizedTextBox lets you display a series of values as tokens. If an ItemsSource is specified, an AutoComplete popup will appear with a filtered list of valid values during edit.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WatermarkPasswordBoxView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WatermarkPasswordBoxView.xaml.txt
index 14a7891b..a83ffef7 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WatermarkPasswordBoxView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WatermarkPasswordBoxView.xaml.txt
@@ -65,7 +65,7 @@
-
+
@@ -76,7 +76,7 @@
Margin="5,5,25,5"
HorizontalAlignment="Left"
VerticalAlignment="Center" />
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.cs.txt
index 904cd585..50917e9b 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.cs.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.cs.txt
@@ -40,7 +40,6 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Views
{
InitializeComponent();
- //# Use translucent colors in the Available Colors Tab from ColorPicker
ObservableCollection alphaAvailableColors = new ObservableCollection();
foreach( ColorItem item in _modalBackgroundColorPicker.AvailableColors )
{
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.txt
index 0bc473db..468f3475 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WindowContainerView.xaml.txt
@@ -38,7 +38,7 @@
-
+
@@ -52,25 +52,25 @@
-
+
-
+
-
+
-
+
@@ -84,7 +84,7 @@
-
+
@@ -105,7 +105,7 @@
-
+
@@ -114,7 +114,7 @@
-
+
-
+
-
+
-
+
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WizardView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WizardView.xaml.txt
index e988b452..86cf30fd 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WizardView.xaml.txt
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/WizardView.xaml.txt
@@ -24,7 +24,7 @@
The Wizard will explain how to do something in a series of steps.
-
+
-
+
Plain Text
RTF
Xaml
+ Html
@@ -63,6 +64,10 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views
{
_richTextBox.TextFormatter = new XamlFormatter();
}
+ else if (object.Equals(TextFormatterEnum.Html, tagValue))
+ {
+ _richTextBox.TextFormatter = new HtmlFormatter();
+ }
}
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/CssStylesheet.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/CssStylesheet.cs
new file mode 100644
index 00000000..77b1ea48
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/CssStylesheet.cs
@@ -0,0 +1,255 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Xml;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ internal class CssStylesheet
+ {
+ private List _styleDefinitions;
+ // Constructor
+ public CssStylesheet(XmlElement htmlElement)
+ {
+ if (htmlElement != null)
+ {
+ DiscoverStyleDefinitions(htmlElement);
+ }
+ }
+
+ // Recursively traverses an html tree, discovers STYLE elements and creates a style definition table
+ // for further cascading style application
+ public void DiscoverStyleDefinitions(XmlElement htmlElement)
+ {
+ if (htmlElement.LocalName.ToLower() == "link")
+ {
+ return;
+ // Add LINK elements processing for included stylesheets
+ //
+ }
+
+ if (htmlElement.LocalName.ToLower() != "style")
+ {
+ // This is not a STYLE element. Recurse into it
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ if (htmlChildNode is XmlElement)
+ {
+ DiscoverStyleDefinitions((XmlElement) htmlChildNode);
+ }
+ }
+ return;
+ }
+
+ // Add style definitions from this style.
+
+ // Collect all text from this style definition
+ var stylesheetBuffer = new StringBuilder();
+
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ if (htmlChildNode is XmlText || htmlChildNode is XmlComment)
+ {
+ stylesheetBuffer.Append(RemoveComments(htmlChildNode.Value));
+ }
+ }
+
+ // CssStylesheet has the following syntactical structure:
+ // @import declaration;
+ // selector { definition }
+ // where "selector" is one of: ".classname", "tagname"
+ // It can contain comments in the following form: /*...*/
+
+ var nextCharacterIndex = 0;
+ while (nextCharacterIndex < stylesheetBuffer.Length)
+ {
+ // Extract selector
+ var selectorStart = nextCharacterIndex;
+ while (nextCharacterIndex < stylesheetBuffer.Length && stylesheetBuffer[nextCharacterIndex] != '{')
+ {
+ // Skip declaration directive starting from @
+ if (stylesheetBuffer[nextCharacterIndex] == '@')
+ {
+ while (nextCharacterIndex < stylesheetBuffer.Length &&
+ stylesheetBuffer[nextCharacterIndex] != ';')
+ {
+ nextCharacterIndex++;
+ }
+ selectorStart = nextCharacterIndex + 1;
+ }
+ nextCharacterIndex++;
+ }
+
+ if (nextCharacterIndex < stylesheetBuffer.Length)
+ {
+ // Extract definition
+ var definitionStart = nextCharacterIndex;
+ while (nextCharacterIndex < stylesheetBuffer.Length && stylesheetBuffer[nextCharacterIndex] != '}')
+ {
+ nextCharacterIndex++;
+ }
+
+ // Define a style
+ if (nextCharacterIndex - definitionStart > 2)
+ {
+ AddStyleDefinition(
+ stylesheetBuffer.ToString(selectorStart, definitionStart - selectorStart),
+ stylesheetBuffer.ToString(definitionStart + 1, nextCharacterIndex - definitionStart - 2));
+ }
+
+ // Skip closing brace
+ if (nextCharacterIndex < stylesheetBuffer.Length)
+ {
+ Debug.Assert(stylesheetBuffer[nextCharacterIndex] == '}');
+ nextCharacterIndex++;
+ }
+ }
+ }
+ }
+
+ // Returns a string with all c-style comments replaced by spaces
+ private string RemoveComments(string text)
+ {
+ var commentStart = text.IndexOf("/*", StringComparison.Ordinal);
+ if (commentStart < 0)
+ {
+ return text;
+ }
+
+ var commentEnd = text.IndexOf("*/", commentStart + 2, StringComparison.Ordinal);
+ if (commentEnd < 0)
+ {
+ return text.Substring(0, commentStart);
+ }
+
+ return text.Substring(0, commentStart) + " " + RemoveComments(text.Substring(commentEnd + 2));
+ }
+
+ public void AddStyleDefinition(string selector, string definition)
+ {
+ // Notrmalize parameter values
+ selector = selector.Trim().ToLower();
+ definition = definition.Trim().ToLower();
+ if (selector.Length == 0 || definition.Length == 0)
+ {
+ return;
+ }
+
+ if (_styleDefinitions == null)
+ {
+ _styleDefinitions = new List();
+ }
+
+ var simpleSelectors = selector.Split(',');
+
+ foreach (string t in simpleSelectors)
+ {
+ var simpleSelector = t.Trim();
+ if (simpleSelector.Length > 0)
+ {
+ _styleDefinitions.Add(new StyleDefinition(simpleSelector, definition));
+ }
+ }
+ }
+
+ public string GetStyle(string elementName, List sourceContext)
+ {
+ Debug.Assert(sourceContext.Count > 0);
+ Debug.Assert(elementName == sourceContext[sourceContext.Count - 1].LocalName);
+
+ // Add id processing for style selectors
+ if (_styleDefinitions != null)
+ {
+ for (var i = _styleDefinitions.Count - 1; i >= 0; i--)
+ {
+ var selector = _styleDefinitions[i].Selector;
+
+ var selectorLevels = selector.Split(' ');
+
+ var indexInSelector = selectorLevels.Length - 1;
+ var indexInContext = sourceContext.Count - 1;
+ var selectorLevel = selectorLevels[indexInSelector].Trim();
+
+ if (MatchSelectorLevel(selectorLevel, sourceContext[sourceContext.Count - 1]))
+ {
+ return _styleDefinitions[i].Definition;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private bool MatchSelectorLevel(string selectorLevel, XmlElement xmlElement)
+ {
+ if (selectorLevel.Length == 0)
+ {
+ return false;
+ }
+
+ var indexOfDot = selectorLevel.IndexOf('.');
+ var indexOfPound = selectorLevel.IndexOf('#');
+
+ string selectorClass = null;
+ string selectorId = null;
+ string selectorTag = null;
+ if (indexOfDot >= 0)
+ {
+ if (indexOfDot > 0)
+ {
+ selectorTag = selectorLevel.Substring(0, indexOfDot);
+ }
+ selectorClass = selectorLevel.Substring(indexOfDot + 1);
+ }
+ else if (indexOfPound >= 0)
+ {
+ if (indexOfPound > 0)
+ {
+ selectorTag = selectorLevel.Substring(0, indexOfPound);
+ }
+ selectorId = selectorLevel.Substring(indexOfPound + 1);
+ }
+ else
+ {
+ selectorTag = selectorLevel;
+ }
+
+ if (selectorTag != null && selectorTag != xmlElement.LocalName)
+ {
+ return false;
+ }
+
+ if (selectorId != null && HtmlToXamlConverter.GetAttribute(xmlElement, "id") != selectorId)
+ {
+ return false;
+ }
+
+ if (selectorClass != null && HtmlToXamlConverter.GetAttribute(xmlElement, "class") != selectorClass)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private class StyleDefinition
+ {
+ public readonly string Definition;
+ public readonly string Selector;
+
+ public StyleDefinition(string selector, string definition)
+ {
+ Selector = selector;
+ Definition = definition;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlCSSParser.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlCSSParser.cs
new file mode 100644
index 00000000..1712c1e5
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlCSSParser.cs
@@ -0,0 +1,844 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Xml;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ // DependencyProperty
+
+ // TextElement
+
+ internal static class HtmlCssParser
+ {
+ private static readonly string[] Colors =
+ {
+ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond",
+ "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral",
+ "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray",
+ "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred",
+ "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink",
+ "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro",
+ "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew", "hotpink", "indianred",
+ "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue",
+ "lightcoral",
+ "lightcyan", "lightgoldenrodyellow", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen",
+ "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
+ "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen",
+ "mediumslateblue",
+ "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose",
+ "moccasin",
+ "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod",
+ "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum",
+ "powderblue",
+ "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell",
+ "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal",
+ "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"
+ };
+
+ private static readonly string[] SystemColors =
+ {
+ "activeborder", "activecaption", "appworkspace", "background", "buttonface", "buttonhighlight",
+ "buttonshadow",
+ "buttontext", "captiontext", "graytext", "highlight", "highlighttext", "inactiveborder", "inactivecaption",
+ "inactivecaptiontext", "infobackground", "infotext", "menu", "menutext", "scrollbar", "threeddarkshadow",
+ "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "window", "windowframe", "windowtext"
+ };
+
+ // .................................................................
+ //
+ // Pasring CSS font Property
+ //
+ // .................................................................
+
+ // CSS has five font properties: font-family, font-style, font-variant, font-weight, font-size.
+ // An aggregated "font" property lets you specify in one action all the five in combination
+ // with additional line-height property.
+ //
+ // font-family: [,]* [ | ]
+ // generic-family: serif | sans-serif | monospace | cursive | fantasy
+ // The list of families sets priorities to choose fonts;
+ // Quotes not allowed around generic-family names
+ // font-style: normal | italic | oblique
+ // font-variant: normal | small-caps
+ // font-weight: normal | bold | bolder | lighter | 100 ... 900 |
+ // Default is "normal", normal==400
+ // font-size: | | |
+ // absolute-size: xx-small | x-small | small | medium | large | x-large | xx-large
+ // relative-size: larger | smaller
+ // length: | | | | | | |
+ // Default: medium
+ // font: [ || || [ / ]?
+
+ private static readonly string[] FontGenericFamilies =
+ {
+ "serif", "sans-serif", "monospace", "cursive", "fantasy"
+ };
+
+ private static readonly string[] FontStyles = {"normal", "italic", "oblique"};
+ private static readonly string[] FontVariants = {"normal", "small-caps"};
+
+ private static readonly string[] FontWeights =
+ {
+ "normal", "bold", "bolder", "lighter", "100", "200", "300",
+ "400", "500", "600", "700", "800", "900"
+ };
+
+ private static readonly string[] FontAbsoluteSizes =
+ {
+ "xx-small", "x-small", "small", "medium", "large",
+ "x-large", "xx-large"
+ };
+
+ private static readonly string[] FontRelativeSizes = {"larger", "smaller"};
+
+ private static readonly string[] FontSizeUnits = {"px", "mm", "cm", "in", "pt", "pc", "em", "ex", "%"};
+
+ // .................................................................
+ //
+ // Pasring CSS list-style Property
+ //
+ // .................................................................
+
+ // list-style: [ || || ]
+
+ private static readonly string[] ListStyleTypes =
+ {
+ "disc", "circle", "square", "decimal", "lower-roman",
+ "upper-roman", "lower-alpha", "upper-alpha", "none"
+ };
+
+ private static readonly string[] ListStylePositions = {"inside", "outside"};
+ // .................................................................
+ //
+ // Pasring CSS text-decorations Property
+ //
+ // .................................................................
+
+ private static readonly string[] TextDecorations = {"none", "underline", "overline", "line-through", "blink"};
+
+ // .................................................................
+ //
+ // Pasring CSS text-transform Property
+ //
+ // .................................................................
+
+ private static readonly string[] TextTransforms = {"none", "capitalize", "uppercase", "lowercase"};
+ // .................................................................
+ //
+ // Pasring CSS text-align Property
+ //
+ // .................................................................
+
+ private static readonly string[] TextAligns = {"left", "right", "center", "justify"};
+ // .................................................................
+ //
+ // Pasring CSS vertical-align Property
+ //
+ // .................................................................
+
+ private static readonly string[] VerticalAligns =
+ {
+ "baseline", "sub", "super", "top", "text-top", "middle",
+ "bottom", "text-bottom"
+ };
+
+ // .................................................................
+ //
+ // Pasring CSS float Property
+ //
+ // .................................................................
+
+ private static readonly string[] Floats = {"left", "right", "none"};
+ // .................................................................
+ //
+ // Pasring CSS clear Property
+ //
+ // .................................................................
+
+ private static readonly string[] Clears = {"none", "left", "right", "both"};
+ // .................................................................
+ //
+ // Pasring CSS border-style Propertie
+ //
+ // .................................................................
+
+ private static readonly string[] BorderStyles =
+ {
+ "none", "dotted", "dashed", "solid", "double", "groove",
+ "ridge", "inset", "outset"
+ };
+
+ // .................................................................
+ //
+ // What are these definitions doing here:
+ //
+ // .................................................................
+
+ private static string[] _blocks = {"block", "inline", "list-item", "none"};
+ // .................................................................
+ //
+ // Processing CSS Attributes
+ //
+ // .................................................................
+
+ internal static void GetElementPropertiesFromCssAttributes(XmlElement htmlElement, string elementName,
+ CssStylesheet stylesheet, Hashtable localProperties, List sourceContext)
+ {
+ var styleFromStylesheet = stylesheet.GetStyle(elementName, sourceContext);
+
+ var styleInline = HtmlToXamlConverter.GetAttribute(htmlElement, "style");
+
+ // Combine styles from stylesheet and from inline attribute.
+ // The order is important - the latter styles will override the former.
+ var style = styleFromStylesheet ?? null;
+ if (styleInline != null)
+ {
+ style = style == null ? styleInline : (style + ";" + styleInline);
+ }
+
+ // Apply local style to current formatting properties
+ if (style != null)
+ {
+ var styleValues = style.Split(';');
+ foreach (string t in styleValues)
+ {
+ string[] styleNameValue;
+
+ styleNameValue = t.Split(':');
+ if (styleNameValue.Length == 2)
+ {
+ var styleName = styleNameValue[0].Trim().ToLower();
+ var styleValue = HtmlToXamlConverter.UnQuote(styleNameValue[1].Trim()).ToLower();
+ var nextIndex = 0;
+
+ switch (styleName)
+ {
+ case "font":
+ ParseCssFont(styleValue, localProperties);
+ break;
+ case "font-family":
+ ParseCssFontFamily(styleValue, ref nextIndex, localProperties);
+ break;
+ case "font-size":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, "font-size",
+ /*mustBeNonNegative:*/true);
+ break;
+ case "font-style":
+ ParseCssFontStyle(styleValue, ref nextIndex, localProperties);
+ break;
+ case "font-weight":
+ ParseCssFontWeight(styleValue, ref nextIndex, localProperties);
+ break;
+ case "font-variant":
+ ParseCssFontVariant(styleValue, ref nextIndex, localProperties);
+ break;
+ case "line-height":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, "line-height",
+ /*mustBeNonNegative:*/true);
+ break;
+ case "word-spacing":
+ // Implement word-spacing conversion
+ break;
+ case "letter-spacing":
+ // Implement letter-spacing conversion
+ break;
+ case "color":
+ ParseCssColor(styleValue, ref nextIndex, localProperties, "color");
+ break;
+
+ case "text-decoration":
+ ParseCssTextDecoration(styleValue, ref nextIndex, localProperties);
+ break;
+
+ case "text-transform":
+ ParseCssTextTransform(styleValue, ref nextIndex, localProperties);
+ break;
+
+ case "background-color":
+ ParseCssColor(styleValue, ref nextIndex, localProperties, "background-color");
+ break;
+ case "background":
+ // TODO: need to parse composite background property
+ ParseCssBackground(styleValue, ref nextIndex, localProperties);
+ break;
+
+ case "text-align":
+ ParseCssTextAlign(styleValue, ref nextIndex, localProperties);
+ break;
+ case "vertical-align":
+ ParseCssVerticalAlign(styleValue, ref nextIndex, localProperties);
+ break;
+ case "text-indent":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, "text-indent",
+ /*mustBeNonNegative:*/false);
+ break;
+
+ case "width":
+ case "height":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, styleName,
+ /*mustBeNonNegative:*/true);
+ break;
+
+ case "margin": // top/right/bottom/left
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, styleName);
+ break;
+ case "margin-top":
+ case "margin-right":
+ case "margin-bottom":
+ case "margin-left":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, styleName,
+ /*mustBeNonNegative:*/true);
+ break;
+
+ case "padding":
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, styleName);
+ break;
+ case "padding-top":
+ case "padding-right":
+ case "padding-bottom":
+ case "padding-left":
+ ParseCssSize(styleValue, ref nextIndex, localProperties, styleName,
+ /*mustBeNonNegative:*/true);
+ break;
+
+ case "border":
+ ParseCssBorder(styleValue, ref nextIndex, localProperties);
+ break;
+ case "border-style":
+ case "border-width":
+ case "border-color":
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, styleName);
+ break;
+ case "border-top":
+ case "border-right":
+ case "border-left":
+ case "border-bottom":
+ // Parse css border style
+ break;
+
+ // NOTE: css names for elementary border styles have side indications in the middle (top/bottom/left/right)
+ // In our internal notation we intentionally put them at the end - to unify processing in ParseCssRectangleProperty method
+ case "border-top-style":
+ case "border-right-style":
+ case "border-left-style":
+ case "border-bottom-style":
+ case "border-top-color":
+ case "border-right-color":
+ case "border-left-color":
+ case "border-bottom-color":
+ case "border-top-width":
+ case "border-right-width":
+ case "border-left-width":
+ case "border-bottom-width":
+ // Parse css border style
+ break;
+
+ case "display":
+ // Implement display style conversion
+ break;
+
+ case "float":
+ ParseCssFloat(styleValue, ref nextIndex, localProperties);
+ break;
+ case "clear":
+ ParseCssClear(styleValue, ref nextIndex, localProperties);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // .................................................................
+ //
+ // Parsing CSS - Lexical Helpers
+ //
+ // .................................................................
+
+ // Skips whitespaces in style values
+ private static void ParseWhiteSpace(string styleValue, ref int nextIndex)
+ {
+ while (nextIndex < styleValue.Length && char.IsWhiteSpace(styleValue[nextIndex]))
+ {
+ nextIndex++;
+ }
+ }
+
+ // Checks if the following character matches to a given word and advances nextIndex
+ // by the word's length in case of success.
+ // Otherwise leaves nextIndex in place (except for possible whitespaces).
+ // Returns true or false depending on success or failure of matching.
+ private static bool ParseWord(string word, string styleValue, ref int nextIndex)
+ {
+ ParseWhiteSpace(styleValue, ref nextIndex);
+
+ for (var i = 0; i < word.Length; i++)
+ {
+ if (!(nextIndex + i < styleValue.Length && word[i] == styleValue[nextIndex + i]))
+ {
+ return false;
+ }
+ }
+
+ if (nextIndex + word.Length < styleValue.Length && char.IsLetterOrDigit(styleValue[nextIndex + word.Length]))
+ {
+ return false;
+ }
+
+ nextIndex += word.Length;
+ return true;
+ }
+
+ // CHecks whether the following character sequence matches to one of the given words,
+ // and advances the nextIndex to matched word length.
+ // Returns null in case if there is no match or the word matched.
+ private static string ParseWordEnumeration(string[] words, string styleValue, ref int nextIndex)
+ {
+ foreach (string t in words)
+ {
+ if (ParseWord(t, styleValue, ref nextIndex))
+ {
+ return t;
+ }
+ }
+
+ return null;
+ }
+
+ private static void ParseWordEnumeration(string[] words, string styleValue, ref int nextIndex,
+ Hashtable localProperties, string attributeName)
+ {
+ var attributeValue = ParseWordEnumeration(words, styleValue, ref nextIndex);
+ if (attributeValue != null)
+ {
+ localProperties[attributeName] = attributeValue;
+ }
+ }
+
+ private static string ParseCssSize(string styleValue, ref int nextIndex, bool mustBeNonNegative)
+ {
+ ParseWhiteSpace(styleValue, ref nextIndex);
+
+ var startIndex = nextIndex;
+
+ // Parse optional munis sign
+ if (nextIndex < styleValue.Length && styleValue[nextIndex] == '-')
+ {
+ nextIndex++;
+ }
+
+ if (nextIndex < styleValue.Length && char.IsDigit(styleValue[nextIndex]))
+ {
+ while (nextIndex < styleValue.Length &&
+ (char.IsDigit(styleValue[nextIndex]) || styleValue[nextIndex] == '.'))
+ {
+ nextIndex++;
+ }
+
+ var number = styleValue.Substring(startIndex, nextIndex - startIndex);
+
+ var unit = ParseWordEnumeration(FontSizeUnits, styleValue, ref nextIndex) ?? "px";
+
+ if (mustBeNonNegative && styleValue[startIndex] == '-')
+ {
+ return "0";
+ }
+ return number + unit;
+ }
+
+ return null;
+ }
+
+ private static void ParseCssSize(string styleValue, ref int nextIndex, Hashtable localValues,
+ string propertyName,
+ bool mustBeNonNegative)
+ {
+ var length = ParseCssSize(styleValue, ref nextIndex, mustBeNonNegative);
+ if (length != null)
+ {
+ localValues[propertyName] = length;
+ }
+ }
+
+ private static string ParseCssColor(string styleValue, ref int nextIndex)
+ {
+ // Implement color parsing
+ // rgb(100%,53.5%,10%)
+ // rgb(255,91,26)
+ // #FF5B1A
+ // black | silver | gray | ... | aqua
+ // transparent - for background-color
+ ParseWhiteSpace(styleValue, ref nextIndex);
+
+ string color = null;
+
+ if (nextIndex < styleValue.Length)
+ {
+ var startIndex = nextIndex;
+ var character = styleValue[nextIndex];
+
+ if (character == '#')
+ {
+ nextIndex++;
+ while (nextIndex < styleValue.Length)
+ {
+ character = char.ToUpper(styleValue[nextIndex]);
+ if (!('0' <= character && character <= '9' || 'A' <= character && character <= 'F'))
+ {
+ break;
+ }
+ nextIndex++;
+ }
+ if (nextIndex > startIndex + 1)
+ {
+ color = styleValue.Substring(startIndex, nextIndex - startIndex);
+ }
+ }
+ else if (styleValue.Substring(nextIndex, 3).ToLower() == "rbg")
+ {
+ // Implement real rgb() color parsing
+ while (nextIndex < styleValue.Length && styleValue[nextIndex] != ')')
+ {
+ nextIndex++;
+ }
+ if (nextIndex < styleValue.Length)
+ {
+ nextIndex++; // to skip ')'
+ }
+ color = "gray"; // return bogus color
+ }
+ else if (char.IsLetter(character))
+ {
+ color = ParseWordEnumeration(Colors, styleValue, ref nextIndex);
+ if (color == null)
+ {
+ color = ParseWordEnumeration(SystemColors, styleValue, ref nextIndex);
+ if (color != null)
+ {
+ // Implement smarter system color converions into real colors
+ color = "black";
+ }
+ }
+ }
+ }
+
+ return color;
+ }
+
+ private static void ParseCssColor(string styleValue, ref int nextIndex, Hashtable localValues,
+ string propertyName)
+ {
+ var color = ParseCssColor(styleValue, ref nextIndex);
+ if (color != null)
+ {
+ localValues[propertyName] = color;
+ }
+ }
+
+ // Parses CSS string fontStyle representing a value for css font attribute
+ private static void ParseCssFont(string styleValue, Hashtable localProperties)
+ {
+ var nextIndex = 0;
+
+ ParseCssFontStyle(styleValue, ref nextIndex, localProperties);
+ ParseCssFontVariant(styleValue, ref nextIndex, localProperties);
+ ParseCssFontWeight(styleValue, ref nextIndex, localProperties);
+
+ ParseCssSize(styleValue, ref nextIndex, localProperties, "font-size", /*mustBeNonNegative:*/true);
+
+ ParseWhiteSpace(styleValue, ref nextIndex);
+ if (nextIndex < styleValue.Length && styleValue[nextIndex] == '/')
+ {
+ nextIndex++;
+ ParseCssSize(styleValue, ref nextIndex, localProperties, "line-height", /*mustBeNonNegative:*/true);
+ }
+
+ ParseCssFontFamily(styleValue, ref nextIndex, localProperties);
+ }
+
+ private static void ParseCssFontStyle(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(FontStyles, styleValue, ref nextIndex, localProperties, "font-style");
+ }
+
+ private static void ParseCssFontVariant(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(FontVariants, styleValue, ref nextIndex, localProperties, "font-variant");
+ }
+
+ private static void ParseCssFontWeight(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(FontWeights, styleValue, ref nextIndex, localProperties, "font-weight");
+ }
+
+ private static void ParseCssFontFamily(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ string fontFamilyList = null;
+
+ while (nextIndex < styleValue.Length)
+ {
+ // Try generic-family
+ var fontFamily = ParseWordEnumeration(FontGenericFamilies, styleValue, ref nextIndex);
+
+ if (fontFamily == null)
+ {
+ // Try quoted font family name
+ if (nextIndex < styleValue.Length && (styleValue[nextIndex] == '"' || styleValue[nextIndex] == '\''))
+ {
+ var quote = styleValue[nextIndex];
+
+ nextIndex++;
+
+ var startIndex = nextIndex;
+
+ while (nextIndex < styleValue.Length && styleValue[nextIndex] != quote)
+ {
+ nextIndex++;
+ }
+
+ fontFamily = '"' + styleValue.Substring(startIndex, nextIndex - startIndex) + '"';
+ }
+
+ if (fontFamily == null)
+ {
+ // Try unquoted font family name
+ var startIndex = nextIndex;
+ while (nextIndex < styleValue.Length && styleValue[nextIndex] != ',' &&
+ styleValue[nextIndex] != ';')
+ {
+ nextIndex++;
+ }
+
+ if (nextIndex > startIndex)
+ {
+ fontFamily = styleValue.Substring(startIndex, nextIndex - startIndex).Trim();
+ if (fontFamily.Length == 0)
+ {
+ fontFamily = null;
+ }
+ }
+ }
+ }
+
+ ParseWhiteSpace(styleValue, ref nextIndex);
+ if (nextIndex < styleValue.Length && styleValue[nextIndex] == ',')
+ {
+ nextIndex++;
+ }
+
+ if (fontFamily != null)
+ {
+ // css font-family can contein a list of names. We only consider the first name from the list. Need a decision what to do with remaining names
+ // fontFamilyList = (fontFamilyList == null) ? fontFamily : fontFamilyList + "," + fontFamily;
+ if (fontFamilyList == null && fontFamily.Length > 0)
+ {
+ if (fontFamily[0] == '"' || fontFamily[0] == '\'')
+ {
+ // Unquote the font family name
+ fontFamily = fontFamily.Substring(1, fontFamily.Length - 2);
+ }
+ fontFamilyList = fontFamily;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (fontFamilyList != null)
+ {
+ localProperties["font-family"] = fontFamilyList;
+ }
+ }
+
+ private static void ParseCssListStyle(string styleValue, Hashtable localProperties)
+ {
+ var nextIndex = 0;
+
+ while (nextIndex < styleValue.Length)
+ {
+ var listStyleType = ParseCssListStyleType(styleValue, ref nextIndex);
+ if (listStyleType != null)
+ {
+ localProperties["list-style-type"] = listStyleType;
+ }
+ else
+ {
+ var listStylePosition = ParseCssListStylePosition(styleValue, ref nextIndex);
+ if (listStylePosition != null)
+ {
+ localProperties["list-style-position"] = listStylePosition;
+ }
+ else
+ {
+ var listStyleImage = ParseCssListStyleImage(styleValue, ref nextIndex);
+ if (listStyleImage != null)
+ {
+ localProperties["list-style-image"] = listStyleImage;
+ }
+ else
+ {
+ // TODO: Process unrecognized list style value
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private static string ParseCssListStyleType(string styleValue, ref int nextIndex) => ParseWordEnumeration(ListStyleTypes, styleValue, ref nextIndex);
+
+ private static string ParseCssListStylePosition(string styleValue, ref int nextIndex) => ParseWordEnumeration(ListStylePositions, styleValue, ref nextIndex);
+
+ private static string ParseCssListStyleImage(string styleValue, ref int nextIndex) => null;
+
+ private static void ParseCssTextDecoration(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ // Set default text-decorations:none;
+ for (var i = 1; i < TextDecorations.Length; i++)
+ {
+ localProperties["text-decoration-" + TextDecorations[i]] = "false";
+ }
+
+ // Parse list of decorations values
+ while (nextIndex < styleValue.Length)
+ {
+ var decoration = ParseWordEnumeration(TextDecorations, styleValue, ref nextIndex);
+ if (decoration == null || decoration == "none")
+ {
+ break;
+ }
+ localProperties["text-decoration-" + decoration] = "true";
+ }
+ }
+
+ private static void ParseCssTextTransform(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(TextTransforms, styleValue, ref nextIndex, localProperties, "text-transform");
+ }
+
+ private static void ParseCssTextAlign(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(TextAligns, styleValue, ref nextIndex, localProperties, "text-align");
+ }
+
+ private static void ParseCssVerticalAlign(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ // Parse percentage value for vertical-align style
+ ParseWordEnumeration(VerticalAligns, styleValue, ref nextIndex, localProperties, "vertical-align");
+ }
+
+ private static void ParseCssFloat(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(Floats, styleValue, ref nextIndex, localProperties, "float");
+ }
+
+ private static void ParseCssClear(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ ParseWordEnumeration(Clears, styleValue, ref nextIndex, localProperties, "clear");
+ }
+
+ // .................................................................
+ //
+ // Pasring CSS margin and padding Properties
+ //
+ // .................................................................
+
+ // Generic method for parsing any of four-values properties, such as margin, padding, border-width, border-style, border-color
+ private static bool ParseCssRectangleProperty(string styleValue, ref int nextIndex, Hashtable localProperties,
+ string propertyName)
+ {
+ // CSS Spec:
+ // If only one value is set, then the value applies to all four sides;
+ // If two or three values are set, then missinng value(s) are taken fromm the opposite side(s).
+ // The order they are applied is: top/right/bottom/left
+
+ Debug.Assert(propertyName == "margin" || propertyName == "padding" || propertyName == "border-width" ||
+ propertyName == "border-style" || propertyName == "border-color");
+
+ var value = propertyName == "border-color"
+ ? ParseCssColor(styleValue, ref nextIndex)
+ : propertyName == "border-style"
+ ? ParseCssBorderStyle(styleValue, ref nextIndex)
+ : ParseCssSize(styleValue, ref nextIndex, /*mustBeNonNegative:*/true);
+ if (value != null)
+ {
+ localProperties[propertyName + "-top"] = value;
+ localProperties[propertyName + "-bottom"] = value;
+ localProperties[propertyName + "-right"] = value;
+ localProperties[propertyName + "-left"] = value;
+ value = propertyName == "border-color"
+ ? ParseCssColor(styleValue, ref nextIndex)
+ : propertyName == "border-style"
+ ? ParseCssBorderStyle(styleValue, ref nextIndex)
+ : ParseCssSize(styleValue, ref nextIndex, /*mustBeNonNegative:*/true);
+ if (value != null)
+ {
+ localProperties[propertyName + "-right"] = value;
+ localProperties[propertyName + "-left"] = value;
+ value = propertyName == "border-color"
+ ? ParseCssColor(styleValue, ref nextIndex)
+ : propertyName == "border-style"
+ ? ParseCssBorderStyle(styleValue, ref nextIndex)
+ : ParseCssSize(styleValue, ref nextIndex, /*mustBeNonNegative:*/true);
+ if (value != null)
+ {
+ localProperties[propertyName + "-bottom"] = value;
+ value = propertyName == "border-color"
+ ? ParseCssColor(styleValue, ref nextIndex)
+ : propertyName == "border-style"
+ ? ParseCssBorderStyle(styleValue, ref nextIndex)
+ : ParseCssSize(styleValue, ref nextIndex, /*mustBeNonNegative:*/true);
+ if (value != null)
+ {
+ localProperties[propertyName + "-left"] = value;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ // .................................................................
+ //
+ // Pasring CSS border Properties
+ //
+ // .................................................................
+
+ // border: [ || || ]
+
+ private static void ParseCssBorder(string styleValue, ref int nextIndex, Hashtable localProperties)
+ {
+ while (
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, "border-width") ||
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, "border-style") ||
+ ParseCssRectangleProperty(styleValue, ref nextIndex, localProperties, "border-color"))
+ {
+ }
+ }
+
+ private static string ParseCssBorderStyle(string styleValue, ref int nextIndex) => ParseWordEnumeration(BorderStyles, styleValue, ref nextIndex);
+
+ // .................................................................
+ //
+ // Pasring CSS Background Properties
+ //
+ // .................................................................
+
+ private static void ParseCssBackground(string styleValue, ref int nextIndex, Hashtable localValues)
+ {
+ // Implement parsing background attribute
+ }
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlFromXamlConverter.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlFromXamlConverter.cs
new file mode 100644
index 00000000..9ea817d6
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlFromXamlConverter.cs
@@ -0,0 +1,578 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ ///
+ /// HtmlToXamlConverter is a static class that takes an HTML string
+ /// and converts it into XAML
+ ///
+ internal static class HtmlFromXamlConverter
+ {
+ // ---------------------------------------------------------------------
+ //
+ // Internal Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Methods
+
+ ///
+ /// Main entry point for Xaml-to-Html converter.
+ /// Converts a xaml string into html string.
+ ///
+ ///
+ /// Xaml strinng to convert.
+ ///
+ ///
+ /// Html string produced from a source xaml.
+ ///
+ internal static string ConvertXamlToHtml(string xamlString)
+ {
+ XmlTextReader xamlReader;
+ StringBuilder htmlStringBuilder;
+ XmlTextWriter htmlWriter;
+
+ xamlReader = new XmlTextReader(new StringReader(xamlString));
+
+ htmlStringBuilder = new StringBuilder(100);
+ htmlWriter = new XmlTextWriter(new StringWriter(htmlStringBuilder));
+
+ if (!WriteFlowDocument(xamlReader, htmlWriter))
+ {
+ return "";
+ }
+
+ var htmlString = htmlStringBuilder.ToString();
+
+ return htmlString;
+ }
+
+ #endregion Internal Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Methods
+
+ ///
+ /// Processes a root level element of XAML (normally it's FlowDocument element).
+ ///
+ ///
+ /// XmlTextReader for a source xaml.
+ ///
+ ///
+ /// XmlTextWriter producing resulting html
+ ///
+ private static bool WriteFlowDocument(XmlTextReader xamlReader, XmlTextWriter htmlWriter)
+ {
+ if (!ReadNextToken(xamlReader))
+ {
+ // Xaml content is empty - nothing to convert
+ return false;
+ }
+
+ if (xamlReader.NodeType != XmlNodeType.Element || xamlReader.Name != "FlowDocument")
+ {
+ // Root FlowDocument elemet is missing
+ return false;
+ }
+
+ // Create a buffer StringBuilder for collecting css properties for inline STYLE attributes
+ // on every element level (it will be re-initialized on every level).
+ var inlineStyle = new StringBuilder();
+
+ htmlWriter.WriteStartElement("html");
+ htmlWriter.WriteStartElement("body");
+
+ WriteFormattingProperties(xamlReader, htmlWriter, inlineStyle);
+
+ WriteElementContent(xamlReader, htmlWriter, inlineStyle);
+
+ htmlWriter.WriteEndElement();
+ htmlWriter.WriteEndElement();
+
+ return true;
+ }
+
+ ///
+ /// Reads attributes of the current xaml element and converts
+ /// them into appropriate html attributes or css styles.
+ ///
+ ///
+ /// XmlTextReader which is expected to be at XmlNodeType.Element
+ /// (opening element tag) position.
+ /// The reader will remain at the same level after function complete.
+ ///
+ ///
+ /// XmlTextWriter for output html, which is expected to be in
+ /// after WriteStartElement state.
+ ///
+ ///
+ /// String builder for collecting css properties for inline STYLE attribute.
+ ///
+ private static void WriteFormattingProperties(XmlTextReader xamlReader, XmlTextWriter htmlWriter,
+ StringBuilder inlineStyle)
+ {
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);
+
+ // Clear string builder for the inline style
+ inlineStyle.Remove(0, inlineStyle.Length);
+
+ if (!xamlReader.HasAttributes)
+ {
+ return;
+ }
+
+ var borderSet = false;
+
+ while (xamlReader.MoveToNextAttribute())
+ {
+ string css = null;
+
+ switch (xamlReader.Name)
+ {
+ // Character fomatting properties
+ // ------------------------------
+ case "Background":
+ css = "background-color:" + ParseXamlColor(xamlReader.Value) + ";";
+ break;
+ case "FontFamily":
+ css = "font-family:" + xamlReader.Value + ";";
+ break;
+ case "FontStyle":
+ css = "font-style:" + xamlReader.Value.ToLower() + ";";
+ break;
+ case "FontWeight":
+ css = "font-weight:" + xamlReader.Value.ToLower() + ";";
+ break;
+ case "FontStretch":
+ break;
+ case "FontSize":
+ css = "font-size:" + xamlReader.Value + ";";
+ break;
+ case "Foreground":
+ css = "color:" + ParseXamlColor(xamlReader.Value) + ";";
+ break;
+ case "TextDecorations":
+ css = "text-decoration:underline;";
+ break;
+ case "TextEffects":
+ break;
+ case "Emphasis":
+ break;
+ case "StandardLigatures":
+ break;
+ case "Variants":
+ break;
+ case "Capitals":
+ break;
+ case "Fraction":
+ break;
+
+ // Paragraph formatting properties
+ // -------------------------------
+ case "Padding":
+ css = "padding:" + ParseXamlThickness(xamlReader.Value) + ";";
+ break;
+ case "Margin":
+ css = "margin:" + ParseXamlThickness(xamlReader.Value) + ";";
+ break;
+ case "BorderThickness":
+ css = "border-width:" + ParseXamlThickness(xamlReader.Value) + ";";
+ borderSet = true;
+ break;
+ case "BorderBrush":
+ css = "border-color:" + ParseXamlColor(xamlReader.Value) + ";";
+ borderSet = true;
+ break;
+ case "LineHeight":
+ break;
+ case "TextIndent":
+ css = "text-indent:" + xamlReader.Value + ";";
+ break;
+ case "TextAlignment":
+ css = "text-align:" + xamlReader.Value + ";";
+ break;
+ case "IsKeptTogether":
+ break;
+ case "IsKeptWithNext":
+ break;
+ case "ColumnBreakBefore":
+ break;
+ case "PageBreakBefore":
+ break;
+ case "FlowDirection":
+ break;
+
+ // Table attributes
+ // ----------------
+ case "Width":
+ css = "width:" + xamlReader.Value + ";";
+ break;
+ case "ColumnSpan":
+ htmlWriter.WriteAttributeString("colspan", xamlReader.Value);
+ break;
+ case "RowSpan":
+ htmlWriter.WriteAttributeString("rowspan", xamlReader.Value);
+ break;
+ }
+
+ if (css != null)
+ {
+ inlineStyle.Append(css);
+ }
+ }
+
+ if (borderSet)
+ {
+ inlineStyle.Append("border-style:solid;mso-element:para-border-div;");
+ }
+
+ // Return the xamlReader back to element level
+ xamlReader.MoveToElement();
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);
+ }
+
+ private static string ParseXamlColor(string color)
+ {
+ if (color.StartsWith("#"))
+ {
+ // Remove transparancy value
+ color = "#" + color.Substring(3);
+ }
+ return color;
+ }
+
+ private static string ParseXamlThickness(string thickness)
+ {
+ var values = thickness.Split(',');
+
+ for (var i = 0; i < values.Length; i++)
+ {
+ double value;
+ if (double.TryParse(values[i], out value))
+ {
+ values[i] = Math.Ceiling(value).ToString(CultureInfo.InvariantCulture);
+ }
+ else
+ {
+ values[i] = "1";
+ }
+ }
+
+ string cssThickness;
+ switch (values.Length)
+ {
+ case 1:
+ cssThickness = thickness;
+ break;
+ case 2:
+ cssThickness = values[1] + " " + values[0];
+ break;
+ case 4:
+ cssThickness = values[1] + " " + values[2] + " " + values[3] + " " + values[0];
+ break;
+ default:
+ cssThickness = values[0];
+ break;
+ }
+
+ return cssThickness;
+ }
+
+ ///
+ /// Reads a content of current xaml element, converts it
+ ///
+ ///
+ /// XmlTextReader which is expected to be at XmlNodeType.Element
+ /// (opening element tag) position.
+ ///
+ ///
+ /// May be null, in which case we are skipping the xaml element;
+ /// witout producing any output to html.
+ ///
+ ///
+ /// StringBuilder used for collecting css properties for inline STYLE attribute.
+ ///
+ private static void WriteElementContent(XmlTextReader xamlReader, XmlTextWriter htmlWriter,
+ StringBuilder inlineStyle)
+ {
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);
+
+ var elementContentStarted = false;
+
+ if (xamlReader.IsEmptyElement)
+ {
+ if (htmlWriter != null && !elementContentStarted && inlineStyle.Length > 0)
+ {
+ // Output STYLE attribute and clear inlineStyle buffer.
+ htmlWriter.WriteAttributeString("STYLE", inlineStyle.ToString());
+ inlineStyle.Remove(0, inlineStyle.Length);
+ }
+ elementContentStarted = true;
+ }
+ else
+ {
+ while (ReadNextToken(xamlReader) && xamlReader.NodeType != XmlNodeType.EndElement)
+ {
+ switch (xamlReader.NodeType)
+ {
+ case XmlNodeType.Element:
+ if (xamlReader.Name.Contains("."))
+ {
+ AddComplexProperty(xamlReader, inlineStyle);
+ }
+ else
+ {
+ if (htmlWriter != null && !elementContentStarted && inlineStyle.Length > 0)
+ {
+ // Output STYLE attribute and clear inlineStyle buffer.
+ htmlWriter.WriteAttributeString("style", inlineStyle.ToString());
+ inlineStyle.Remove(0, inlineStyle.Length);
+ }
+ elementContentStarted = true;
+ WriteElement(xamlReader, htmlWriter, inlineStyle);
+ }
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.EndElement ||
+ xamlReader.NodeType == XmlNodeType.Element && xamlReader.IsEmptyElement);
+ break;
+ case XmlNodeType.Comment:
+ if (htmlWriter != null)
+ {
+ if (!elementContentStarted && inlineStyle.Length > 0)
+ {
+ htmlWriter.WriteAttributeString("style", inlineStyle.ToString());
+ }
+ htmlWriter.WriteComment(xamlReader.Value);
+ }
+ elementContentStarted = true;
+ break;
+ case XmlNodeType.CDATA:
+ case XmlNodeType.Text:
+ case XmlNodeType.SignificantWhitespace:
+ if (htmlWriter != null)
+ {
+ if (!elementContentStarted && inlineStyle.Length > 0)
+ {
+ htmlWriter.WriteAttributeString("style", inlineStyle.ToString());
+ }
+ htmlWriter.WriteString(xamlReader.Value);
+ }
+ elementContentStarted = true;
+ break;
+ }
+ }
+
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.EndElement);
+ }
+ }
+
+ ///
+ /// Conberts an element notation of complex property into
+ ///
+ ///
+ /// On entry this XmlTextReader must be on Element start tag;
+ /// on exit - on EndElement tag.
+ ///
+ ///
+ /// StringBuilder containing a value for STYLE attribute.
+ ///
+ private static void AddComplexProperty(XmlTextReader xamlReader, StringBuilder inlineStyle)
+ {
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);
+
+ if (inlineStyle != null && xamlReader.Name.EndsWith(".TextDecorations"))
+ {
+ inlineStyle.Append("text-decoration:underline;");
+ }
+
+ // Skip the element representing the complex property
+ WriteElementContent(xamlReader, /*htmlWriter:*/null, /*inlineStyle:*/null);
+ }
+
+ ///
+ /// Converts a xaml element into an appropriate html element.
+ ///
+ ///
+ /// On entry this XmlTextReader must be on Element start tag;
+ /// on exit - on EndElement tag.
+ ///
+ ///
+ /// May be null, in which case we are skipping xaml content
+ /// without producing any html output
+ ///
+ ///
+ /// StringBuilder used for collecting css properties for inline STYLE attributes on every level.
+ ///
+ private static void WriteElement(XmlTextReader xamlReader, XmlTextWriter htmlWriter, StringBuilder inlineStyle)
+ {
+ Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);
+
+ if (htmlWriter == null)
+ {
+ // Skipping mode; recurse into the xaml element without any output
+ WriteElementContent(xamlReader, /*htmlWriter:*/null, null);
+ }
+ else
+ {
+ string htmlElementName = null;
+
+ switch (xamlReader.Name)
+ {
+ case "Run":
+ case "Span":
+ htmlElementName = "span";
+ break;
+ case "InlineUIContainer":
+ htmlElementName = "span";
+ break;
+ case "Bold":
+ htmlElementName = "b";
+ break;
+ case "Italic":
+ htmlElementName = "i";
+ break;
+ case "Paragraph":
+ htmlElementName = "p";
+ break;
+ case "BlockUIContainer":
+ htmlElementName = "div";
+ break;
+ case "Section":
+ htmlElementName = "div";
+ break;
+ case "Table":
+ htmlElementName = "table";
+ break;
+ case "TableColumn":
+ htmlElementName = "col";
+ break;
+ case "TableRowGroup":
+ htmlElementName = "tbody";
+ break;
+ case "TableRow":
+ htmlElementName = "tr";
+ break;
+ case "TableCell":
+ htmlElementName = "td";
+ break;
+ case "List":
+ var marker = xamlReader.GetAttribute("MarkerStyle");
+ if (marker == null || marker == "None" || marker == "Disc" || marker == "Circle" ||
+ marker == "Square" ||
+ marker == "Box")
+ {
+ htmlElementName = "ul";
+ }
+ else
+ {
+ htmlElementName = "ol";
+ }
+ break;
+ case "ListItem":
+ htmlElementName = "li";
+ break;
+ default:
+ htmlElementName = null; // Ignore the element
+ break;
+ }
+
+ if (htmlWriter != null && htmlElementName != null)
+ {
+ htmlWriter.WriteStartElement(htmlElementName);
+
+ WriteFormattingProperties(xamlReader, htmlWriter, inlineStyle);
+
+ WriteElementContent(xamlReader, htmlWriter, inlineStyle);
+
+ htmlWriter.WriteEndElement();
+ }
+ else
+ {
+ // Skip this unrecognized xaml element
+ WriteElementContent(xamlReader, /*htmlWriter:*/null, null);
+ }
+ }
+ }
+
+ // Reader advance helpers
+ // ----------------------
+
+ ///
+ /// Reads several items from xamlReader skipping all non-significant stuff.
+ ///
+ ///
+ /// XmlTextReader from tokens are being read.
+ ///
+ ///
+ /// True if new token is available; false if end of stream reached.
+ ///
+ private static bool ReadNextToken(XmlReader xamlReader)
+ {
+ while (xamlReader.Read())
+ {
+ Debug.Assert(xamlReader.ReadState == ReadState.Interactive,
+ "Reader is expected to be in Interactive state (" + xamlReader.ReadState + ")");
+ switch (xamlReader.NodeType)
+ {
+ case XmlNodeType.Element:
+ case XmlNodeType.EndElement:
+ case XmlNodeType.None:
+ case XmlNodeType.CDATA:
+ case XmlNodeType.Text:
+ case XmlNodeType.SignificantWhitespace:
+ return true;
+
+ case XmlNodeType.Whitespace:
+ if (xamlReader.XmlSpace == XmlSpace.Preserve)
+ {
+ return true;
+ }
+ // ignore insignificant whitespace
+ break;
+
+ case XmlNodeType.EndEntity:
+ case XmlNodeType.EntityReference:
+ // Implement entity reading
+ //xamlReader.ResolveEntity();
+ //xamlReader.Read();
+ //ReadChildNodes( parent, parentBaseUri, xamlReader, positionInfo);
+ break; // for now we ignore entities as insignificant stuff
+
+ case XmlNodeType.Comment:
+ return true;
+ case XmlNodeType.ProcessingInstruction:
+ case XmlNodeType.DocumentType:
+ case XmlNodeType.XmlDeclaration:
+ default:
+ // Ignorable stuff
+ break;
+ }
+ }
+ return false;
+ }
+
+ #endregion Private Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Fields
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Fields
+
+ #endregion Private Fields
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlLexicalAnalyzer.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlLexicalAnalyzer.cs
new file mode 100644
index 00000000..d085133e
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlLexicalAnalyzer.cs
@@ -0,0 +1,745 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ ///
+ /// lexical analyzer class
+ /// recognizes tokens as groups of characters separated by arbitrary amounts of whitespace
+ /// also classifies tokens according to type
+ ///
+ internal class HtmlLexicalAnalyzer
+ {
+ // ---------------------------------------------------------------------
+ //
+ // Constructors
+ //
+ // ---------------------------------------------------------------------
+
+ #region Constructors
+
+ ///
+ /// initializes the _inputStringReader member with the string to be read
+ /// also sets initial values for _nextCharacterCode and _nextTokenType
+ ///
+ ///
+ /// text string to be parsed for xml content
+ ///
+ internal HtmlLexicalAnalyzer(string inputTextString)
+ {
+ _inputStringReader = new StringReader(inputTextString);
+ _nextCharacterCode = 0;
+ NextCharacter = ' ';
+ _lookAheadCharacterCode = _inputStringReader.Read();
+ _lookAheadCharacter = (char) _lookAheadCharacterCode;
+ _previousCharacter = ' ';
+ _ignoreNextWhitespace = true;
+ _nextToken = new StringBuilder(100);
+ NextTokenType = HtmlTokenType.Text;
+ // read the first character so we have some value for the NextCharacter property
+ GetNextCharacter();
+ }
+
+ #endregion Constructors
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Methods
+
+ ///
+ /// retrieves next recognizable token from input string
+ /// and identifies its type
+ /// if no valid token is found, the output parameters are set to null
+ /// if end of stream is reached without matching any token, token type
+ /// paramter is set to EOF
+ ///
+ internal void GetNextContentToken()
+ {
+ Debug.Assert(NextTokenType != HtmlTokenType.Eof);
+ _nextToken.Length = 0;
+ if (IsAtEndOfStream)
+ {
+ NextTokenType = HtmlTokenType.Eof;
+ return;
+ }
+
+ if (IsAtTagStart)
+ {
+ GetNextCharacter();
+
+ if (NextCharacter == '/')
+ {
+ _nextToken.Append("");
+ NextTokenType = HtmlTokenType.ClosingTagStart;
+
+ // advance
+ GetNextCharacter();
+ _ignoreNextWhitespace = false; // Whitespaces after closing tags are significant
+ }
+ else
+ {
+ NextTokenType = HtmlTokenType.OpeningTagStart;
+ _nextToken.Append("<");
+ _ignoreNextWhitespace = true; // Whitespaces after opening tags are insignificant
+ }
+ }
+ else if (IsAtDirectiveStart)
+ {
+ // either a comment or CDATA
+ GetNextCharacter();
+ if (_lookAheadCharacter == '[')
+ {
+ // cdata
+ ReadDynamicContent();
+ }
+ else if (_lookAheadCharacter == '-')
+ {
+ ReadComment();
+ }
+ else
+ {
+ // neither a comment nor cdata, should be something like DOCTYPE
+ // skip till the next tag ender
+ ReadUnknownDirective();
+ }
+ }
+ else
+ {
+ // read text content, unless you encounter a tag
+ NextTokenType = HtmlTokenType.Text;
+ while (!IsAtTagStart && !IsAtEndOfStream && !IsAtDirectiveStart)
+ {
+ if (NextCharacter == '<' && !IsNextCharacterEntity && _lookAheadCharacter == '?')
+ {
+ // ignore processing directive
+ SkipProcessingDirective();
+ }
+ else
+ {
+ if (NextCharacter <= ' ')
+ {
+ // Respect xml:preserve or its equivalents for whitespace processing
+ if (_ignoreNextWhitespace)
+ {
+ // Ignore repeated whitespaces
+ }
+ else
+ {
+ // Treat any control character sequence as one whitespace
+ _nextToken.Append(' ');
+ }
+ _ignoreNextWhitespace = true; // and keep ignoring the following whitespaces
+ }
+ else
+ {
+ _nextToken.Append(NextCharacter);
+ _ignoreNextWhitespace = false;
+ }
+ GetNextCharacter();
+ }
+ }
+ }
+ }
+
+ ///
+ /// Unconditionally returns a token which is one of: TagEnd, EmptyTagEnd, Name, Atom or EndOfStream
+ /// Does not guarantee token reader advancing.
+ ///
+ internal void GetNextTagToken()
+ {
+ _nextToken.Length = 0;
+ if (IsAtEndOfStream)
+ {
+ NextTokenType = HtmlTokenType.Eof;
+ return;
+ }
+
+ SkipWhiteSpace();
+
+ if (NextCharacter == '>' && !IsNextCharacterEntity)
+ {
+ // > should not end a tag, so make sure it's not an entity
+ NextTokenType = HtmlTokenType.TagEnd;
+ _nextToken.Append('>');
+ GetNextCharacter();
+ // Note: _ignoreNextWhitespace must be set appropriately on tag start processing
+ }
+ else if (NextCharacter == '/' && _lookAheadCharacter == '>')
+ {
+ // could be start of closing of empty tag
+ NextTokenType = HtmlTokenType.EmptyTagEnd;
+ _nextToken.Append("/>");
+ GetNextCharacter();
+ GetNextCharacter();
+ _ignoreNextWhitespace = false; // Whitespace after no-scope tags are sifnificant
+ }
+ else if (IsGoodForNameStart(NextCharacter))
+ {
+ NextTokenType = HtmlTokenType.Name;
+
+ // starts a name
+ // we allow character entities here
+ // we do not throw exceptions here if end of stream is encountered
+ // just stop and return whatever is in the token
+ // if the parser is not expecting end of file after this it will call
+ // the get next token function and throw an exception
+ while (IsGoodForName(NextCharacter) && !IsAtEndOfStream)
+ {
+ _nextToken.Append(NextCharacter);
+ GetNextCharacter();
+ }
+ }
+ else
+ {
+ // Unexpected type of token for a tag. Reprot one character as Atom, expecting that HtmlParser will ignore it.
+ NextTokenType = HtmlTokenType.Atom;
+ _nextToken.Append(NextCharacter);
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// Unconditionally returns equal sign token. Even if there is no
+ /// real equal sign in the stream, it behaves as if it were there.
+ /// Does not guarantee token reader advancing.
+ ///
+ internal void GetNextEqualSignToken()
+ {
+ Debug.Assert(NextTokenType != HtmlTokenType.Eof);
+ _nextToken.Length = 0;
+
+ _nextToken.Append('=');
+ NextTokenType = HtmlTokenType.EqualSign;
+
+ SkipWhiteSpace();
+
+ if (NextCharacter == '=')
+ {
+ // '=' is not in the list of entities, so no need to check for entities here
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// Unconditionally returns an atomic value for an attribute
+ /// Even if there is no appropriate token it returns Atom value
+ /// Does not guarantee token reader advancing.
+ ///
+ internal void GetNextAtomToken()
+ {
+ Debug.Assert(NextTokenType != HtmlTokenType.Eof);
+ _nextToken.Length = 0;
+
+ SkipWhiteSpace();
+
+ NextTokenType = HtmlTokenType.Atom;
+
+ if ((NextCharacter == '\'' || NextCharacter == '"') && !IsNextCharacterEntity)
+ {
+ var startingQuote = NextCharacter;
+ GetNextCharacter();
+
+ // Consume all characters between quotes
+ while (!(NextCharacter == startingQuote && !IsNextCharacterEntity) && !IsAtEndOfStream)
+ {
+ _nextToken.Append(NextCharacter);
+ GetNextCharacter();
+ }
+ if (NextCharacter == startingQuote)
+ {
+ GetNextCharacter();
+ }
+
+ // complete the quoted value
+ // NOTE: our recovery here is different from IE's
+ // IE keeps reading until it finds a closing quote or end of file
+ // if end of file, it treats current value as text
+ // if it finds a closing quote at any point within the text, it eats everything between the quotes
+ // TODO: Suggestion:
+ // however, we could stop when we encounter end of file or an angle bracket of any kind
+ // and assume there was a quote there
+ // so the attribute value may be meaningless but it is never treated as text
+ }
+ else
+ {
+ while (!IsAtEndOfStream && !char.IsWhiteSpace(NextCharacter) && NextCharacter != '>')
+ {
+ _nextToken.Append(NextCharacter);
+ GetNextCharacter();
+ }
+ }
+ }
+
+ #endregion Internal Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal Properties
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Properties
+
+ internal HtmlTokenType NextTokenType { get; private set; }
+
+ internal string NextToken => _nextToken.ToString();
+
+ #endregion Internal Properties
+
+ // ---------------------------------------------------------------------
+ //
+ // Private methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Methods
+
+ ///
+ /// Advances a reading position by one character code
+ /// and reads the next availbale character from a stream.
+ /// This character becomes available as NextCharacter property.
+ ///
+ ///
+ /// Throws InvalidOperationException if attempted to be called on EndOfStream
+ /// condition.
+ ///
+ private void GetNextCharacter()
+ {
+ if (_nextCharacterCode == -1)
+ {
+ throw new InvalidOperationException("GetNextCharacter method called at the end of a stream");
+ }
+
+ _previousCharacter = NextCharacter;
+
+ NextCharacter = _lookAheadCharacter;
+ _nextCharacterCode = _lookAheadCharacterCode;
+ // next character not an entity as of now
+ IsNextCharacterEntity = false;
+
+ ReadLookAheadCharacter();
+
+ if (NextCharacter == '&')
+ {
+ if (_lookAheadCharacter == '#')
+ {
+ // numeric entity - parse digits - DDDDD;
+ int entityCode;
+ entityCode = 0;
+ ReadLookAheadCharacter();
+
+ // largest numeric entity is 7 characters
+ for (var i = 0; i < 7 && char.IsDigit(_lookAheadCharacter); i++)
+ {
+ entityCode = 10*entityCode + (_lookAheadCharacterCode - '0');
+ ReadLookAheadCharacter();
+ }
+ if (_lookAheadCharacter == ';')
+ {
+ // correct format - advance
+ ReadLookAheadCharacter();
+ _nextCharacterCode = entityCode;
+
+ // if this is out of range it will set the character to '?'
+ NextCharacter = (char) _nextCharacterCode;
+
+ // as far as we are concerned, this is an entity
+ IsNextCharacterEntity = true;
+ }
+ else
+ {
+ // not an entity, set next character to the current lookahread character
+ // we would have eaten up some digits
+ NextCharacter = _lookAheadCharacter;
+ _nextCharacterCode = _lookAheadCharacterCode;
+ ReadLookAheadCharacter();
+ IsNextCharacterEntity = false;
+ }
+ }
+ else if (char.IsLetter(_lookAheadCharacter))
+ {
+ // entity is written as a string
+ var entity = "";
+
+ // maximum length of string entities is 10 characters
+ for (var i = 0;
+ i < 10 && (char.IsLetter(_lookAheadCharacter) || char.IsDigit(_lookAheadCharacter));
+ i++)
+ {
+ entity += _lookAheadCharacter;
+ ReadLookAheadCharacter();
+ }
+ if (_lookAheadCharacter == ';')
+ {
+ // advance
+ ReadLookAheadCharacter();
+
+ if (HtmlSchema.IsEntity(entity))
+ {
+ NextCharacter = HtmlSchema.EntityCharacterValue(entity);
+ _nextCharacterCode = NextCharacter;
+ IsNextCharacterEntity = true;
+ }
+ else
+ {
+ // just skip the whole thing - invalid entity
+ // move on to the next character
+ NextCharacter = _lookAheadCharacter;
+ _nextCharacterCode = _lookAheadCharacterCode;
+ ReadLookAheadCharacter();
+
+ // not an entity
+ IsNextCharacterEntity = false;
+ }
+ }
+ else
+ {
+ // skip whatever we read after the ampersand
+ // set next character and move on
+ NextCharacter = _lookAheadCharacter;
+ ReadLookAheadCharacter();
+ IsNextCharacterEntity = false;
+ }
+ }
+ }
+ }
+
+ private void ReadLookAheadCharacter()
+ {
+ if (_lookAheadCharacterCode != -1)
+ {
+ _lookAheadCharacterCode = _inputStringReader.Read();
+ _lookAheadCharacter = (char) _lookAheadCharacterCode;
+ }
+ }
+
+ ///
+ /// skips whitespace in the input string
+ /// leaves the first non-whitespace character available in the NextCharacter property
+ /// this may be the end-of-file character, it performs no checking
+ ///
+ private void SkipWhiteSpace()
+ {
+ // TODO: handle character entities while processing comments, cdata, and directives
+ // TODO: SUGGESTION: we could check if lookahead and previous characters are entities also
+ while (true)
+ {
+ if (NextCharacter == '<' && (_lookAheadCharacter == '?' || _lookAheadCharacter == '!'))
+ {
+ GetNextCharacter();
+
+ if (_lookAheadCharacter == '[')
+ {
+ // Skip CDATA block and DTDs(?)
+ while (!IsAtEndOfStream &&
+ !(_previousCharacter == ']' && NextCharacter == ']' && _lookAheadCharacter == '>'))
+ {
+ GetNextCharacter();
+ }
+ if (NextCharacter == '>')
+ {
+ GetNextCharacter();
+ }
+ }
+ else
+ {
+ // Skip processing instruction, comments
+ while (!IsAtEndOfStream && NextCharacter != '>')
+ {
+ GetNextCharacter();
+ }
+ if (NextCharacter == '>')
+ {
+ GetNextCharacter();
+ }
+ }
+ }
+
+
+ if (!char.IsWhiteSpace(NextCharacter))
+ {
+ break;
+ }
+
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// checks if a character can be used to start a name
+ /// if this check is true then the rest of the name can be read
+ ///
+ ///
+ /// character value to be checked
+ ///
+ ///
+ /// true if the character can be the first character in a name
+ /// false otherwise
+ ///
+ private bool IsGoodForNameStart(char character) => character == '_' || char.IsLetter(character);
+
+ ///
+ /// checks if a character can be used as a non-starting character in a name
+ /// uses the IsExtender and IsCombiningCharacter predicates to see
+ /// if a character is an extender or a combining character
+ ///
+ ///
+ /// character to be checked for validity in a name
+ ///
+ ///
+ /// true if the character can be a valid part of a name
+ ///
+ private bool IsGoodForName(char character) => IsGoodForNameStart(character) ||
+ character == '.' ||
+ character == '-' ||
+ character == ':' ||
+ char.IsDigit(character) ||
+ IsCombiningCharacter(character) ||
+ IsExtender(character);
+
+ ///
+ /// identifies a character as being a combining character, permitted in a name
+ /// TODO: only a placeholder for now but later to be replaced with comparisons against
+ /// the list of combining characters in the XML documentation
+ ///
+ ///
+ /// character to be checked
+ ///
+ ///
+ /// true if the character is a combining character, false otherwise
+ ///
+ private bool IsCombiningCharacter(char character) => false;
+
+ ///
+ /// identifies a character as being an extender, permitted in a name
+ /// TODO: only a placeholder for now but later to be replaced with comparisons against
+ /// the list of extenders in the XML documentation
+ ///
+ ///
+ /// character to be checked
+ ///
+ ///
+ /// true if the character is an extender, false otherwise
+ ///
+ private bool IsExtender(char character) => false;
+
+ ///
+ /// skips dynamic content starting with ''
+ ///
+ private void ReadDynamicContent()
+ {
+ // verify that we are at dynamic content, which may include CDATA
+ Debug.Assert(_previousCharacter == '<' && NextCharacter == '!' && _lookAheadCharacter == '[');
+
+ // Let's treat this as empty text
+ NextTokenType = HtmlTokenType.Text;
+ _nextToken.Length = 0;
+
+ // advance twice, once to get the lookahead character and then to reach the start of the cdata
+ GetNextCharacter();
+ GetNextCharacter();
+
+ // NOTE: 10/12/2004: modified this function to check when called if's reading CDATA or something else
+ // some directives may start with a
+ // this function is modified to stop at the sequence ]> and not ]]>
+ // this means that CDATA and anything else expressed in their own set of [] within the
+ // directive cannot contain a ]> sequence. However it is doubtful that cdata could contain such
+ // sequence anyway, it probably stops at the first ]
+ while (!(NextCharacter == ']' && _lookAheadCharacter == '>') && !IsAtEndOfStream)
+ {
+ // advance
+ GetNextCharacter();
+ }
+
+ if (!IsAtEndOfStream)
+ {
+ // advance, first to the last >
+ GetNextCharacter();
+
+ // then advance past it to the next character after processing directive
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// skips comments starting with ''
+ /// NOTE: 10/06/2004: processing changed, will now skip anything starting with
+ /// the "" or "->", because in practice many html pages do not
+ /// use the full comment specifying conventions
+ ///
+ private void ReadComment()
+ {
+ // verify that we are at a comment
+ Debug.Assert(_previousCharacter == '<' && NextCharacter == '!' && _lookAheadCharacter == '-');
+
+ // Initialize a token
+ NextTokenType = HtmlTokenType.Comment;
+ _nextToken.Length = 0;
+
+ // advance to the next character, so that to be at the start of comment value
+ GetNextCharacter(); // get first '-'
+ GetNextCharacter(); // get second '-'
+ GetNextCharacter(); // get first character of comment content
+
+ while (true)
+ {
+ // Read text until end of comment
+ // Note that in many actual html pages comments end with "!>" (while xml standard is "-->")
+ while (!IsAtEndOfStream &&
+ !(NextCharacter == '-' && _lookAheadCharacter == '-' ||
+ NextCharacter == '!' && _lookAheadCharacter == '>'))
+ {
+ _nextToken.Append(NextCharacter);
+ GetNextCharacter();
+ }
+
+ // Finish comment reading
+ GetNextCharacter();
+ if (_previousCharacter == '-' && NextCharacter == '-' && _lookAheadCharacter == '>')
+ {
+ // Standard comment end. Eat it and exit the loop
+ GetNextCharacter(); // get '>'
+ break;
+ }
+ if (_previousCharacter == '!' && NextCharacter == '>')
+ {
+ // Nonstandard but possible comment end - '!>'. Exit the loop
+ break;
+ }
+ // Not an end. Save character and continue continue reading
+ _nextToken.Append(_previousCharacter);
+ }
+
+ // Read end of comment combination
+ if (NextCharacter == '>')
+ {
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// skips past unknown directives that start with ""
+ /// character
+ /// applies to directives such as DOCTYPE, etc that we do not presently support
+ ///
+ private void ReadUnknownDirective()
+ {
+ // verify that we are at an unknown directive
+ Debug.Assert(_previousCharacter == '<' && NextCharacter == '!' &&
+ !(_lookAheadCharacter == '-' || _lookAheadCharacter == '['));
+
+ // Let's treat this as empty text
+ NextTokenType = HtmlTokenType.Text;
+ _nextToken.Length = 0;
+
+ // advance to the next character
+ GetNextCharacter();
+
+ // skip to the first tag end we find
+ while (!(NextCharacter == '>' && !IsNextCharacterEntity) && !IsAtEndOfStream)
+ {
+ GetNextCharacter();
+ }
+
+ if (!IsAtEndOfStream)
+ {
+ // advance past the tag end
+ GetNextCharacter();
+ }
+ }
+
+ ///
+ /// skips processing directives starting with the characters '' and ending with '?>'
+ /// NOTE: 10/14/2004: IE also ends processing directives with a />, so this function is
+ /// being modified to recognize that condition as well
+ ///
+ private void SkipProcessingDirective()
+ {
+ // verify that we are at a processing directive
+ Debug.Assert(NextCharacter == '<' && _lookAheadCharacter == '?');
+
+ // advance twice, once to get the lookahead character and then to reach the start of the drective
+ GetNextCharacter();
+ GetNextCharacter();
+
+ while (!((NextCharacter == '?' || NextCharacter == '/') && _lookAheadCharacter == '>') && !IsAtEndOfStream)
+ {
+ // advance
+ // we don't need to check for entities here because '?' is not an entity
+ // and even though > is an entity there is no entity processing when reading lookahead character
+ GetNextCharacter();
+ }
+
+ if (!IsAtEndOfStream)
+ {
+ // advance, first to the last >
+ GetNextCharacter();
+
+ // then advance past it to the next character after processing directive
+ GetNextCharacter();
+ }
+ }
+
+ #endregion Private Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Properties
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Properties
+
+ private char NextCharacter { get; set; }
+
+ private bool IsAtEndOfStream => _nextCharacterCode == -1;
+
+ private bool IsAtTagStart
+ => NextCharacter == '<' && (_lookAheadCharacter == '/' || IsGoodForNameStart(_lookAheadCharacter)) &&
+ !IsNextCharacterEntity;
+
+ private bool IsAtTagEnd => (NextCharacter == '>' || (NextCharacter == '/' && _lookAheadCharacter == '>')) &&
+ !IsNextCharacterEntity;
+
+ private bool IsAtDirectiveStart
+ => (NextCharacter == '<' && _lookAheadCharacter == '!' && !IsNextCharacterEntity);
+
+ private bool IsNextCharacterEntity { // check if next character is an entity
+ get; set; }
+
+ #endregion Private Properties
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Fields
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Fields
+
+ // string reader which will move over input text
+ private readonly StringReader _inputStringReader;
+ // next character code read from input that is not yet part of any token
+ // and the character it represents
+ private int _nextCharacterCode;
+ private int _lookAheadCharacterCode;
+ private char _lookAheadCharacter;
+ private char _previousCharacter;
+ private bool _ignoreNextWhitespace;
+
+ // store token and type in local variables before copying them to output parameters
+ private readonly StringBuilder _nextToken;
+
+ #endregion Private Fields
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlParser.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlParser.cs
new file mode 100644
index 00000000..bdef1093
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlParser.cs
@@ -0,0 +1,539 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+// StringBuilder
+
+// important TODOS:
+// TODO 1. Start tags: The ParseXmlElement function has been modified to be called after both the
+// angle bracket < and element name have been read, instead of just the < bracket and some valid name character,
+// previously the case. This change was made so that elements with optional closing tags could read a new
+// element's start tag and decide whether they were required to close. However, there is a question of whether to
+// handle this in the parser or lexical analyzer. It is currently handled in the parser - the lexical analyzer still
+// recognizes a start tag opener as a '<' + valid name start char; it is the parser that reads the actual name.
+// this is correct behavior assuming that the name is a valid html name, because the lexical analyzer should not know anything
+// about optional closing tags, etc. UPDATED: 10/13/2004: I am updating this to read the whole start tag of something
+// that is not an HTML, treat it as empty, and add it to the tree. That way the converter will know it's there, but
+// it will hvae no content. We could also partially recover by trying to look up and match names if they are similar
+// TODO 2. Invalid element names: However, it might make sense to give the lexical analyzer the ability to identify
+// a valid html element name and not return something as a start tag otherwise. For example, if we type , should
+// the lexical analyzer return that it has found the start of an element when this is not the case in HTML? But this will
+// require implementing a lookahead token in the lexical analyzer so that it can treat an invalid element name as text. One
+// character of lookahead will not be enough.
+// TODO 3. Attributes: The attribute recovery is poor when reading attribute values in quotes - if no closing quotes are found,
+// the lexical analyzer just keeps reading and if it eventually reaches the end of file, it would have just skipped everything.
+// There are a couple of ways to deal with this: 1) stop reading attributes when we encounter a '>' character - this doesn't allow
+// the '>' character to be used in attribute values, but it can still be used as an entity. 2) Maintain a HTML-specific list
+// of attributes and their values that each html element can take, and if we find correct attribute namesand values for an
+// element we use them regardless of the quotes, this way we could just ignore something invalid. One more option: 3) Read ahead
+// in the quoted value and if we find an end of file, we can return to where we were and process as text. However this requires
+// a lot of lookahead and a resettable reader.
+// TODO 4: elements with optional closing tags: For elements with optional closing tags, we always close the element if we find
+// that one of it's ancestors has closed. This condition may be too broad and we should develop a better heuristic. We should also
+// improve the heuristics for closing certain elements when the next element starts
+// TODO 5. Nesting: Support for unbalanced nesting, e.g. : this is not presently supported. To support it we may need
+// to maintain two xml elements, one the element that represents what has already been read and another represents what we are presently reading.
+// Then if we encounter an unbalanced nesting tag we could close the element that was supposed to close, save the current element
+// and store it in the list of already-read content, and then open a new element to which all tags that are currently open
+// can be applied. Is there a better way to do this? Should we do it at all?
+// TODO 6. Elements with optional starting tags: there are 4 such elements in the HTML 4 specification - html, tbody, body and head.
+// The current recovery doesn;t do anything for any of these elements except the html element, because it's not critical - head
+// and body elementscan be contained within html element, and tbody is contained within table. To extend this for XHTML
+// extensions, and to recover in case other elements are missing start tags, we would need to insert an extra recursive call
+// to ParseXmlElement for the missing start tag. It is suggested to do this by giving ParseXmlElement an argument that specifies
+// a name to use. If this argument is null, it assumes its name is the next token from the lexical analyzer and continues
+// exactly as it does now. However, if the argument contains a valid html element name then it takes that value as its name
+// and continues as before. This way, if the next token is the element that should actually be its child, it will see
+// the name in the next step and initiate a recursive call. We would also need to add some logic in the loop for when a start tag
+// is found - if the start tag is not compatible with current context and indicates that a start tag has been missed, then we
+// can initiate the extra recursive call and give it the name of the missed start tag. The issues are when to insert this logic,
+// and if we want to support it over multiple missing start tags. If we insert it at the time a start tag is read in element
+// text, then we can support only one missing start tag, since the extra call will read the next start tag and make a recursive
+// call without checking the context. This is a conceptual problem, and the check should be made just before a recursive call,
+// with the choice being whether we should supply an element name as argument, or leave it as NULL and read from the input
+// TODO 7: Context: Is it appropriate to keep track of context here? For example, should we only expect td, tr elements when
+// reading a table and ignore them otherwise? This may be too much of a load on the parser, I think it's better if the converter
+// deals with it
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ ///
+ /// HtmlParser class accepts a string of possibly badly formed Html, parses it and returns a string
+ /// of well-formed Html that is as close to the original string in content as possible
+ ///
+ internal class HtmlParser
+ {
+ // ---------------------------------------------------------------------
+ //
+ // Constructors
+ //
+ // ---------------------------------------------------------------------
+
+ #region Constructors
+
+ ///
+ /// Constructor. Initializes the _htmlLexicalAnalayzer element with the given input string
+ ///
+ ///
+ /// string to parsed into well-formed Html
+ ///
+ private HtmlParser(string inputString)
+ {
+ // Create an output xml document
+ _document = new XmlDocument();
+
+ // initialize open tag stack
+ _openedElements = new Stack();
+
+ _pendingInlineElements = new Stack();
+
+ // initialize lexical analyzer
+ _htmlLexicalAnalyzer = new HtmlLexicalAnalyzer(inputString);
+
+ // get first token from input, expecting text
+ _htmlLexicalAnalyzer.GetNextContentToken();
+ }
+
+ #endregion Constructors
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Methods
+
+ ///
+ /// Instantiates an HtmlParser element and calls the parsing function on the given input string
+ ///
+ ///
+ /// Input string of pssibly badly-formed Html to be parsed into well-formed Html
+ ///
+ ///
+ /// XmlElement rep
+ ///
+ internal static XmlElement ParseHtml(string htmlString)
+ {
+ var htmlParser = new HtmlParser(htmlString);
+
+ var htmlRootElement = htmlParser.ParseHtmlContent();
+
+ return htmlRootElement;
+ }
+
+ // .....................................................................
+ //
+ // Html Header on Clipboard
+ //
+ // .....................................................................
+
+ // Html header structure.
+ // Version:1.0
+ // StartHTML:000000000
+ // EndHTML:000000000
+ // StartFragment:000000000
+ // EndFragment:000000000
+ // StartSelection:000000000
+ // EndSelection:000000000
+ internal const string HtmlHeader =
+ "Version:1.0\r\nStartHTML:{0:D10}\r\nEndHTML:{1:D10}\r\nStartFragment:{2:D10}\r\nEndFragment:{3:D10}\r\nStartSelection:{4:D10}\r\nEndSelection:{5:D10}\r\n";
+
+ internal const string HtmlStartFragmentComment = "";
+ internal const string HtmlEndFragmentComment = "";
+
+ ///
+ /// Extracts Html string from clipboard data by parsing header information in htmlDataString
+ ///
+ ///
+ /// String representing Html clipboard data. This includes Html header
+ ///
+ ///
+ /// String containing only the Html data part of htmlDataString, without header
+ ///
+ internal static string ExtractHtmlFromClipboardData(string htmlDataString)
+ {
+ var startHtmlIndex = htmlDataString.IndexOf("StartHTML:", StringComparison.Ordinal);
+ if (startHtmlIndex < 0)
+ {
+ return "ERROR: Urecognized html header";
+ }
+ // TODO: We assume that indices represented by strictly 10 zeros ("0123456789".Length),
+ // which could be wrong assumption. We need to implement more flrxible parsing here
+ startHtmlIndex =
+ int.Parse(htmlDataString.Substring(startHtmlIndex + "StartHTML:".Length, "0123456789".Length));
+ if (startHtmlIndex < 0 || startHtmlIndex > htmlDataString.Length)
+ {
+ return "ERROR: Urecognized html header";
+ }
+
+ var endHtmlIndex = htmlDataString.IndexOf("EndHTML:", StringComparison.Ordinal);
+ if (endHtmlIndex < 0)
+ {
+ return "ERROR: Urecognized html header";
+ }
+ // TODO: We assume that indices represented by strictly 10 zeros ("0123456789".Length),
+ // which could be wrong assumption. We need to implement more flrxible parsing here
+ endHtmlIndex = int.Parse(htmlDataString.Substring(endHtmlIndex + "EndHTML:".Length, "0123456789".Length));
+ if (endHtmlIndex > htmlDataString.Length)
+ {
+ endHtmlIndex = htmlDataString.Length;
+ }
+
+ return htmlDataString.Substring(startHtmlIndex, endHtmlIndex - startHtmlIndex);
+ }
+
+ ///
+ /// Adds Xhtml header information to Html data string so that it can be placed on clipboard
+ ///
+ ///
+ /// Html string to be placed on clipboard with appropriate header
+ ///
+ ///
+ /// String wrapping htmlString with appropriate Html header
+ ///
+ internal static string AddHtmlClipboardHeader(string htmlString)
+ {
+ var stringBuilder = new StringBuilder();
+
+ // each of 6 numbers is represented by "{0:D10}" in the format string
+ // must actually occupy 10 digit positions ("0123456789")
+ var startHtml = HtmlHeader.Length + 6*("0123456789".Length - "{0:D10}".Length);
+ var endHtml = startHtml + htmlString.Length;
+ var startFragment = htmlString.IndexOf(HtmlStartFragmentComment, 0, StringComparison.Ordinal);
+ if (startFragment >= 0)
+ {
+ startFragment = startHtml + startFragment + HtmlStartFragmentComment.Length;
+ }
+ else
+ {
+ startFragment = startHtml;
+ }
+ var endFragment = htmlString.IndexOf(HtmlEndFragmentComment, 0, StringComparison.Ordinal);
+ if (endFragment >= 0)
+ {
+ endFragment = startHtml + endFragment;
+ }
+ else
+ {
+ endFragment = endHtml;
+ }
+
+ // Create HTML clipboard header string
+ stringBuilder.AppendFormat(HtmlHeader, startHtml, endHtml, startFragment, endFragment, startFragment,
+ endFragment);
+
+ // Append HTML body.
+ stringBuilder.Append(htmlString);
+
+ return stringBuilder.ToString();
+ }
+
+ #endregion Internal Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Methods
+
+ private void InvariantAssert(bool condition, string message)
+ {
+ if (!condition)
+ {
+ throw new Exception("Assertion error: " + message);
+ }
+ }
+
+ ///
+ /// Parses the stream of html tokens starting
+ /// from the name of top-level element.
+ /// Returns XmlElement representing the top-level
+ /// html element
+ ///
+ private XmlElement ParseHtmlContent()
+ {
+ // Create artificial root elelemt to be able to group multiple top-level elements
+ // We create "html" element which may be a duplicate of real HTML element, which is ok, as HtmlConverter will swallow it painlessly..
+ var htmlRootElement = _document.CreateElement("html", XhtmlNamespace);
+ OpenStructuringElement(htmlRootElement);
+
+ while (_htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.Eof)
+ {
+ if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.OpeningTagStart)
+ {
+ _htmlLexicalAnalyzer.GetNextTagToken();
+ if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Name)
+ {
+ var htmlElementName = _htmlLexicalAnalyzer.NextToken.ToLower();
+ _htmlLexicalAnalyzer.GetNextTagToken();
+
+ // Create an element
+ var htmlElement = _document.CreateElement(htmlElementName, XhtmlNamespace);
+
+ // Parse element attributes
+ ParseAttributes(htmlElement);
+
+ if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.EmptyTagEnd ||
+ HtmlSchema.IsEmptyElement(htmlElementName))
+ {
+ // It is an element without content (because of explicit slash or based on implicit knowledge aboout html)
+ AddEmptyElement(htmlElement);
+ }
+ else if (HtmlSchema.IsInlineElement(htmlElementName))
+ {
+ // Elements known as formatting are pushed to some special
+ // pending stack, which allows them to be transferred
+ // over block tags - by doing this we convert
+ // overlapping tags into normal heirarchical element structure.
+ OpenInlineElement(htmlElement);
+ }
+ else if (HtmlSchema.IsBlockElement(htmlElementName) ||
+ HtmlSchema.IsKnownOpenableElement(htmlElementName))
+ {
+ // This includes no-scope elements
+ OpenStructuringElement(htmlElement);
+ }
+ }
+ }
+ else if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.ClosingTagStart)
+ {
+ _htmlLexicalAnalyzer.GetNextTagToken();
+ if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Name)
+ {
+ var htmlElementName = _htmlLexicalAnalyzer.NextToken.ToLower();
+
+ // Skip the name token. Assume that the following token is end of tag,
+ // but do not check this. If it is not true, we simply ignore one token
+ // - this is our recovery from bad xml in this case.
+ _htmlLexicalAnalyzer.GetNextTagToken();
+
+ CloseElement(htmlElementName);
+ }
+ }
+ else if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Text)
+ {
+ AddTextContent(_htmlLexicalAnalyzer.NextToken);
+ }
+ else if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Comment)
+ {
+ AddComment(_htmlLexicalAnalyzer.NextToken);
+ }
+
+ _htmlLexicalAnalyzer.GetNextContentToken();
+ }
+
+ // Get rid of the artificial root element
+ if (htmlRootElement.FirstChild is XmlElement &&
+ htmlRootElement.FirstChild == htmlRootElement.LastChild &&
+ htmlRootElement.FirstChild.LocalName.ToLower() == "html")
+ {
+ htmlRootElement = (XmlElement) htmlRootElement.FirstChild;
+ }
+
+ return htmlRootElement;
+ }
+
+ private XmlElement CreateElementCopy(XmlElement htmlElement)
+ {
+ var htmlElementCopy = _document.CreateElement(htmlElement.LocalName, XhtmlNamespace);
+ for (var i = 0; i < htmlElement.Attributes.Count; i++)
+ {
+ var attribute = htmlElement.Attributes[i];
+ htmlElementCopy.SetAttribute(attribute.Name, attribute.Value);
+ }
+ return htmlElementCopy;
+ }
+
+ private void AddEmptyElement(XmlElement htmlEmptyElement)
+ {
+ InvariantAssert(_openedElements.Count > 0,
+ "AddEmptyElement: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+ var htmlParent = _openedElements.Peek();
+ htmlParent.AppendChild(htmlEmptyElement);
+ }
+
+ private void OpenInlineElement(XmlElement htmlInlineElement)
+ {
+ _pendingInlineElements.Push(htmlInlineElement);
+ }
+
+ // Opens structurig element such as Div or Table etc.
+ private void OpenStructuringElement(XmlElement htmlElement)
+ {
+ // Close all pending inline elements
+ // All block elements are considered as delimiters for inline elements
+ // which forces all inline elements to be closed and re-opened in the following
+ // structural element (if any).
+ // By doing that we guarantee that all inline elements appear only within most nested blocks
+ if (HtmlSchema.IsBlockElement(htmlElement.LocalName))
+ {
+ while (_openedElements.Count > 0 && HtmlSchema.IsInlineElement(_openedElements.Peek().LocalName))
+ {
+ var htmlInlineElement = _openedElements.Pop();
+ InvariantAssert(_openedElements.Count > 0,
+ "OpenStructuringElement: stack of opened elements cannot become empty here");
+
+ _pendingInlineElements.Push(CreateElementCopy(htmlInlineElement));
+ }
+ }
+
+ // Add this block element to its parent
+ if (_openedElements.Count > 0)
+ {
+ var htmlParent = _openedElements.Peek();
+
+ // Check some known block elements for auto-closing (LI and P)
+ if (HtmlSchema.ClosesOnNextElementStart(htmlParent.LocalName, htmlElement.LocalName))
+ {
+ _openedElements.Pop();
+ htmlParent = _openedElements.Count > 0 ? _openedElements.Peek() : null;
+ }
+
+ // NOTE:
+ // Actually we never expect null - it would mean two top-level P or LI (without a parent).
+ // In such weird case we will loose all paragraphs except the first one...
+ htmlParent?.AppendChild(htmlElement);
+ }
+
+ // Push it onto a stack
+ _openedElements.Push(htmlElement);
+ }
+
+ private bool IsElementOpened(string htmlElementName) => _openedElements.Any(openedElement => openedElement.LocalName == htmlElementName);
+
+ private void CloseElement(string htmlElementName)
+ {
+ // Check if the element is opened and already added to the parent
+ InvariantAssert(_openedElements.Count > 0,
+ "CloseElement: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+
+ // Check if the element is opened and still waiting to be added to the parent
+ if (_pendingInlineElements.Count > 0 && _pendingInlineElements.Peek().LocalName == htmlElementName)
+ {
+ // Closing an empty inline element.
+ // Note that HtmlConverter will skip empty inlines, but for completeness we keep them here on parser level.
+ var htmlInlineElement = _pendingInlineElements.Pop();
+ InvariantAssert(_openedElements.Count > 0,
+ "CloseElement: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+ var htmlParent = _openedElements.Peek();
+ htmlParent.AppendChild(htmlInlineElement);
+ }
+ else if (IsElementOpened(htmlElementName))
+ {
+ while (_openedElements.Count > 1) // we never pop the last element - the artificial root
+ {
+ // Close all unbalanced elements.
+ var htmlOpenedElement = _openedElements.Pop();
+
+ if (htmlOpenedElement.LocalName == htmlElementName)
+ {
+ return;
+ }
+
+ if (HtmlSchema.IsInlineElement(htmlOpenedElement.LocalName))
+ {
+ // Unbalances Inlines will be transfered to the next element content
+ _pendingInlineElements.Push(CreateElementCopy(htmlOpenedElement));
+ }
+ }
+ }
+
+ // If element was not opened, we simply ignore the unbalanced closing tag
+ }
+
+ private void AddTextContent(string textContent)
+ {
+ OpenPendingInlineElements();
+
+ InvariantAssert(_openedElements.Count > 0,
+ "AddTextContent: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+
+ var htmlParent = _openedElements.Peek();
+ var textNode = _document.CreateTextNode(textContent);
+ htmlParent.AppendChild(textNode);
+ }
+
+ private void AddComment(string comment)
+ {
+ OpenPendingInlineElements();
+
+ InvariantAssert(_openedElements.Count > 0,
+ "AddComment: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+
+ var htmlParent = _openedElements.Peek();
+ var xmlComment = _document.CreateComment(comment);
+ htmlParent.AppendChild(xmlComment);
+ }
+
+ // Moves all inline elements pending for opening to actual document
+ // and adds them to current open stack.
+ private void OpenPendingInlineElements()
+ {
+ if (_pendingInlineElements.Count > 0)
+ {
+ var htmlInlineElement = _pendingInlineElements.Pop();
+
+ OpenPendingInlineElements();
+
+ InvariantAssert(_openedElements.Count > 0,
+ "OpenPendingInlineElements: Stack of opened elements cannot be empty, as we have at least one artificial root element");
+
+ var htmlParent = _openedElements.Peek();
+ htmlParent.AppendChild(htmlInlineElement);
+ _openedElements.Push(htmlInlineElement);
+ }
+ }
+
+ private void ParseAttributes(XmlElement xmlElement)
+ {
+ while (_htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.Eof && //
+ _htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.TagEnd && //
+ _htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.EmptyTagEnd)
+ {
+ // read next attribute (name=value)
+ if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Name)
+ {
+ var attributeName = _htmlLexicalAnalyzer.NextToken;
+ _htmlLexicalAnalyzer.GetNextEqualSignToken();
+
+ _htmlLexicalAnalyzer.GetNextAtomToken();
+
+ var attributeValue = _htmlLexicalAnalyzer.NextToken;
+ xmlElement.SetAttribute(attributeName, attributeValue);
+ }
+ _htmlLexicalAnalyzer.GetNextTagToken();
+ }
+ }
+
+ #endregion Private Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Fields
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Fields
+
+ internal const string XhtmlNamespace = "http://www.w3.org/1999/xhtml";
+
+ private readonly HtmlLexicalAnalyzer _htmlLexicalAnalyzer;
+
+ // document from which all elements are created
+ private readonly XmlDocument _document;
+
+ // stack for open elements
+ private readonly Stack _openedElements;
+ private readonly Stack _pendingInlineElements;
+
+ #endregion Private Fields
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlSchema.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlSchema.cs
new file mode 100644
index 00000000..8c96cd39
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlSchema.cs
@@ -0,0 +1,733 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections;
+using System.Diagnostics;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ ///
+ /// HtmlSchema class
+ /// maintains static information about HTML structure
+ /// can be used by HtmlParser to check conditions under which an element starts or ends, etc.
+ ///
+ internal class HtmlSchema
+ {
+ // ---------------------------------------------------------------------
+ //
+ // Constructors
+ //
+ // ---------------------------------------------------------------------
+
+ #region Constructors
+
+ ///
+ /// static constructor, initializes the ArrayLists
+ /// that hold the elements in various sub-components of the schema
+ /// e.g _htmlEmptyElements, etc.
+ ///
+ static HtmlSchema()
+ {
+ // initializes the list of all html elements
+ InitializeInlineElements();
+
+ InitializeBlockElements();
+
+ InitializeOtherOpenableElements();
+
+ // initialize empty elements list
+ InitializeEmptyElements();
+
+ // initialize list of elements closing on the outer element end
+ InitializeElementsClosingOnParentElementEnd();
+
+ // initalize list of elements that close when a new element starts
+ InitializeElementsClosingOnNewElementStart();
+
+ // Initialize character entities
+ InitializeHtmlCharacterEntities();
+ }
+
+ #endregion Constructors;
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Methods
+
+ ///
+ /// returns true when xmlElementName corresponds to empty element
+ ///
+ ///
+ /// string representing name to test
+ ///
+ internal static bool IsEmptyElement(string xmlElementName) => _htmlEmptyElements.Contains(xmlElementName.ToLower());
+
+ ///
+ /// returns true if xmlElementName represents a block formattinng element.
+ /// It used in an algorithm of transferring inline elements over block elements
+ /// in HtmlParser
+ ///
+ ///
+ ///
+ internal static bool IsBlockElement(string xmlElementName) => _htmlBlockElements.Contains(xmlElementName);
+
+ ///
+ /// returns true if the xmlElementName represents an inline formatting element
+ ///
+ ///
+ ///
+ internal static bool IsInlineElement(string xmlElementName) => _htmlInlineElements.Contains(xmlElementName);
+
+ ///
+ /// It is a list of known html elements which we
+ /// want to allow to produce bt HTML parser,
+ /// but don'tt want to act as inline, block or no-scope.
+ /// Presence in this list will allow to open
+ /// elements during html parsing, and adding the
+ /// to a tree produced by html parser.
+ ///
+ internal static bool IsKnownOpenableElement(string xmlElementName) => _htmlOtherOpenableElements.Contains(xmlElementName);
+
+ ///
+ /// returns true when xmlElementName closes when the outer element closes
+ /// this is true of elements with optional start tags
+ ///
+ ///
+ /// string representing name to test
+ ///
+ internal static bool ClosesOnParentElementEnd(string xmlElementName) => _htmlElementsClosingOnParentElementEnd.Contains(xmlElementName.ToLower());
+
+ ///
+ /// returns true if the current element closes when the new element, whose name has just been read, starts
+ ///
+ ///
+ /// string representing current element name
+ ///
+ ///
+ /// string representing name of the next element that will start
+ internal static bool ClosesOnNextElementStart(string currentElementName, string nextElementName)
+ {
+ Debug.Assert(currentElementName == currentElementName.ToLower());
+ switch (currentElementName)
+ {
+ case "colgroup":
+ return _htmlElementsClosingColgroup.Contains(nextElementName) && IsBlockElement(nextElementName);
+ case "dd":
+ return _htmlElementsClosingDd.Contains(nextElementName) && IsBlockElement(nextElementName);
+ case "dt":
+ return _htmlElementsClosingDt.Contains(nextElementName) && IsBlockElement(nextElementName);
+ case "li":
+ return _htmlElementsClosingLi.Contains(nextElementName);
+ case "p":
+ return IsBlockElement(nextElementName);
+ case "tbody":
+ return _htmlElementsClosingTbody.Contains(nextElementName);
+ case "tfoot":
+ return _htmlElementsClosingTfoot.Contains(nextElementName);
+ case "thead":
+ return _htmlElementsClosingThead.Contains(nextElementName);
+ case "tr":
+ return _htmlElementsClosingTr.Contains(nextElementName);
+ case "td":
+ return _htmlElementsClosingTd.Contains(nextElementName);
+ case "th":
+ return _htmlElementsClosingTh.Contains(nextElementName);
+ }
+ return false;
+ }
+
+ ///
+ /// returns true if the string passed as argument is an Html entity name
+ ///
+ ///
+ /// string to be tested for Html entity name
+ ///
+ internal static bool IsEntity(string entityName)
+ {
+ // we do not convert entity strings to lowercase because these names are case-sensitive
+ if (_htmlCharacterEntities.Contains(entityName))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ ///
+ /// returns the character represented by the entity name string which is passed as an argument, if the string is an
+ /// entity name
+ /// as specified in _htmlCharacterEntities, returns the character value of 0 otherwise
+ ///
+ ///
+ /// string representing entity name whose character value is desired
+ ///
+ internal static char EntityCharacterValue(string entityName)
+ {
+ if (_htmlCharacterEntities.Contains(entityName))
+ {
+ return (char) _htmlCharacterEntities[entityName];
+ }
+ return (char) 0;
+ }
+
+ #endregion Internal Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal Properties
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Properties
+
+ #endregion Internal Indexers
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Methods
+
+ private static void InitializeInlineElements()
+ {
+ _htmlInlineElements = new ArrayList
+ {
+ "a",
+ "abbr",
+ "acronym",
+ "address",
+ "b",
+ "bdo",
+ "big",
+ "button",
+ "code",
+ "del",
+ "dfn",
+ "em",
+ "font",
+ "i",
+ "ins",
+ "kbd",
+ "label",
+ "legend",
+ "q",
+ "s",
+ "samp",
+ "small",
+ "span",
+ "strike",
+ "strong",
+ "sub",
+ "sup",
+ "u",
+ "var"
+ };
+ // ???
+ // deleted text
+ // inserted text
+ // text to entered by a user
+ // ???
+ // short inline quotation
+ // strike-through text style
+ // Specifies a code sample
+ // indicates an instance of a program variable
+ }
+
+ private static void InitializeBlockElements()
+ {
+ _htmlBlockElements = new ArrayList
+ {
+ "blockquote",
+ "body",
+ "caption",
+ "center",
+ "cite",
+ "dd",
+ "dir",
+ "div",
+ "dl",
+ "dt",
+ "form",
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "html",
+ "li",
+ "menu",
+ "ol",
+ "p",
+ "pre",
+ "table",
+ "tbody",
+ "td",
+ "textarea",
+ "tfoot",
+ "th",
+ "thead",
+ "tr",
+ "tt",
+ "ul"
+ };
+
+ // treat as UL element
+ // Not a block according to XHTML spec
+ // treat as UL element
+ // Renders text in a fixed-width font
+ }
+
+ ///
+ /// initializes _htmlEmptyElements with empty elements in HTML 4 spec at
+ /// http://www.w3.org/TR/REC-html40/index/elements.html
+ ///
+ private static void InitializeEmptyElements()
+ {
+ // Build a list of empty (no-scope) elements
+ // (element not requiring closing tags, and not accepting any content)
+ _htmlEmptyElements = new ArrayList
+ {
+ "area",
+ "base",
+ "basefont",
+ "br",
+ "col",
+ "frame",
+ "hr",
+ "img",
+ "input",
+ "isindex",
+ "link",
+ "meta",
+ "param"
+ };
+ }
+
+ private static void InitializeOtherOpenableElements()
+ {
+ // It is a list of known html elements which we
+ // want to allow to produce bt HTML parser,
+ // but don'tt want to act as inline, block or no-scope.
+ // Presence in this list will allow to open
+ // elements during html parsing, and adding the
+ // to a tree produced by html parser.
+ _htmlOtherOpenableElements = new ArrayList
+ {
+ "applet",
+ "base",
+ "basefont",
+ "colgroup",
+ "fieldset",
+ "frameset",
+ "head",
+ "iframe",
+ "map",
+ "noframes",
+ "noscript",
+ "object",
+ "optgroup",
+ "option",
+ "script",
+ "select",
+ "style",
+ "title"
+ };
+ //_htmlOtherOpenableElements.Add("form"); --> treated as block
+ }
+
+ ///
+ /// initializes _htmlElementsClosingOnParentElementEnd with the list of HTML 4 elements for which closing tags are
+ /// optional
+ /// we assume that for any element for which closing tags are optional, the element closes when it's outer element
+ /// (in which it is nested) does
+ ///
+ private static void InitializeElementsClosingOnParentElementEnd()
+ {
+ _htmlElementsClosingOnParentElementEnd = new ArrayList
+ {
+ "body",
+ "colgroup",
+ "dd",
+ "dt",
+ "head",
+ "html",
+ "li",
+ "p",
+ "tbody",
+ "td",
+ "tfoot",
+ "thead",
+ "th",
+ "tr"
+ };
+ }
+
+ private static void InitializeElementsClosingOnNewElementStart()
+ {
+ _htmlElementsClosingColgroup = new ArrayList {"colgroup", "tr", "thead", "tfoot", "tbody"};
+
+ _htmlElementsClosingDd = new ArrayList {"dd", "dt"};
+ // TODO: dd may end in other cases as well - if a new "p" starts, etc.
+ // TODO: these are the basic "legal" cases but there may be more recovery
+
+ _htmlElementsClosingDt = new ArrayList();
+ _htmlElementsClosingDd.Add("dd");
+ _htmlElementsClosingDd.Add("dt");
+ // TODO: dd may end in other cases as well - if a new "p" starts, etc.
+ // TODO: these are the basic "legal" cases but there may be more recovery
+
+ _htmlElementsClosingLi = new ArrayList {"li"};
+ // TODO: more complex recovery
+
+ _htmlElementsClosingTbody = new ArrayList {"tbody", "thead", "tfoot"};
+ // TODO: more complex recovery
+
+ _htmlElementsClosingTr = new ArrayList {"thead", "tfoot", "tbody", "tr"};
+ // NOTE: tr should not really close on a new thead
+ // because if there are rows before a thead, it is assumed to be in tbody, whose start tag is optional
+ // and thead can't come after tbody
+ // however, if we do encounter this, it's probably best to end the row and ignore the thead or treat
+ // it as part of the table
+ // TODO: more complex recovery
+
+ _htmlElementsClosingTd = new ArrayList {"td", "th", "tr", "tbody", "tfoot", "thead"};
+ // TODO: more complex recovery
+
+ _htmlElementsClosingTh = new ArrayList {"td", "th", "tr", "tbody", "tfoot", "thead"};
+ // TODO: more complex recovery
+
+ _htmlElementsClosingThead = new ArrayList {"tbody", "tfoot"};
+ // TODO: more complex recovery
+
+ _htmlElementsClosingTfoot = new ArrayList {"tbody", "thead"};
+ // although thead comes before tfoot, we add it because if it is found the tfoot should close
+ // and some recovery processing be done on the thead
+ // TODO: more complex recovery
+ }
+
+ ///
+ /// initializes _htmlCharacterEntities hashtable with the character corresponding to entity names
+ ///
+ private static void InitializeHtmlCharacterEntities()
+ {
+ _htmlCharacterEntities = new Hashtable
+ {
+ ["Aacute"] = (char) 193,
+ ["aacute"] = (char) 225,
+ ["Acirc"] = (char) 194,
+ ["acirc"] = (char) 226,
+ ["acute"] = (char) 180,
+ ["AElig"] = (char) 198,
+ ["aelig"] = (char) 230,
+ ["Agrave"] = (char) 192,
+ ["agrave"] = (char) 224,
+ ["alefsym"] = (char) 8501,
+ ["Alpha"] = (char) 913,
+ ["alpha"] = (char) 945,
+ ["amp"] = (char) 38,
+ ["and"] = (char) 8743,
+ ["ang"] = (char) 8736,
+ ["Aring"] = (char) 197,
+ ["aring"] = (char) 229,
+ ["asymp"] = (char) 8776,
+ ["Atilde"] = (char) 195,
+ ["atilde"] = (char) 227,
+ ["Auml"] = (char) 196,
+ ["auml"] = (char) 228,
+ ["bdquo"] = (char) 8222,
+ ["Beta"] = (char) 914,
+ ["beta"] = (char) 946,
+ ["brvbar"] = (char) 166,
+ ["bull"] = (char) 8226,
+ ["cap"] = (char) 8745,
+ ["Ccedil"] = (char) 199,
+ ["ccedil"] = (char) 231,
+ ["cent"] = (char) 162,
+ ["Chi"] = (char) 935,
+ ["chi"] = (char) 967,
+ ["circ"] = (char) 710,
+ ["clubs"] = (char) 9827,
+ ["cong"] = (char) 8773,
+ ["copy"] = (char) 169,
+ ["crarr"] = (char) 8629,
+ ["cup"] = (char) 8746,
+ ["curren"] = (char) 164,
+ ["dagger"] = (char) 8224,
+ ["Dagger"] = (char) 8225,
+ ["darr"] = (char) 8595,
+ ["dArr"] = (char) 8659,
+ ["deg"] = (char) 176,
+ ["Delta"] = (char) 916,
+ ["delta"] = (char) 948,
+ ["diams"] = (char) 9830,
+ ["divide"] = (char) 247,
+ ["Eacute"] = (char) 201,
+ ["eacute"] = (char) 233,
+ ["Ecirc"] = (char) 202,
+ ["ecirc"] = (char) 234,
+ ["Egrave"] = (char) 200,
+ ["egrave"] = (char) 232,
+ ["empty"] = (char) 8709,
+ ["emsp"] = (char) 8195,
+ ["ensp"] = (char) 8194,
+ ["Epsilon"] = (char) 917,
+ ["epsilon"] = (char) 949,
+ ["equiv"] = (char) 8801,
+ ["Eta"] = (char) 919,
+ ["eta"] = (char) 951,
+ ["ETH"] = (char) 208,
+ ["eth"] = (char) 240,
+ ["Euml"] = (char) 203,
+ ["euml"] = (char) 235,
+ ["euro"] = (char) 8364,
+ ["exist"] = (char) 8707,
+ ["fnof"] = (char) 402,
+ ["forall"] = (char) 8704,
+ ["frac12"] = (char) 189,
+ ["frac14"] = (char) 188,
+ ["frac34"] = (char) 190,
+ ["frasl"] = (char) 8260,
+ ["Gamma"] = (char) 915,
+ ["gamma"] = (char) 947,
+ ["ge"] = (char) 8805,
+ ["gt"] = (char) 62,
+ ["harr"] = (char) 8596,
+ ["hArr"] = (char) 8660,
+ ["hearts"] = (char) 9829,
+ ["hellip"] = (char) 8230,
+ ["Iacute"] = (char) 205,
+ ["iacute"] = (char) 237,
+ ["Icirc"] = (char) 206,
+ ["icirc"] = (char) 238,
+ ["iexcl"] = (char) 161,
+ ["Igrave"] = (char) 204,
+ ["igrave"] = (char) 236,
+ ["image"] = (char) 8465,
+ ["infin"] = (char) 8734,
+ ["int"] = (char) 8747,
+ ["Iota"] = (char) 921,
+ ["iota"] = (char) 953,
+ ["iquest"] = (char) 191,
+ ["isin"] = (char) 8712,
+ ["Iuml"] = (char) 207,
+ ["iuml"] = (char) 239,
+ ["Kappa"] = (char) 922,
+ ["kappa"] = (char) 954,
+ ["Lambda"] = (char) 923,
+ ["lambda"] = (char) 955,
+ ["lang"] = (char) 9001,
+ ["laquo"] = (char) 171,
+ ["larr"] = (char) 8592,
+ ["lArr"] = (char) 8656,
+ ["lceil"] = (char) 8968,
+ ["ldquo"] = (char) 8220,
+ ["le"] = (char) 8804,
+ ["lfloor"] = (char) 8970,
+ ["lowast"] = (char) 8727,
+ ["loz"] = (char) 9674,
+ ["lrm"] = (char) 8206,
+ ["lsaquo"] = (char) 8249,
+ ["lsquo"] = (char) 8216,
+ ["lt"] = (char) 60,
+ ["macr"] = (char) 175,
+ ["mdash"] = (char) 8212,
+ ["micro"] = (char) 181,
+ ["middot"] = (char) 183,
+ ["minus"] = (char) 8722,
+ ["Mu"] = (char) 924,
+ ["mu"] = (char) 956,
+ ["nabla"] = (char) 8711,
+ ["nbsp"] = (char) 160,
+ ["ndash"] = (char) 8211,
+ ["ne"] = (char) 8800,
+ ["ni"] = (char) 8715,
+ ["not"] = (char) 172,
+ ["notin"] = (char) 8713,
+ ["nsub"] = (char) 8836,
+ ["Ntilde"] = (char) 209,
+ ["ntilde"] = (char) 241,
+ ["Nu"] = (char) 925,
+ ["nu"] = (char) 957,
+ ["Oacute"] = (char) 211,
+ ["ocirc"] = (char) 244,
+ ["OElig"] = (char) 338,
+ ["oelig"] = (char) 339,
+ ["Ograve"] = (char) 210,
+ ["ograve"] = (char) 242,
+ ["oline"] = (char) 8254,
+ ["Omega"] = (char) 937,
+ ["omega"] = (char) 969,
+ ["Omicron"] = (char) 927,
+ ["omicron"] = (char) 959,
+ ["oplus"] = (char) 8853,
+ ["or"] = (char) 8744,
+ ["ordf"] = (char) 170,
+ ["ordm"] = (char) 186,
+ ["Oslash"] = (char) 216,
+ ["oslash"] = (char) 248,
+ ["Otilde"] = (char) 213,
+ ["otilde"] = (char) 245,
+ ["otimes"] = (char) 8855,
+ ["Ouml"] = (char) 214,
+ ["ouml"] = (char) 246,
+ ["para"] = (char) 182,
+ ["part"] = (char) 8706,
+ ["permil"] = (char) 8240,
+ ["perp"] = (char) 8869,
+ ["Phi"] = (char) 934,
+ ["phi"] = (char) 966,
+ ["pi"] = (char) 960,
+ ["piv"] = (char) 982,
+ ["plusmn"] = (char) 177,
+ ["pound"] = (char) 163,
+ ["prime"] = (char) 8242,
+ ["Prime"] = (char) 8243,
+ ["prod"] = (char) 8719,
+ ["prop"] = (char) 8733,
+ ["Psi"] = (char) 936,
+ ["psi"] = (char) 968,
+ ["quot"] = (char) 34,
+ ["radic"] = (char) 8730,
+ ["rang"] = (char) 9002,
+ ["raquo"] = (char) 187,
+ ["rarr"] = (char) 8594,
+ ["rArr"] = (char) 8658,
+ ["rceil"] = (char) 8969,
+ ["rdquo"] = (char) 8221,
+ ["real"] = (char) 8476,
+ ["reg"] = (char) 174,
+ ["rfloor"] = (char) 8971,
+ ["Rho"] = (char) 929,
+ ["rho"] = (char) 961,
+ ["rlm"] = (char) 8207,
+ ["rsaquo"] = (char) 8250,
+ ["rsquo"] = (char) 8217,
+ ["sbquo"] = (char) 8218,
+ ["Scaron"] = (char) 352,
+ ["scaron"] = (char) 353,
+ ["sdot"] = (char) 8901,
+ ["sect"] = (char) 167,
+ ["shy"] = (char) 173,
+ ["Sigma"] = (char) 931,
+ ["sigma"] = (char) 963,
+ ["sigmaf"] = (char) 962,
+ ["sim"] = (char) 8764,
+ ["spades"] = (char) 9824,
+ ["sub"] = (char) 8834,
+ ["sube"] = (char) 8838,
+ ["sum"] = (char) 8721,
+ ["sup"] = (char) 8835,
+ ["sup1"] = (char) 185,
+ ["sup2"] = (char) 178,
+ ["sup3"] = (char) 179,
+ ["supe"] = (char) 8839,
+ ["szlig"] = (char) 223,
+ ["Tau"] = (char) 932,
+ ["tau"] = (char) 964,
+ ["there4"] = (char) 8756,
+ ["Theta"] = (char) 920,
+ ["theta"] = (char) 952,
+ ["thetasym"] = (char) 977,
+ ["thinsp"] = (char) 8201,
+ ["THORN"] = (char) 222,
+ ["thorn"] = (char) 254,
+ ["tilde"] = (char) 732,
+ ["times"] = (char) 215,
+ ["trade"] = (char) 8482,
+ ["Uacute"] = (char) 218,
+ ["uacute"] = (char) 250,
+ ["uarr"] = (char) 8593,
+ ["uArr"] = (char) 8657,
+ ["Ucirc"] = (char) 219,
+ ["ucirc"] = (char) 251,
+ ["Ugrave"] = (char) 217,
+ ["ugrave"] = (char) 249,
+ ["uml"] = (char) 168,
+ ["upsih"] = (char) 978,
+ ["Upsilon"] = (char) 933,
+ ["upsilon"] = (char) 965,
+ ["Uuml"] = (char) 220,
+ ["uuml"] = (char) 252,
+ ["weierp"] = (char) 8472,
+ ["Xi"] = (char) 926,
+ ["xi"] = (char) 958,
+ ["Yacute"] = (char) 221,
+ ["yacute"] = (char) 253,
+ ["yen"] = (char) 165,
+ ["Yuml"] = (char) 376,
+ ["yuml"] = (char) 255,
+ ["Zeta"] = (char) 918,
+ ["zeta"] = (char) 950,
+ ["zwj"] = (char) 8205,
+ ["zwnj"] = (char) 8204
+ };
+ }
+
+ #endregion Private Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Fields
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Fields
+
+ // html element names
+ // this is an array list now, but we may want to make it a hashtable later for better performance
+ private static ArrayList _htmlInlineElements;
+
+ private static ArrayList _htmlBlockElements;
+
+ private static ArrayList _htmlOtherOpenableElements;
+
+ // list of html empty element names
+ private static ArrayList _htmlEmptyElements;
+
+ // names of html elements for which closing tags are optional, and close when the outer nested element closes
+ private static ArrayList _htmlElementsClosingOnParentElementEnd;
+
+ // names of elements that close certain optional closing tag elements when they start
+
+ // names of elements closing the colgroup element
+ private static ArrayList _htmlElementsClosingColgroup;
+
+ // names of elements closing the dd element
+ private static ArrayList _htmlElementsClosingDd;
+
+ // names of elements closing the dt element
+ private static ArrayList _htmlElementsClosingDt;
+
+ // names of elements closing the li element
+ private static ArrayList _htmlElementsClosingLi;
+
+ // names of elements closing the tbody element
+ private static ArrayList _htmlElementsClosingTbody;
+
+ // names of elements closing the td element
+ private static ArrayList _htmlElementsClosingTd;
+
+ // names of elements closing the tfoot element
+ private static ArrayList _htmlElementsClosingTfoot;
+
+ // names of elements closing the thead element
+ private static ArrayList _htmlElementsClosingThead;
+
+ // names of elements closing the th element
+ private static ArrayList _htmlElementsClosingTh;
+
+ // names of elements closing the tr element
+ private static ArrayList _htmlElementsClosingTr;
+
+ // html character entities hashtable
+ private static Hashtable _htmlCharacterEntities;
+
+ #endregion Private Fields
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlToXamlConverter.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlToXamlConverter.cs
new file mode 100644
index 00000000..328ab211
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlToXamlConverter.cs
@@ -0,0 +1,2755 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Documents;
+using System.Xml;
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ // DependencyProperty
+
+ // TextElement
+
+ ///
+ /// HtmlToXamlConverter is a static class that takes an HTML string
+ /// and converts it into XAML
+ ///
+ public static class HtmlToXamlConverter
+ {
+ // ----------------------------------------------------------------
+ //
+ // Internal Constants
+ //
+ // ----------------------------------------------------------------
+
+ // The constants reprtesent all Xaml names used in a conversion
+ public const string XamlFlowDocument = "FlowDocument";
+ public const string XamlRun = "Run";
+ public const string XamlSpan = "Span";
+ public const string XamlHyperlink = "Hyperlink";
+ public const string XamlHyperlinkNavigateUri = "NavigateUri";
+ public const string XamlHyperlinkTargetName = "TargetName";
+ public const string XamlSection = "Section";
+ public const string XamlList = "List";
+ public const string XamlListMarkerStyle = "MarkerStyle";
+ public const string XamlListMarkerStyleNone = "None";
+ public const string XamlListMarkerStyleDecimal = "Decimal";
+ public const string XamlListMarkerStyleDisc = "Disc";
+ public const string XamlListMarkerStyleCircle = "Circle";
+ public const string XamlListMarkerStyleSquare = "Square";
+ public const string XamlListMarkerStyleBox = "Box";
+ public const string XamlListMarkerStyleLowerLatin = "LowerLatin";
+ public const string XamlListMarkerStyleUpperLatin = "UpperLatin";
+ public const string XamlListMarkerStyleLowerRoman = "LowerRoman";
+ public const string XamlListMarkerStyleUpperRoman = "UpperRoman";
+ public const string XamlListItem = "ListItem";
+ public const string XamlLineBreak = "LineBreak";
+ public const string XamlParagraph = "Paragraph";
+ public const string XamlMargin = "Margin";
+ public const string XamlPadding = "Padding";
+ public const string XamlBorderBrush = "BorderBrush";
+ public const string XamlBorderThickness = "BorderThickness";
+ public const string XamlTable = "Table";
+ public const string XamlTableColumn = "TableColumn";
+ public const string XamlTableRowGroup = "TableRowGroup";
+ public const string XamlTableRow = "TableRow";
+ public const string XamlTableCell = "TableCell";
+ public const string XamlTableCellBorderThickness = "BorderThickness";
+ public const string XamlTableCellBorderBrush = "BorderBrush";
+ public const string XamlTableCellColumnSpan = "ColumnSpan";
+ public const string XamlTableCellRowSpan = "RowSpan";
+ public const string XamlWidth = "Width";
+ public const string XamlBrushesBlack = "Black";
+ public const string XamlFontFamily = "FontFamily";
+ public const string XamlFontSize = "FontSize";
+ public const string XamlFontSizeXxLarge = "22pt"; // "XXLarge";
+ public const string XamlFontSizeXLarge = "20pt"; // "XLarge";
+ public const string XamlFontSizeLarge = "18pt"; // "Large";
+ public const string XamlFontSizeMedium = "16pt"; // "Medium";
+ public const string XamlFontSizeSmall = "12pt"; // "Small";
+ public const string XamlFontSizeXSmall = "10pt"; // "XSmall";
+ public const string XamlFontSizeXxSmall = "8pt"; // "XXSmall";
+ public const string XamlFontWeight = "FontWeight";
+ public const string XamlFontWeightBold = "Bold";
+ public const string XamlFontStyle = "FontStyle";
+ public const string XamlForeground = "Foreground";
+ public const string XamlBackground = "Background";
+ public const string XamlTextDecorations = "TextDecorations";
+ public const string XamlTextDecorationsUnderline = "Underline";
+ public const string XamlTextIndent = "TextIndent";
+ public const string XamlTextAlignment = "TextAlignment";
+ // ---------------------------------------------------------------------
+ //
+ // Private Fields
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Fields
+
+ private static readonly string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
+
+ #endregion Private Fields
+
+ // ---------------------------------------------------------------------
+ //
+ // Internal Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Internal Methods
+
+ ///
+ /// Converts an html string into xaml string.
+ ///
+ ///
+ /// Input html which may be badly formated xml.
+ ///
+ ///
+ /// true indicates that we need a FlowDocument as a root element;
+ /// false means that Section or Span elements will be used
+ /// dependeing on StartFragment/EndFragment comments locations.
+ ///
+ ///
+ /// Well-formed xml representing XAML equivalent for the input html string.
+ ///
+ public static string ConvertHtmlToXaml(string htmlString, bool asFlowDocument)
+ {
+ // Create well-formed Xml from Html string
+ var htmlElement = HtmlParser.ParseHtml(htmlString);
+
+ // Decide what name to use as a root
+ var rootElementName = asFlowDocument ? XamlFlowDocument : XamlSection;
+
+ // Create an XmlDocument for generated xaml
+ var xamlTree = new XmlDocument();
+ var xamlFlowDocumentElement = xamlTree.CreateElement(null, rootElementName, XamlNamespace);
+
+ // Extract style definitions from all STYLE elements in the document
+ var stylesheet = new CssStylesheet(htmlElement);
+
+ // Source context is a stack of all elements - ancestors of a parentElement
+ var sourceContext = new List(10);
+
+ // Clear fragment parent
+ _inlineFragmentParentElement = null;
+
+ // convert root html element
+ AddBlock(xamlFlowDocumentElement, htmlElement, new Hashtable(), stylesheet, sourceContext);
+
+ // In case if the selected fragment is inline, extract it into a separate Span wrapper
+ if (!asFlowDocument)
+ {
+ xamlFlowDocumentElement = ExtractInlineFragment(xamlFlowDocumentElement);
+ }
+
+ // Return a string representing resulting Xaml
+ xamlFlowDocumentElement.SetAttribute("xml:space", "preserve");
+ var xaml = xamlFlowDocumentElement.OuterXml;
+
+ return xaml;
+ }
+
+ ///
+ /// Returns a value for an attribute by its name (ignoring casing)
+ ///
+ ///
+ /// XmlElement in which we are trying to find the specified attribute
+ ///
+ ///
+ /// String representing the attribute name to be searched for
+ ///
+ ///
+ public static string GetAttribute(XmlElement element, string attributeName)
+ {
+ attributeName = attributeName.ToLower();
+
+ for (var i = 0; i < element.Attributes.Count; i++)
+ {
+ if (element.Attributes[i].Name.ToLower() == attributeName)
+ {
+ return element.Attributes[i].Value;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Returns string extracted from quotation marks
+ ///
+ ///
+ /// String representing value enclosed in quotation marks
+ ///
+ internal static string UnQuote(string value)
+ {
+ if (value.StartsWith("\"") && value.EndsWith("\"") || value.StartsWith("'") && value.EndsWith("'"))
+ {
+ value = value.Substring(1, value.Length - 2).Trim();
+ }
+ return value;
+ }
+
+ #endregion Internal Methods
+
+ // ---------------------------------------------------------------------
+ //
+ // Private Methods
+ //
+ // ---------------------------------------------------------------------
+
+ #region Private Methods
+
+ ///
+ /// Analyzes the given htmlElement expecting it to be converted
+ /// into some of xaml Block elements and adds the converted block
+ /// to the children collection of xamlParentElement.
+ /// Analyzes the given XmlElement htmlElement, recognizes it as some HTML element
+ /// and adds it as a child to a xamlParentElement.
+ /// In some cases several following siblings of the given htmlElement
+ /// will be consumed too (e.g. LIs encountered without wrapping UL/OL,
+ /// which must be collected together and wrapped into one implicit List element).
+ ///
+ ///
+ /// Parent xaml element, to which new converted element will be added
+ ///
+ ///
+ /// Source html element subject to convert to xaml.
+ ///
+ ///
+ /// Properties inherited from an outer context.
+ ///
+ ///
+ ///
+ ///
+ /// Last processed html node. Normally it should be the same htmlElement
+ /// as was passed as a paramater, but in some irregular cases
+ /// it could one of its following siblings.
+ /// The caller must use this node to get to next sibling from it.
+ ///
+ private static XmlNode AddBlock(XmlElement xamlParentElement, XmlNode htmlNode, Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ if (htmlNode is XmlComment)
+ {
+ DefineInlineFragmentParent((XmlComment) htmlNode, /*xamlParentElement:*/null);
+ }
+ else if (htmlNode is XmlText)
+ {
+ htmlNode = AddImplicitParagraph(xamlParentElement, htmlNode, inheritedProperties, stylesheet,
+ sourceContext);
+ }
+ else if (htmlNode is XmlElement)
+ {
+ // Identify element name
+ var htmlElement = (XmlElement) htmlNode;
+
+ var htmlElementName = htmlElement.LocalName; // Keep the name case-sensitive to check xml names
+ var htmlElementNamespace = htmlElement.NamespaceURI;
+
+ if (htmlElementNamespace != HtmlParser.XhtmlNamespace)
+ {
+ // Non-html element. skip it
+ // Isn't it too agressive? What if this is just an error in html tag name?
+ // TODO: Consider skipping just a wparrer in recursing into the element tree,
+ // which may produce some garbage though coming from xml fragments.
+ return htmlElement;
+ }
+
+ // Put source element to the stack
+ sourceContext.Add(htmlElement);
+
+ // Convert the name to lowercase, because html elements are case-insensitive
+ htmlElementName = htmlElementName.ToLower();
+
+ // Switch to an appropriate kind of processing depending on html element name
+ switch (htmlElementName)
+ {
+ // Sections:
+ case "html":
+ case "body":
+ case "div":
+ case "form": // not a block according to xhtml spec
+ case "pre": // Renders text in a fixed-width font
+ case "blockquote":
+ case "caption":
+ case "center":
+ case "cite":
+ AddSection(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+
+ // Paragraphs:
+ case "p":
+ case "h1":
+ case "h2":
+ case "h3":
+ case "h4":
+ case "h5":
+ case "h6":
+ case "nsrtitle":
+ case "textarea":
+ case "dd": // ???
+ case "dl": // ???
+ case "dt": // ???
+ case "tt": // ???
+ AddParagraph(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+
+ case "ol":
+ case "ul":
+ case "dir": // treat as UL element
+ case "menu": // treat as UL element
+ // List element conversion
+ AddList(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+ case "li":
+ // LI outside of OL/UL
+ // Collect all sibling LIs, wrap them into a List and then proceed with the element following the last of LIs
+ htmlNode = AddOrphanListItems(xamlParentElement, htmlElement, inheritedProperties, stylesheet,
+ sourceContext);
+ break;
+
+ case "img":
+ // TODO: Add image processing
+ AddImage(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+
+ case "table":
+ // hand off to table parsing function which will perform special table syntax checks
+ AddTable(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+
+ case "tbody":
+ case "tfoot":
+ case "thead":
+ case "tr":
+ case "td":
+ case "th":
+ // Table stuff without table wrapper
+ // TODO: add special-case processing here for elements that should be within tables when the
+ // parent element is NOT a table. If the parent element is a table they can be processed normally.
+ // we need to compare against the parent element here, we can't just break on a switch
+ goto default; // Thus we will skip this element as unknown, but still recurse into it.
+
+ case "style": // We already pre-processed all style elements. Ignore it now
+ case "meta":
+ case "head":
+ case "title":
+ case "script":
+ // Ignore these elements
+ break;
+
+ default:
+ // Wrap a sequence of inlines into an implicit paragraph
+ htmlNode = AddImplicitParagraph(xamlParentElement, htmlElement, inheritedProperties, stylesheet,
+ sourceContext);
+ break;
+ }
+
+ // Remove the element from the stack
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlElement);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+ }
+
+ // Return last processed node
+ return htmlNode;
+ }
+
+ // .............................................................
+ //
+ // Line Breaks
+ //
+ // .............................................................
+
+ private static void AddBreak(XmlElement xamlParentElement, string htmlElementName)
+ {
+ // Create new xaml element corresponding to this html element
+ var xamlLineBreak = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlLineBreak, XamlNamespace);
+ xamlParentElement.AppendChild(xamlLineBreak);
+ if (htmlElementName == "hr")
+ {
+ var xamlHorizontalLine = xamlParentElement.OwnerDocument.CreateTextNode("----------------------");
+ xamlParentElement.AppendChild(xamlHorizontalLine);
+ xamlLineBreak = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlLineBreak, XamlNamespace);
+ xamlParentElement.AppendChild(xamlLineBreak);
+ }
+ }
+
+ // .............................................................
+ //
+ // Text Flow Elements
+ //
+ // .............................................................
+
+ ///
+ /// Generates Section or Paragraph element from DIV depending whether it contains any block elements or not
+ ///
+ ///
+ /// XmlElement representing Xaml parent to which the converted element should be added
+ ///
+ ///
+ /// XmlElement representing Html element to be converted
+ ///
+ ///
+ /// properties inherited from parent context
+ ///
+ ///
+ ///
+ /// true indicates that a content added by this call contains at least one block element
+ ///
+ private static void AddSection(XmlElement xamlParentElement, XmlElement htmlElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Analyze the content of htmlElement to decide what xaml element to choose - Section or Paragraph.
+ // If this Div has at least one block child then we need to use Section, otherwise use Paragraph
+ var htmlElementContainsBlocks = false;
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ if (htmlChildNode is XmlElement)
+ {
+ var htmlChildName = ((XmlElement) htmlChildNode).LocalName.ToLower();
+ if (HtmlSchema.IsBlockElement(htmlChildName))
+ {
+ htmlElementContainsBlocks = true;
+ break;
+ }
+ }
+ }
+
+ if (!htmlElementContainsBlocks)
+ {
+ // The Div does not contain any block elements, so we can treat it as a Paragraph
+ AddParagraph(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ }
+ else
+ {
+ // The Div has some nested blocks, so we treat it as a Section
+
+ // Create currentProperties as a compilation of local and inheritedProperties, set localProperties
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlElement, inheritedProperties, out localProperties,
+ stylesheet,
+ sourceContext);
+
+ // Create a XAML element corresponding to this html element
+ var xamlElement = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlSection, XamlNamespace);
+ ApplyLocalProperties(xamlElement, localProperties, /*isBlock:*/true);
+
+ // Decide whether we can unwrap this element as not having any formatting significance.
+ if (!xamlElement.HasAttributes)
+ {
+ // This elements is a group of block elements whitout any additional formatting.
+ // We can add blocks directly to xamlParentElement and avoid
+ // creating unnecessary Sections nesting.
+ xamlElement = xamlParentElement;
+ }
+
+ // Recurse into element subtree
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode?.NextSibling)
+ {
+ htmlChildNode = AddBlock(xamlElement, htmlChildNode, currentProperties, stylesheet, sourceContext);
+ }
+
+ // Add the new element to the parent.
+ if (xamlElement != xamlParentElement)
+ {
+ xamlParentElement.AppendChild(xamlElement);
+ }
+ }
+ }
+
+ ///
+ /// Generates Paragraph element from P, H1-H7, Center etc.
+ ///
+ ///
+ /// XmlElement representing Xaml parent to which the converted element should be added
+ ///
+ ///
+ /// XmlElement representing Html element to be converted
+ ///
+ ///
+ /// properties inherited from parent context
+ ///
+ ///
+ ///
+ /// true indicates that a content added by this call contains at least one block element
+ ///
+ private static void AddParagraph(XmlElement xamlParentElement, XmlElement htmlElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Create currentProperties as a compilation of local and inheritedProperties, set localProperties
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlElement, inheritedProperties, out localProperties,
+ stylesheet,
+ sourceContext);
+
+ // Create a XAML element corresponding to this html element
+ var xamlElement = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlParagraph, XamlNamespace);
+ ApplyLocalProperties(xamlElement, localProperties, /*isBlock:*/true);
+
+ // Recurse into element subtree
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ AddInline(xamlElement, htmlChildNode, currentProperties, stylesheet, sourceContext);
+ }
+
+ // Add the new element to the parent.
+ xamlParentElement.AppendChild(xamlElement);
+ }
+
+ ///
+ /// Creates a Paragraph element and adds all nodes starting from htmlNode
+ /// converted to appropriate Inlines.
+ ///
+ ///
+ /// XmlElement representing Xaml parent to which the converted element should be added
+ ///
+ ///
+ /// XmlNode starting a collection of implicitly wrapped inlines.
+ ///
+ ///
+ /// properties inherited from parent context
+ ///
+ ///
+ ///
+ /// true indicates that a content added by this call contains at least one block element
+ ///
+ ///
+ /// The last htmlNode added to the implicit paragraph
+ ///
+ private static XmlNode AddImplicitParagraph(XmlElement xamlParentElement, XmlNode htmlNode,
+ Hashtable inheritedProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ // Collect all non-block elements and wrap them into implicit Paragraph
+ var xamlParagraph = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlParagraph, XamlNamespace);
+ XmlNode lastNodeProcessed = null;
+ while (htmlNode != null)
+ {
+ if (htmlNode is XmlComment)
+ {
+ DefineInlineFragmentParent((XmlComment) htmlNode, /*xamlParentElement:*/null);
+ }
+ else if (htmlNode is XmlText)
+ {
+ if (htmlNode.Value.Trim().Length > 0)
+ {
+ AddTextRun(xamlParagraph, htmlNode.Value);
+ }
+ }
+ else if (htmlNode is XmlElement)
+ {
+ var htmlChildName = ((XmlElement) htmlNode).LocalName.ToLower();
+ if (HtmlSchema.IsBlockElement(htmlChildName))
+ {
+ // The sequence of non-blocked inlines ended. Stop implicit loop here.
+ break;
+ }
+ AddInline(xamlParagraph, (XmlElement) htmlNode, inheritedProperties, stylesheet, sourceContext);
+ }
+
+ // Store last processed node to return it at the end
+ lastNodeProcessed = htmlNode;
+ htmlNode = htmlNode.NextSibling;
+ }
+
+ // Add the Paragraph to the parent
+ // If only whitespaces and commens have been encountered,
+ // then we have nothing to add in implicit paragraph; forget it.
+ if (xamlParagraph.FirstChild != null)
+ {
+ xamlParentElement.AppendChild(xamlParagraph);
+ }
+
+ // Need to return last processed node
+ return lastNodeProcessed;
+ }
+
+ // .............................................................
+ //
+ // Inline Elements
+ //
+ // .............................................................
+
+ private static void AddInline(XmlElement xamlParentElement, XmlNode htmlNode, Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ if (htmlNode is XmlComment)
+ {
+ DefineInlineFragmentParent((XmlComment) htmlNode, xamlParentElement);
+ }
+ else if (htmlNode is XmlText)
+ {
+ AddTextRun(xamlParentElement, htmlNode.Value);
+ }
+ else if (htmlNode is XmlElement)
+ {
+ var htmlElement = (XmlElement) htmlNode;
+
+ // Check whether this is an html element
+ if (htmlElement.NamespaceURI != HtmlParser.XhtmlNamespace)
+ {
+ return; // Skip non-html elements
+ }
+
+ // Identify element name
+ var htmlElementName = htmlElement.LocalName.ToLower();
+
+ // Put source element to the stack
+ sourceContext.Add(htmlElement);
+
+ switch (htmlElementName)
+ {
+ case "a":
+ AddHyperlink(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+ case "img":
+ AddImage(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ break;
+ case "br":
+ case "hr":
+ AddBreak(xamlParentElement, htmlElementName);
+ break;
+ default:
+ if (HtmlSchema.IsInlineElement(htmlElementName) || HtmlSchema.IsBlockElement(htmlElementName))
+ {
+ // Note: actually we do not expect block elements here,
+ // but if it happens to be here, we will treat it as a Span.
+
+ AddSpanOrRun(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ }
+ break;
+ }
+ // Ignore all other elements non-(block/inline/image)
+
+ // Remove the element from the stack
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlElement);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+ }
+ }
+
+ private static void AddSpanOrRun(XmlElement xamlParentElement, XmlElement htmlElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Decide what XAML element to use for this inline element.
+ // Check whether it contains any nested inlines
+ var elementHasChildren = false;
+ for (var htmlNode = htmlElement.FirstChild; htmlNode != null; htmlNode = htmlNode.NextSibling)
+ {
+ if (htmlNode is XmlElement)
+ {
+ var htmlChildName = ((XmlElement) htmlNode).LocalName.ToLower();
+ if (HtmlSchema.IsInlineElement(htmlChildName) || HtmlSchema.IsBlockElement(htmlChildName) ||
+ htmlChildName == "img" || htmlChildName == "br" || htmlChildName == "hr")
+ {
+ elementHasChildren = true;
+ break;
+ }
+ }
+ }
+
+ var xamlElementName = elementHasChildren ? XamlSpan : XamlRun;
+
+ // Create currentProperties as a compilation of local and inheritedProperties, set localProperties
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlElement, inheritedProperties, out localProperties,
+ stylesheet,
+ sourceContext);
+
+ // Create a XAML element corresponding to this html element
+ var xamlElement = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/xamlElementName, XamlNamespace);
+ ApplyLocalProperties(xamlElement, localProperties, /*isBlock:*/false);
+
+ // Recurse into element subtree
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ AddInline(xamlElement, htmlChildNode, currentProperties, stylesheet, sourceContext);
+ }
+
+ // Add the new element to the parent.
+ xamlParentElement.AppendChild(xamlElement);
+ }
+
+ // Adds a text run to a xaml tree
+ private static void AddTextRun(XmlElement xamlElement, string textData)
+ {
+ // Remove control characters
+ for (var i = 0; i < textData.Length; i++)
+ {
+ if (char.IsControl(textData[i]))
+ {
+ textData = textData.Remove(i--, 1); // decrement i to compensate for character removal
+ }
+ }
+
+ // Replace No-Breaks by spaces (160 is a code of entity in html)
+ // This is a work around since WPF/XAML does not support  .
+ textData = textData.Replace((char) 160, ' ');
+
+ if (textData.Length > 0)
+ {
+ xamlElement.AppendChild(xamlElement.OwnerDocument.CreateTextNode(textData));
+ }
+ }
+
+ private static void AddHyperlink(XmlElement xamlParentElement, XmlElement htmlElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Convert href attribute into NavigateUri and TargetName
+ var href = GetAttribute(htmlElement, "href");
+ if (href == null)
+ {
+ // When href attribute is missing - ignore the hyperlink
+ AddSpanOrRun(xamlParentElement, htmlElement, inheritedProperties, stylesheet, sourceContext);
+ }
+ else
+ {
+ // Create currentProperties as a compilation of local and inheritedProperties, set localProperties
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlElement, inheritedProperties, out localProperties,
+ stylesheet,
+ sourceContext);
+
+ // Create a XAML element corresponding to this html element
+ var xamlElement = xamlParentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlHyperlink, XamlNamespace);
+ ApplyLocalProperties(xamlElement, localProperties, /*isBlock:*/false);
+
+ var hrefParts = href.Split('#');
+ if (hrefParts.Length > 0 && hrefParts[0].Trim().Length > 0)
+ {
+ xamlElement.SetAttribute(XamlHyperlinkNavigateUri, hrefParts[0].Trim());
+ }
+ if (hrefParts.Length == 2 && hrefParts[1].Trim().Length > 0)
+ {
+ xamlElement.SetAttribute(XamlHyperlinkTargetName, hrefParts[1].Trim());
+ }
+
+ // Recurse into element subtree
+ for (var htmlChildNode = htmlElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ AddInline(xamlElement, htmlChildNode, currentProperties, stylesheet, sourceContext);
+ }
+
+ // Add the new element to the parent.
+ xamlParentElement.AppendChild(xamlElement);
+ }
+ }
+
+ // Stores a parent xaml element for the case when selected fragment is inline.
+ private static XmlElement _inlineFragmentParentElement;
+
+ // Called when html comment is encountered to store a parent element
+ // for the case when the fragment is inline - to extract it to a separate
+ // Span wrapper after the conversion.
+ private static void DefineInlineFragmentParent(XmlComment htmlComment, XmlElement xamlParentElement)
+ {
+ if (htmlComment.Value == "StartFragment")
+ {
+ _inlineFragmentParentElement = xamlParentElement;
+ }
+ else if (htmlComment.Value == "EndFragment")
+ {
+ if (_inlineFragmentParentElement == null && xamlParentElement != null)
+ {
+ // Normally this cannot happen if comments produced by correct copying code
+ // in Word or IE, but when it is produced manually then fragment boundary
+ // markers can be inconsistent. In this case StartFragment takes precedence,
+ // but if it is not set, then we get the value from EndFragment marker.
+ _inlineFragmentParentElement = xamlParentElement;
+ }
+ }
+ }
+
+ // Extracts a content of an element stored as InlineFragmentParentElement
+ // into a separate Span wrapper.
+ // Note: when selected content does not cross paragraph boundaries,
+ // the fragment is marked within
+ private static XmlElement ExtractInlineFragment(XmlElement xamlFlowDocumentElement)
+ {
+ if (_inlineFragmentParentElement != null)
+ {
+ if (_inlineFragmentParentElement.LocalName == XamlSpan)
+ {
+ xamlFlowDocumentElement = _inlineFragmentParentElement;
+ }
+ else
+ {
+ xamlFlowDocumentElement = xamlFlowDocumentElement.OwnerDocument.CreateElement( /*prefix:*/
+ null, /*localName:*/XamlSpan, XamlNamespace);
+ while (_inlineFragmentParentElement.FirstChild != null)
+ {
+ var copyNode = _inlineFragmentParentElement.FirstChild;
+ _inlineFragmentParentElement.RemoveChild(copyNode);
+ xamlFlowDocumentElement.AppendChild(copyNode);
+ }
+ }
+ }
+
+ return xamlFlowDocumentElement;
+ }
+
+ // .............................................................
+ //
+ // Images
+ //
+ // .............................................................
+
+ private static void AddImage(XmlElement xamlParentElement, XmlElement htmlElement, Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Implement images
+ }
+
+ // .............................................................
+ //
+ // Lists
+ //
+ // .............................................................
+
+ ///
+ /// Converts Html ul or ol element into Xaml list element. During conversion if the ul/ol element has any children
+ /// that are not li elements, they are ignored and not added to the list element
+ ///
+ ///
+ /// XmlElement representing Xaml parent to which the converted element should be added
+ ///
+ ///
+ /// XmlElement representing Html ul/ol element to be converted
+ ///
+ ///
+ /// properties inherited from parent context
+ ///
+ ///
+ ///
+ private static void AddList(XmlElement xamlParentElement, XmlElement htmlListElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ var htmlListElementName = htmlListElement.LocalName.ToLower();
+
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlListElement, inheritedProperties, out localProperties,
+ stylesheet, sourceContext);
+
+ // Create Xaml List element
+ var xamlListElement = xamlParentElement.OwnerDocument.CreateElement(null, XamlList, XamlNamespace);
+
+ // Set default list markers
+ xamlListElement.SetAttribute(XamlListMarkerStyle,
+ htmlListElementName == "ol" ? XamlListMarkerStyleDecimal : XamlListMarkerStyleDisc);
+
+ // Apply local properties to list to set marker attribute if specified
+ // TODO: Should we have separate list attribute processing function?
+ ApplyLocalProperties(xamlListElement, localProperties, /*isBlock:*/true);
+
+ // Recurse into list subtree
+ for (var htmlChildNode = htmlListElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ if (htmlChildNode is XmlElement && htmlChildNode.LocalName.ToLower() == "li")
+ {
+ sourceContext.Add((XmlElement) htmlChildNode);
+ AddListItem(xamlListElement, (XmlElement) htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlChildNode);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+ }
+ }
+
+ // Add the List element to xaml tree - if it is not empty
+ if (xamlListElement.HasChildNodes)
+ {
+ xamlParentElement.AppendChild(xamlListElement);
+ }
+ }
+
+ ///
+ /// If li items are found without a parent ul/ol element in Html string, creates xamlListElement as their parent and
+ /// adds
+ /// them to it. If the previously added node to the same xamlParentElement was a List, adds the elements to that list.
+ /// Otherwise, we create a new xamlListElement and add them to it. Elements are added as long as li elements appear
+ /// sequentially.
+ /// The first non-li or text node stops the addition.
+ ///
+ ///
+ /// Parent element for the list
+ ///
+ ///
+ /// Start Html li element without parent list
+ ///
+ ///
+ /// Properties inherited from parent context
+ ///
+ ///
+ /// XmlNode representing the first non-li node in the input after one or more li's have been processed.
+ ///
+ private static XmlElement AddOrphanListItems(XmlElement xamlParentElement, XmlElement htmlLiElement,
+ Hashtable inheritedProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ Debug.Assert(htmlLiElement.LocalName.ToLower() == "li");
+
+ XmlElement lastProcessedListItemElement = null;
+
+ // Find out the last element attached to the xamlParentElement, which is the previous sibling of this node
+ var xamlListItemElementPreviousSibling = xamlParentElement.LastChild;
+ XmlElement xamlListElement;
+ if (xamlListItemElementPreviousSibling != null && xamlListItemElementPreviousSibling.LocalName == XamlList)
+ {
+ // Previously added Xaml element was a list. We will add the new li to it
+ xamlListElement = (XmlElement) xamlListItemElementPreviousSibling;
+ }
+ else
+ {
+ // No list element near. Create our own.
+ xamlListElement = xamlParentElement.OwnerDocument.CreateElement(null, XamlList, XamlNamespace);
+ xamlParentElement.AppendChild(xamlListElement);
+ }
+
+ XmlNode htmlChildNode = htmlLiElement;
+ var htmlChildNodeName = htmlChildNode == null ? null : htmlChildNode.LocalName.ToLower();
+
+ // Current element properties missed here.
+ //currentProperties = GetElementProperties(htmlLIElement, inheritedProperties, out localProperties, stylesheet);
+
+ // Add li elements to the parent xamlListElement we created as long as they appear sequentially
+ // Use properties inherited from xamlParentElement for context
+ while (htmlChildNode != null && htmlChildNodeName == "li")
+ {
+ AddListItem(xamlListElement, (XmlElement) htmlChildNode, inheritedProperties, stylesheet, sourceContext);
+ lastProcessedListItemElement = (XmlElement) htmlChildNode;
+ htmlChildNode = htmlChildNode.NextSibling;
+ htmlChildNodeName = htmlChildNode?.LocalName.ToLower();
+ }
+
+ return lastProcessedListItemElement;
+ }
+
+ ///
+ /// Converts htmlLIElement into Xaml ListItem element, and appends it to the parent xamlListElement
+ ///
+ ///
+ /// XmlElement representing Xaml List element to which the converted td/th should be added
+ ///
+ ///
+ /// XmlElement representing Html li element to be converted
+ ///
+ ///
+ /// Properties inherited from parent context
+ ///
+ private static void AddListItem(XmlElement xamlListElement, XmlElement htmlLiElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Parameter validation
+ Debug.Assert(xamlListElement != null);
+ Debug.Assert(xamlListElement.LocalName == XamlList);
+ Debug.Assert(htmlLiElement != null);
+ Debug.Assert(htmlLiElement.LocalName.ToLower() == "li");
+ Debug.Assert(inheritedProperties != null);
+
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlLiElement, inheritedProperties, out localProperties,
+ stylesheet, sourceContext);
+
+ var xamlListItemElement = xamlListElement.OwnerDocument.CreateElement(null, XamlListItem,
+ XamlNamespace);
+
+ // TODO: process local properties for li element
+
+ // Process children of the ListItem
+ for (var htmlChildNode = htmlLiElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode?.NextSibling)
+ {
+ htmlChildNode = AddBlock(xamlListItemElement, htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ }
+
+ // Add resulting ListBoxItem to a xaml parent
+ xamlListElement.AppendChild(xamlListItemElement);
+ }
+
+ // .............................................................
+ //
+ // Tables
+ //
+ // .............................................................
+
+ ///
+ /// Converts htmlTableElement to a Xaml Table element. Adds tbody elements if they are missing so
+ /// that a resulting Xaml Table element is properly formed.
+ ///
+ ///
+ /// Parent xaml element to which a converted table must be added.
+ ///
+ ///
+ /// XmlElement reprsenting the Html table element to be converted
+ ///
+ ///
+ /// Hashtable representing properties inherited from parent context.
+ ///
+ private static void AddTable(XmlElement xamlParentElement, XmlElement htmlTableElement,
+ Hashtable inheritedProperties,
+ CssStylesheet stylesheet, List sourceContext)
+ {
+ // Parameter validation
+ Debug.Assert(htmlTableElement.LocalName.ToLower() == "table");
+ Debug.Assert(xamlParentElement != null);
+ Debug.Assert(inheritedProperties != null);
+
+ // Create current properties to be used by children as inherited properties, set local properties
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlTableElement, inheritedProperties,
+ out localProperties,
+ stylesheet, sourceContext);
+
+ // TODO: process localProperties for tables to override defaults, decide cell spacing defaults
+
+ // Check if the table contains only one cell - we want to take only its content
+ var singleCell = GetCellFromSingleCellTable(htmlTableElement);
+
+ if (singleCell != null)
+ {
+ // Need to push skipped table elements onto sourceContext
+ sourceContext.Add(singleCell);
+
+ // Add the cell's content directly to parent
+ for (var htmlChildNode = singleCell.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode?.NextSibling)
+ {
+ htmlChildNode = AddBlock(xamlParentElement, htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ }
+
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == singleCell);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+ }
+ else
+ {
+ // Create xamlTableElement
+ var xamlTableElement = xamlParentElement.OwnerDocument.CreateElement(null, XamlTable,
+ XamlNamespace);
+
+ // Analyze table structure for column widths and rowspan attributes
+ var columnStarts = AnalyzeTableStructure(htmlTableElement, stylesheet);
+
+ // Process COLGROUP & COL elements
+ AddColumnInformation(htmlTableElement, xamlTableElement, columnStarts, currentProperties, stylesheet,
+ sourceContext);
+
+ // Process table body - TBODY and TR elements
+ var htmlChildNode = htmlTableElement.FirstChild;
+
+ while (htmlChildNode != null)
+ {
+ var htmlChildName = htmlChildNode.LocalName.ToLower();
+
+ // Process the element
+ if (htmlChildName == "tbody" || htmlChildName == "thead" || htmlChildName == "tfoot")
+ {
+ // Add more special processing for TableHeader and TableFooter
+ var xamlTableBodyElement = xamlTableElement.OwnerDocument.CreateElement(null,
+ XamlTableRowGroup,
+ XamlNamespace);
+ xamlTableElement.AppendChild(xamlTableBodyElement);
+
+ sourceContext.Add((XmlElement) htmlChildNode);
+
+ // Get properties of Html tbody element
+ Hashtable tbodyElementLocalProperties;
+ var tbodyElementCurrentProperties = GetElementProperties((XmlElement) htmlChildNode,
+ currentProperties,
+ out tbodyElementLocalProperties, stylesheet, sourceContext);
+ // TODO: apply local properties for tbody
+
+ // Process children of htmlChildNode, which is tbody, for tr elements
+ AddTableRowsToTableBody(xamlTableBodyElement, htmlChildNode.FirstChild,
+ tbodyElementCurrentProperties,
+ columnStarts, stylesheet, sourceContext);
+ if (xamlTableBodyElement.HasChildNodes)
+ {
+ xamlTableElement.AppendChild(xamlTableBodyElement);
+ // else: if there is no TRs in this TBody, we simply ignore it
+ }
+
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlChildNode);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ else if (htmlChildName == "tr")
+ {
+ // Tbody is not present, but tr element is present. Tr is wrapped in tbody
+ var xamlTableBodyElement = xamlTableElement.OwnerDocument.CreateElement(null,
+ XamlTableRowGroup,
+ XamlNamespace);
+
+ // We use currentProperties of xamlTableElement when adding rows since the tbody element is artificially created and has
+ // no properties of its own
+
+ htmlChildNode = AddTableRowsToTableBody(xamlTableBodyElement, htmlChildNode, currentProperties,
+ columnStarts,
+ stylesheet, sourceContext);
+ if (xamlTableBodyElement.HasChildNodes)
+ {
+ xamlTableElement.AppendChild(xamlTableBodyElement);
+ }
+ }
+ else
+ {
+ // Element is not tbody or tr. Ignore it.
+ // TODO: add processing for thead, tfoot elements and recovery for td elements
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ }
+
+ if (xamlTableElement.HasChildNodes)
+ {
+ xamlParentElement.AppendChild(xamlTableElement);
+ }
+ }
+ }
+
+ private static XmlElement GetCellFromSingleCellTable(XmlElement htmlTableElement)
+ {
+ XmlElement singleCell = null;
+
+ for (var tableChild = htmlTableElement.FirstChild;
+ tableChild != null;
+ tableChild = tableChild.NextSibling)
+ {
+ var elementName = tableChild.LocalName.ToLower();
+ if (elementName == "tbody" || elementName == "thead" || elementName == "tfoot")
+ {
+ if (singleCell != null)
+ {
+ return null;
+ }
+ for (var tbodyChild = tableChild.FirstChild;
+ tbodyChild != null;
+ tbodyChild = tbodyChild.NextSibling)
+ {
+ if (tbodyChild.LocalName.ToLower() == "tr")
+ {
+ if (singleCell != null)
+ {
+ return null;
+ }
+ for (var trChild = tbodyChild.FirstChild;
+ trChild != null;
+ trChild = trChild.NextSibling)
+ {
+ var cellName = trChild.LocalName.ToLower();
+ if (cellName == "td" || cellName == "th")
+ {
+ if (singleCell != null)
+ {
+ return null;
+ }
+ singleCell = (XmlElement) trChild;
+ }
+ }
+ }
+ }
+ }
+ else if (tableChild.LocalName.ToLower() == "tr")
+ {
+ if (singleCell != null)
+ {
+ return null;
+ }
+ for (var trChild = tableChild.FirstChild; trChild != null; trChild = trChild.NextSibling)
+ {
+ var cellName = trChild.LocalName.ToLower();
+ if (cellName == "td" || cellName == "th")
+ {
+ if (singleCell != null)
+ {
+ return null;
+ }
+ singleCell = (XmlElement) trChild;
+ }
+ }
+ }
+ }
+
+ return singleCell;
+ }
+
+ ///
+ /// Processes the information about table columns - COLGROUP and COL html elements.
+ ///
+ ///
+ /// XmlElement representing a source html table.
+ ///
+ ///
+ /// XmlElement repesenting a resulting xaml table.
+ ///
+ ///
+ /// Array of doubles - column start coordinates.
+ /// Can be null, which means that column size information is not available
+ /// and we must use source colgroup/col information.
+ /// In case wneh it's not null, we will ignore source colgroup/col information.
+ ///
+ ///
+ ///
+ ///
+ private static void AddColumnInformation(XmlElement htmlTableElement, XmlElement xamlTableElement,
+ ArrayList columnStartsAllRows, Hashtable currentProperties, CssStylesheet stylesheet,
+ List sourceContext)
+ {
+ // Add column information
+ if (columnStartsAllRows != null)
+ {
+ // We have consistent information derived from table cells; use it
+ // The last element in columnStarts represents the end of the table
+ for (var columnIndex = 0; columnIndex < columnStartsAllRows.Count - 1; columnIndex++)
+ {
+ XmlElement xamlColumnElement;
+
+ xamlColumnElement = xamlTableElement.OwnerDocument.CreateElement(null, XamlTableColumn,
+ XamlNamespace);
+ xamlColumnElement.SetAttribute(XamlWidth,
+ ((double) columnStartsAllRows[columnIndex + 1] - (double) columnStartsAllRows[columnIndex])
+ .ToString(CultureInfo.InvariantCulture));
+ xamlTableElement.AppendChild(xamlColumnElement);
+ }
+ }
+ else
+ {
+ // We do not have consistent information from table cells;
+ // Translate blindly colgroups from html.
+ for (var htmlChildNode = htmlTableElement.FirstChild;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode.NextSibling)
+ {
+ if (htmlChildNode.LocalName.ToLower() == "colgroup")
+ {
+ // TODO: add column width information to this function as a parameter and process it
+ AddTableColumnGroup(xamlTableElement, (XmlElement) htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ }
+ else if (htmlChildNode.LocalName.ToLower() == "col")
+ {
+ AddTableColumn(xamlTableElement, (XmlElement) htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ }
+ else if (htmlChildNode is XmlElement)
+ {
+ // Some element which belongs to table body. Stop column loop.
+ break;
+ }
+ }
+ }
+ }
+
+ ///
+ /// Converts htmlColgroupElement into Xaml TableColumnGroup element, and appends it to the parent
+ /// xamlTableElement
+ ///
+ ///
+ /// XmlElement representing Xaml Table element to which the converted column group should be added
+ ///
+ ///
+ /// XmlElement representing Html colgroup element to be converted
+ ///
+ /// Properties inherited from parent context
+ ///
+ private static void AddTableColumnGroup(XmlElement xamlTableElement, XmlElement htmlColgroupElement,
+ Hashtable inheritedProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlColgroupElement, inheritedProperties,
+ out localProperties,
+ stylesheet, sourceContext);
+
+ // TODO: process local properties for colgroup
+
+ // Process children of colgroup. Colgroup may contain only col elements.
+ for (var htmlNode = htmlColgroupElement.FirstChild; htmlNode != null; htmlNode = htmlNode.NextSibling)
+ {
+ if (htmlNode is XmlElement && htmlNode.LocalName.ToLower() == "col")
+ {
+ AddTableColumn(xamlTableElement, (XmlElement) htmlNode, currentProperties, stylesheet, sourceContext);
+ }
+ }
+ }
+
+ ///
+ /// Converts htmlColElement into Xaml TableColumn element, and appends it to the parent
+ /// xamlTableColumnGroupElement
+ ///
+ ///
+ ///
+ /// XmlElement representing Html col element to be converted
+ ///
+ ///
+ /// properties inherited from parent context
+ ///
+ ///
+ ///
+ private static void AddTableColumn(XmlElement xamlTableElement, XmlElement htmlColElement,
+ Hashtable inheritedProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ Hashtable localProperties;
+ var currentProperties = GetElementProperties(htmlColElement, inheritedProperties, out localProperties,
+ stylesheet, sourceContext);
+
+ var xamlTableColumnElement = xamlTableElement.OwnerDocument.CreateElement(null, XamlTableColumn,
+ XamlNamespace);
+
+ // TODO: process local properties for TableColumn element
+
+ // Col is an empty element, with no subtree
+ xamlTableElement.AppendChild(xamlTableColumnElement);
+ }
+
+ ///
+ /// Adds TableRow elements to xamlTableBodyElement. The rows are converted from Html tr elements that
+ /// may be the children of an Html tbody element or an Html table element with tbody missing
+ ///
+ ///
+ /// XmlElement representing Xaml TableRowGroup element to which the converted rows should be added
+ ///
+ ///
+ /// XmlElement representing the first tr child of the tbody element to be read
+ ///
+ ///
+ /// Hashtable representing current properties of the tbody element that are generated and applied in the
+ /// AddTable function; to be used as inheritedProperties when adding tr elements
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// XmlNode representing the current position of the iterator among tr elements
+ ///
+ private static XmlNode AddTableRowsToTableBody(XmlElement xamlTableBodyElement, XmlNode htmlTrStartNode,
+ Hashtable currentProperties, ArrayList columnStarts, CssStylesheet stylesheet,
+ List sourceContext)
+ {
+ // Parameter validation
+ Debug.Assert(xamlTableBodyElement.LocalName == XamlTableRowGroup);
+ Debug.Assert(currentProperties != null);
+
+ // Initialize child node for iteratimg through children to the first tr element
+ var htmlChildNode = htmlTrStartNode;
+ ArrayList activeRowSpans = null;
+ if (columnStarts != null)
+ {
+ activeRowSpans = new ArrayList();
+ InitializeActiveRowSpans(activeRowSpans, columnStarts.Count);
+ }
+
+ while (htmlChildNode != null && htmlChildNode.LocalName.ToLower() != "tbody")
+ {
+ if (htmlChildNode.LocalName.ToLower() == "tr")
+ {
+ var xamlTableRowElement = xamlTableBodyElement.OwnerDocument.CreateElement(null,
+ XamlTableRow,
+ XamlNamespace);
+
+ sourceContext.Add((XmlElement) htmlChildNode);
+
+ // Get tr element properties
+ Hashtable trElementLocalProperties;
+ var trElementCurrentProperties = GetElementProperties((XmlElement) htmlChildNode,
+ currentProperties,
+ out trElementLocalProperties, stylesheet, sourceContext);
+ // TODO: apply local properties to tr element
+
+ AddTableCellsToTableRow(xamlTableRowElement, htmlChildNode.FirstChild, trElementCurrentProperties,
+ columnStarts,
+ activeRowSpans, stylesheet, sourceContext);
+ if (xamlTableRowElement.HasChildNodes)
+ {
+ xamlTableBodyElement.AppendChild(xamlTableRowElement);
+ }
+
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlChildNode);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+
+ // Advance
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ else if (htmlChildNode.LocalName.ToLower() == "td")
+ {
+ // Tr element is not present. We create one and add td elements to it
+ var xamlTableRowElement = xamlTableBodyElement.OwnerDocument.CreateElement(null,
+ XamlTableRow,
+ XamlNamespace);
+
+ // This is incorrect formatting and the column starts should not be set in this case
+ Debug.Assert(columnStarts == null);
+
+ htmlChildNode = AddTableCellsToTableRow(xamlTableRowElement, htmlChildNode, currentProperties,
+ columnStarts,
+ activeRowSpans, stylesheet, sourceContext);
+ if (xamlTableRowElement.HasChildNodes)
+ {
+ xamlTableBodyElement.AppendChild(xamlTableRowElement);
+ }
+ }
+ else
+ {
+ // Not a tr or td element. Ignore it.
+ // TODO: consider better recovery here
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ }
+ return htmlChildNode;
+ }
+
+ ///
+ /// Adds TableCell elements to xamlTableRowElement.
+ ///
+ ///
+ /// XmlElement representing Xaml TableRow element to which the converted cells should be added
+ ///
+ ///
+ /// XmlElement representing the child of tr or tbody element from which we should start adding td elements
+ ///
+ ///
+ /// properties of the current html tr element to which cells are to be added
+ ///
+ ///
+ /// XmlElement representing the current position of the iterator among the children of the parent Html tbody/tr element
+ ///
+ private static XmlNode AddTableCellsToTableRow(XmlElement xamlTableRowElement, XmlNode htmlTdStartNode,
+ Hashtable currentProperties, ArrayList columnStarts, ArrayList activeRowSpans, CssStylesheet stylesheet,
+ List sourceContext)
+ {
+ // parameter validation
+ Debug.Assert(xamlTableRowElement.LocalName == XamlTableRow);
+ Debug.Assert(currentProperties != null);
+ if (columnStarts != null)
+ {
+ Debug.Assert(activeRowSpans.Count == columnStarts.Count);
+ }
+
+ var htmlChildNode = htmlTdStartNode;
+ double columnStart = 0;
+ double columnWidth = 0;
+ var columnIndex = 0;
+ var columnSpan = 0;
+
+ while (htmlChildNode != null && htmlChildNode.LocalName.ToLower() != "tr" &&
+ htmlChildNode.LocalName.ToLower() != "tbody" && htmlChildNode.LocalName.ToLower() != "thead" &&
+ htmlChildNode.LocalName.ToLower() != "tfoot")
+ {
+ if (htmlChildNode.LocalName.ToLower() == "td" || htmlChildNode.LocalName.ToLower() == "th")
+ {
+ var xamlTableCellElement = xamlTableRowElement.OwnerDocument.CreateElement(null,
+ XamlTableCell,
+ XamlNamespace);
+
+ sourceContext.Add((XmlElement) htmlChildNode);
+
+ Hashtable tdElementLocalProperties;
+ var tdElementCurrentProperties = GetElementProperties((XmlElement) htmlChildNode,
+ currentProperties,
+ out tdElementLocalProperties, stylesheet, sourceContext);
+
+ // TODO: determine if localProperties can be used instead of htmlChildNode in this call, and if they can,
+ // make necessary changes and use them instead.
+ ApplyPropertiesToTableCellElement((XmlElement) htmlChildNode, xamlTableCellElement);
+
+ if (columnStarts != null)
+ {
+ Debug.Assert(columnIndex < columnStarts.Count - 1);
+ while (columnIndex < activeRowSpans.Count && (int) activeRowSpans[columnIndex] > 0)
+ {
+ activeRowSpans[columnIndex] = (int) activeRowSpans[columnIndex] - 1;
+ Debug.Assert((int) activeRowSpans[columnIndex] >= 0);
+ columnIndex++;
+ }
+ Debug.Assert(columnIndex < columnStarts.Count - 1);
+ columnStart = (double) columnStarts[columnIndex];
+ columnWidth = GetColumnWidth((XmlElement) htmlChildNode);
+ columnSpan = CalculateColumnSpan(columnIndex, columnWidth, columnStarts);
+ var rowSpan = GetRowSpan((XmlElement) htmlChildNode);
+
+ // Column cannot have no span
+ Debug.Assert(columnSpan > 0);
+ Debug.Assert(columnIndex + columnSpan < columnStarts.Count);
+
+ xamlTableCellElement.SetAttribute(XamlTableCellColumnSpan, columnSpan.ToString());
+
+ // Apply row span
+ for (var spannedColumnIndex = columnIndex;
+ spannedColumnIndex < columnIndex + columnSpan;
+ spannedColumnIndex++)
+ {
+ Debug.Assert(spannedColumnIndex < activeRowSpans.Count);
+ activeRowSpans[spannedColumnIndex] = (rowSpan - 1);
+ Debug.Assert((int) activeRowSpans[spannedColumnIndex] >= 0);
+ }
+
+ columnIndex = columnIndex + columnSpan;
+ }
+
+ AddDataToTableCell(xamlTableCellElement, htmlChildNode.FirstChild, tdElementCurrentProperties,
+ stylesheet,
+ sourceContext);
+ if (xamlTableCellElement.HasChildNodes)
+ {
+ xamlTableRowElement.AppendChild(xamlTableCellElement);
+ }
+
+ Debug.Assert(sourceContext.Count > 0 && sourceContext[sourceContext.Count - 1] == htmlChildNode);
+ sourceContext.RemoveAt(sourceContext.Count - 1);
+
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ else
+ {
+ // Not td element. Ignore it.
+ // TODO: Consider better recovery
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+ }
+ return htmlChildNode;
+ }
+
+ ///
+ /// adds table cell data to xamlTableCellElement
+ ///
+ ///
+ /// XmlElement representing Xaml TableCell element to which the converted data should be added
+ ///
+ ///
+ /// XmlElement representing the start element of data to be added to xamlTableCellElement
+ ///
+ ///
+ /// Current properties for the html td/th element corresponding to xamlTableCellElement
+ ///
+ private static void AddDataToTableCell(XmlElement xamlTableCellElement, XmlNode htmlDataStartNode,
+ Hashtable currentProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ // Parameter validation
+ Debug.Assert(xamlTableCellElement.LocalName == XamlTableCell);
+ Debug.Assert(currentProperties != null);
+
+ for (var htmlChildNode = htmlDataStartNode;
+ htmlChildNode != null;
+ htmlChildNode = htmlChildNode?.NextSibling)
+ {
+ // Process a new html element and add it to the td element
+ htmlChildNode = AddBlock(xamlTableCellElement, htmlChildNode, currentProperties, stylesheet,
+ sourceContext);
+ }
+ }
+
+ ///
+ /// Performs a parsing pass over a table to read information about column width and rowspan attributes. This
+ /// information
+ /// is used to determine the starting point of each column.
+ ///
+ ///
+ /// XmlElement representing Html table whose structure is to be analyzed
+ ///
+ ///
+ /// ArrayList of type double which contains the function output. If analysis is successful, this ArrayList contains
+ /// all the points which are the starting position of any column in the table, ordered from left to right.
+ /// In case if analisys was impossible we return null.
+ ///
+ private static ArrayList AnalyzeTableStructure(XmlElement htmlTableElement, CssStylesheet stylesheet)
+ {
+ // Parameter validation
+ Debug.Assert(htmlTableElement.LocalName.ToLower() == "table");
+ if (!htmlTableElement.HasChildNodes)
+ {
+ return null;
+ }
+
+ var columnWidthsAvailable = true;
+
+ var columnStarts = new ArrayList();
+ var activeRowSpans = new ArrayList();
+ Debug.Assert(columnStarts.Count == activeRowSpans.Count);
+
+ var htmlChildNode = htmlTableElement.FirstChild;
+ double tableWidth = 0; // Keep track of table width which is the width of its widest row
+
+ // Analyze tbody and tr elements
+ while (htmlChildNode != null && columnWidthsAvailable)
+ {
+ Debug.Assert(columnStarts.Count == activeRowSpans.Count);
+
+ switch (htmlChildNode.LocalName.ToLower())
+ {
+ case "tbody":
+ // Tbody element, we should analyze its children for trows
+ var tbodyWidth = AnalyzeTbodyStructure((XmlElement) htmlChildNode, columnStarts,
+ activeRowSpans, tableWidth,
+ stylesheet);
+ if (tbodyWidth > tableWidth)
+ {
+ // Table width must be increased to supported newly added wide row
+ tableWidth = tbodyWidth;
+ }
+ else if (tbodyWidth == 0)
+ {
+ // Tbody analysis may return 0, probably due to unprocessable format.
+ // We should also fail.
+ columnWidthsAvailable = false; // interrupt the analisys
+ }
+ break;
+ case "tr":
+ // Table row. Analyze column structure within row directly
+ var trWidth = AnalyzeTrStructure((XmlElement) htmlChildNode, columnStarts, activeRowSpans,
+ tableWidth,
+ stylesheet);
+ if (trWidth > tableWidth)
+ {
+ tableWidth = trWidth;
+ }
+ else if (trWidth == 0)
+ {
+ columnWidthsAvailable = false; // interrupt the analisys
+ }
+ break;
+ case "td":
+ // Incorrect formatting, too deep to analyze at this level. Return null.
+ // TODO: implement analysis at this level, possibly by creating a new tr
+ columnWidthsAvailable = false; // interrupt the analisys
+ break;
+ default:
+ // Element should not occur directly in table. Ignore it.
+ break;
+ }
+
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+
+ if (columnWidthsAvailable)
+ {
+ // Add an item for whole table width
+ columnStarts.Add(tableWidth);
+ VerifyColumnStartsAscendingOrder(columnStarts);
+ }
+ else
+ {
+ columnStarts = null;
+ }
+
+ return columnStarts;
+ }
+
+ ///
+ /// Performs a parsing pass over a tbody to read information about column width and rowspan attributes. Information
+ /// read about width
+ /// attributes is stored in the reference ArrayList parameter columnStarts, which contains a list of all starting
+ /// positions of all columns in the table, ordered from left to right. Row spans are taken into consideration when
+ /// computing column starts
+ ///
+ ///
+ /// XmlElement representing Html tbody whose structure is to be analyzed
+ ///
+ ///
+ /// ArrayList of type double which contains the function output. If analysis fails, this parameter is set to null
+ ///
+ ///
+ /// Current width of the table. This is used to determine if a new column when added to the end of table should
+ /// come after the last column in the table or is actually splitting the last column in two. If it is only splitting
+ /// the last column it should inherit row span for that column
+ ///
+ ///
+ /// Calculated width of a tbody.
+ /// In case of non-analizable column width structure return 0;
+ ///
+ private static double AnalyzeTbodyStructure(XmlElement htmlTbodyElement, ArrayList columnStarts,
+ ArrayList activeRowSpans, double tableWidth, CssStylesheet stylesheet)
+ {
+ // Parameter validation
+ Debug.Assert(htmlTbodyElement.LocalName.ToLower() == "tbody");
+ Debug.Assert(columnStarts != null);
+
+ double tbodyWidth = 0;
+ var columnWidthsAvailable = true;
+
+ if (!htmlTbodyElement.HasChildNodes)
+ {
+ return tbodyWidth;
+ }
+
+ // Set active row spans to 0 - thus ignoring row spans crossing tbody boundaries
+ ClearActiveRowSpans(activeRowSpans);
+
+ var htmlChildNode = htmlTbodyElement.FirstChild;
+
+ // Analyze tr elements
+ while (htmlChildNode != null && columnWidthsAvailable)
+ {
+ switch (htmlChildNode.LocalName.ToLower())
+ {
+ case "tr":
+ var trWidth = AnalyzeTrStructure((XmlElement) htmlChildNode, columnStarts, activeRowSpans,
+ tbodyWidth,
+ stylesheet);
+ if (trWidth > tbodyWidth)
+ {
+ tbodyWidth = trWidth;
+ }
+ break;
+ case "td":
+ columnWidthsAvailable = false; // interrupt the analisys
+ break;
+ default:
+ break;
+ }
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+
+ // Set active row spans to 0 - thus ignoring row spans crossing tbody boundaries
+ ClearActiveRowSpans(activeRowSpans);
+
+ return columnWidthsAvailable ? tbodyWidth : 0;
+ }
+
+ ///
+ /// Performs a parsing pass over a tr element to read information about column width and rowspan attributes.
+ ///
+ ///
+ /// XmlElement representing Html tr element whose structure is to be analyzed
+ ///
+ ///
+ /// ArrayList of type double which contains the function output. If analysis is successful, this ArrayList contains
+ /// all the points which are the starting position of any column in the tr, ordered from left to right. If analysis
+ /// fails,
+ /// the ArrayList is set to null
+ ///
+ ///
+ /// ArrayList representing all columns currently spanned by an earlier row span attribute. These columns should
+ /// not be used for data in this row. The ArrayList actually contains notation for all columns in the table, if the
+ /// active row span is set to 0 that column is not presently spanned but if it is > 0 the column is presently spanned
+ ///
+ ///
+ /// Double value representing the current width of the table.
+ /// Return 0 if analisys was insuccessful.
+ ///
+ private static double AnalyzeTrStructure(XmlElement htmlTrElement, ArrayList columnStarts,
+ ArrayList activeRowSpans,
+ double tableWidth, CssStylesheet stylesheet)
+ {
+ double columnWidth;
+
+ // Parameter validation
+ Debug.Assert(htmlTrElement.LocalName.ToLower() == "tr");
+ Debug.Assert(columnStarts != null);
+ Debug.Assert(activeRowSpans != null);
+ Debug.Assert(columnStarts.Count == activeRowSpans.Count);
+
+ if (!htmlTrElement.HasChildNodes)
+ {
+ return 0;
+ }
+
+ var columnWidthsAvailable = true;
+
+ double columnStart = 0; // starting position of current column
+ var htmlChildNode = htmlTrElement.FirstChild;
+ var columnIndex = 0;
+ double trWidth = 0;
+
+ // Skip spanned columns to get to real column start
+ if (columnIndex < activeRowSpans.Count)
+ {
+ Debug.Assert((double) columnStarts[columnIndex] >= columnStart);
+ if ((double) columnStarts[columnIndex] == columnStart)
+ {
+ // The new column may be in a spanned area
+ while (columnIndex < activeRowSpans.Count && (int) activeRowSpans[columnIndex] > 0)
+ {
+ activeRowSpans[columnIndex] = (int) activeRowSpans[columnIndex] - 1;
+ Debug.Assert((int) activeRowSpans[columnIndex] >= 0);
+ columnIndex++;
+ columnStart = (double) columnStarts[columnIndex];
+ }
+ }
+ }
+
+ while (htmlChildNode != null && columnWidthsAvailable)
+ {
+ Debug.Assert(columnStarts.Count == activeRowSpans.Count);
+
+ VerifyColumnStartsAscendingOrder(columnStarts);
+
+ switch (htmlChildNode.LocalName.ToLower())
+ {
+ case "td":
+ Debug.Assert(columnIndex <= columnStarts.Count);
+ if (columnIndex < columnStarts.Count)
+ {
+ Debug.Assert(columnStart <= (double) columnStarts[columnIndex]);
+ if (columnStart < (double) columnStarts[columnIndex])
+ {
+ columnStarts.Insert(columnIndex, columnStart);
+ // There can be no row spans now - the column data will appear here
+ // Row spans may appear only during the column analysis
+ activeRowSpans.Insert(columnIndex, 0);
+ }
+ }
+ else
+ {
+ // Column start is greater than all previous starts. Row span must still be 0 because
+ // we are either adding after another column of the same row, in which case it should not inherit
+ // the previous column's span. Otherwise we are adding after the last column of some previous
+ // row, and assuming the table widths line up, we should not be spanned by it. If there is
+ // an incorrect tbale structure where a columns starts in the middle of a row span, we do not
+ // guarantee correct output
+ columnStarts.Add(columnStart);
+ activeRowSpans.Add(0);
+ }
+ columnWidth = GetColumnWidth((XmlElement) htmlChildNode);
+ if (columnWidth != -1)
+ {
+ int nextColumnIndex;
+ var rowSpan = GetRowSpan((XmlElement) htmlChildNode);
+
+ nextColumnIndex = GetNextColumnIndex(columnIndex, columnWidth, columnStarts, activeRowSpans);
+ if (nextColumnIndex != -1)
+ {
+ // Entire column width can be processed without hitting conflicting row span. This means that
+ // column widths line up and we can process them
+ Debug.Assert(nextColumnIndex <= columnStarts.Count);
+
+ // Apply row span to affected columns
+ for (var spannedColumnIndex = columnIndex;
+ spannedColumnIndex < nextColumnIndex;
+ spannedColumnIndex++)
+ {
+ activeRowSpans[spannedColumnIndex] = rowSpan - 1;
+ Debug.Assert((int) activeRowSpans[spannedColumnIndex] >= 0);
+ }
+
+ columnIndex = nextColumnIndex;
+
+ // Calculate columnsStart for the next cell
+ columnStart = columnStart + columnWidth;
+
+ if (columnIndex < activeRowSpans.Count)
+ {
+ Debug.Assert((double) columnStarts[columnIndex] >= columnStart);
+ if ((double) columnStarts[columnIndex] == columnStart)
+ {
+ // The new column may be in a spanned area
+ while (columnIndex < activeRowSpans.Count &&
+ (int) activeRowSpans[columnIndex] > 0)
+ {
+ activeRowSpans[columnIndex] = (int) activeRowSpans[columnIndex] - 1;
+ Debug.Assert((int) activeRowSpans[columnIndex] >= 0);
+ columnIndex++;
+ columnStart = (double) columnStarts[columnIndex];
+ }
+ }
+ // else: the new column does not start at the same time as a pre existing column
+ // so we don't have to check it for active row spans, it starts in the middle
+ // of another column which has been checked already by the GetNextColumnIndex function
+ }
+ }
+ else
+ {
+ // Full column width cannot be processed without a pre existing row span.
+ // We cannot analyze widths
+ columnWidthsAvailable = false;
+ }
+ }
+ else
+ {
+ // Incorrect column width, stop processing
+ columnWidthsAvailable = false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ htmlChildNode = htmlChildNode.NextSibling;
+ }
+
+ // The width of the tr element is the position at which it's last td element ends, which is calculated in
+ // the columnStart value after each td element is processed
+ trWidth = columnWidthsAvailable ? columnStart : 0;
+
+ return trWidth;
+ }
+
+ ///
+ /// Gets row span attribute from htmlTDElement. Returns an integer representing the value of the rowspan attribute.
+ /// Default value if attribute is not specified or if it is invalid is 1
+ ///
+ ///
+ /// Html td element to be searched for rowspan attribute
+ ///
+ private static int GetRowSpan(XmlElement htmlTdElement)
+ {
+ string rowSpanAsString;
+ int rowSpan;
+
+ rowSpanAsString = GetAttribute(htmlTdElement, "rowspan");
+ if (rowSpanAsString != null)
+ {
+ if (!int.TryParse(rowSpanAsString, out rowSpan))
+ {
+ // Ignore invalid value of rowspan; treat it as 1
+ rowSpan = 1;
+ }
+ }
+ else
+ {
+ // No row span, default is 1
+ rowSpan = 1;
+ }
+ return rowSpan;
+ }
+
+ ///
+ /// Gets index at which a column should be inseerted into the columnStarts ArrayList. This is
+ /// decided by the value columnStart. The columnStarts ArrayList is ordered in ascending order.
+ /// Returns an integer representing the index at which the column should be inserted
+ ///
+ ///
+ /// Array list representing starting coordinates of all columns in the table
+ ///
+ ///
+ /// Starting coordinate of column we wish to insert into columnStart
+ ///
+ ///
+ /// Int representing the current column index. This acts as a clue while finding the insertion index.
+ /// If the value of columnStarts at columnIndex is the same as columnStart, then this position alrady exists
+ /// in the array and we can jsut return columnIndex.
+ ///
+ ///
+ private static int GetNextColumnIndex(int columnIndex, double columnWidth, ArrayList columnStarts,
+ ArrayList activeRowSpans)
+ {
+ double columnStart;
+ int spannedColumnIndex;
+
+ // Parameter validation
+ Debug.Assert(columnStarts != null);
+ Debug.Assert(0 <= columnIndex && columnIndex <= columnStarts.Count);
+ Debug.Assert(columnWidth > 0);
+
+ columnStart = (double) columnStarts[columnIndex];
+ spannedColumnIndex = columnIndex + 1;
+
+ while (spannedColumnIndex < columnStarts.Count &&
+ (double) columnStarts[spannedColumnIndex] < columnStart + columnWidth && spannedColumnIndex != -1)
+ {
+ if ((int) activeRowSpans[spannedColumnIndex] > 0)
+ {
+ // The current column should span this area, but something else is already spanning it
+ // Not analyzable
+ spannedColumnIndex = -1;
+ }
+ else
+ {
+ spannedColumnIndex++;
+ }
+ }
+
+ return spannedColumnIndex;
+ }
+
+
+ ///
+ /// Used for clearing activeRowSpans array in the beginning/end of each tbody
+ ///
+ ///
+ /// ArrayList representing currently active row spans
+ ///
+ private static void ClearActiveRowSpans(ArrayList activeRowSpans)
+ {
+ for (var columnIndex = 0; columnIndex < activeRowSpans.Count; columnIndex++)
+ {
+ activeRowSpans[columnIndex] = 0;
+ }
+ }
+
+ ///
+ /// Used for initializing activeRowSpans array in the before adding rows to tbody element
+ ///
+ ///
+ /// ArrayList representing currently active row spans
+ ///
+ ///
+ /// Size to be give to array list
+ ///
+ private static void InitializeActiveRowSpans(ArrayList activeRowSpans, int count)
+ {
+ for (var columnIndex = 0; columnIndex < count; columnIndex++)
+ {
+ activeRowSpans.Add(0);
+ }
+ }
+
+
+ ///
+ /// Calculates width of next TD element based on starting position of current element and it's width, which
+ /// is calculated byt he function
+ ///
+ ///
+ /// XmlElement representing Html td element whose width is to be read
+ ///
+ ///
+ /// Starting position of current column
+ ///
+ private static double GetNextColumnStart(XmlElement htmlTdElement, double columnStart)
+ {
+ double columnWidth;
+ double nextColumnStart;
+
+ // Parameter validation
+ Debug.Assert(htmlTdElement.LocalName.ToLower() == "td" || htmlTdElement.LocalName.ToLower() == "th");
+ Debug.Assert(columnStart >= 0);
+
+ nextColumnStart = -1; // -1 indicates inability to calculate columnStart width
+
+ columnWidth = GetColumnWidth(htmlTdElement);
+
+ if (columnWidth == -1)
+ {
+ nextColumnStart = -1;
+ }
+ else
+ {
+ nextColumnStart = columnStart + columnWidth;
+ }
+
+ return nextColumnStart;
+ }
+
+
+ private static double GetColumnWidth(XmlElement htmlTdElement)
+ {
+ string columnWidthAsString;
+ double columnWidth;
+
+ columnWidthAsString = null;
+ columnWidth = -1;
+
+ // Get string valkue for the width
+ columnWidthAsString = GetAttribute(htmlTdElement, "width") ??
+ GetCssAttribute(GetAttribute(htmlTdElement, "style"), "width");
+
+ // We do not allow column width to be 0, if specified as 0 we will fail to record it
+ if (!TryGetLengthValue(columnWidthAsString, out columnWidth) || columnWidth == 0)
+ {
+ columnWidth = -1;
+ }
+ return columnWidth;
+ }
+
+ ///
+ /// Calculates column span based the column width and the widths of all other columns. Returns an integer representing
+ /// the column span
+ ///
+ ///
+ /// Index of the current column
+ ///
+ ///
+ /// Width of the current column
+ ///
+ ///
+ /// ArrayList repsenting starting coordinates of all columns
+ ///
+ private static int CalculateColumnSpan(int columnIndex, double columnWidth, ArrayList columnStarts)
+ {
+ // Current status of column width. Indicates the amount of width that has been scanned already
+ double columnSpanningValue;
+ int columnSpanningIndex;
+ int columnSpan;
+ double subColumnWidth; // Width of the smallest-grain columns in the table
+
+ Debug.Assert(columnStarts != null);
+ Debug.Assert(columnIndex < columnStarts.Count - 1);
+ Debug.Assert((double) columnStarts[columnIndex] >= 0);
+ Debug.Assert(columnWidth > 0);
+
+ columnSpanningIndex = columnIndex;
+ columnSpanningValue = 0;
+ columnSpan = 0;
+ subColumnWidth = 0;
+
+ while (columnSpanningValue < columnWidth && columnSpanningIndex < columnStarts.Count - 1)
+ {
+ subColumnWidth = (double) columnStarts[columnSpanningIndex + 1] -
+ (double) columnStarts[columnSpanningIndex];
+ Debug.Assert(subColumnWidth > 0);
+ columnSpanningValue += subColumnWidth;
+ columnSpanningIndex++;
+ }
+
+ // Now, we have either covered the width we needed to cover or reached the end of the table, in which
+ // case the column spans all the columns until the end
+ columnSpan = columnSpanningIndex - columnIndex;
+ Debug.Assert(columnSpan > 0);
+
+ return columnSpan;
+ }
+
+ ///
+ /// Verifies that values in columnStart, which represent starting coordinates of all columns, are arranged
+ /// in ascending order
+ ///
+ ///
+ /// ArrayList representing starting coordinates of all columns
+ ///
+ private static void VerifyColumnStartsAscendingOrder(ArrayList columnStarts)
+ {
+ Debug.Assert(columnStarts != null);
+
+ double columnStart;
+
+ columnStart = -0.01;
+
+ foreach (object t in columnStarts)
+ {
+ Debug.Assert(columnStart < (double) t);
+ columnStart = (double) t;
+ }
+ }
+
+ // .............................................................
+ //
+ // Attributes and Properties
+ //
+ // .............................................................
+
+ ///
+ /// Analyzes local properties of Html element, converts them into Xaml equivalents, and applies them to xamlElement
+ ///
+ ///
+ /// XmlElement representing Xaml element to which properties are to be applied
+ ///
+ ///
+ /// Hashtable representing local properties of Html element that is converted into xamlElement
+ ///
+ private static void ApplyLocalProperties(XmlElement xamlElement, Hashtable localProperties, bool isBlock)
+ {
+ var marginSet = false;
+ var marginTop = "0";
+ var marginBottom = "0";
+ var marginLeft = "0";
+ var marginRight = "0";
+
+ var paddingSet = false;
+ var paddingTop = "0";
+ var paddingBottom = "0";
+ var paddingLeft = "0";
+ var paddingRight = "0";
+
+ string borderColor = null;
+
+ var borderThicknessSet = false;
+ var borderThicknessTop = "0";
+ var borderThicknessBottom = "0";
+ var borderThicknessLeft = "0";
+ var borderThicknessRight = "0";
+
+ var propertyEnumerator = localProperties.GetEnumerator();
+ while (propertyEnumerator.MoveNext())
+ {
+ switch ((string) propertyEnumerator.Key)
+ {
+ case "font-family":
+ // Convert from font-family value list into xaml FontFamily value
+ xamlElement.SetAttribute(XamlFontFamily, (string) propertyEnumerator.Value);
+ break;
+ case "font-style":
+ xamlElement.SetAttribute(XamlFontStyle, (string) propertyEnumerator.Value);
+ break;
+ case "font-variant":
+ // Convert from font-variant into xaml property
+ break;
+ case "font-weight":
+ xamlElement.SetAttribute(XamlFontWeight, (string) propertyEnumerator.Value);
+ break;
+ case "font-size":
+ // Convert from css size into FontSize
+ xamlElement.SetAttribute(XamlFontSize, (string) propertyEnumerator.Value);
+ break;
+ case "color":
+ SetPropertyValue(xamlElement, TextElement.ForegroundProperty, (string) propertyEnumerator.Value);
+ break;
+ case "background-color":
+ SetPropertyValue(xamlElement, TextElement.BackgroundProperty, (string) propertyEnumerator.Value);
+ break;
+ case "text-decoration-underline":
+ if (!isBlock)
+ {
+ if ((string) propertyEnumerator.Value == "true")
+ {
+ xamlElement.SetAttribute(XamlTextDecorations, XamlTextDecorationsUnderline);
+ }
+ }
+ break;
+ case "text-decoration-none":
+ case "text-decoration-overline":
+ case "text-decoration-line-through":
+ case "text-decoration-blink":
+ // Convert from all other text-decorations values
+ if (!isBlock)
+ {
+ }
+ break;
+ case "text-transform":
+ // Convert from text-transform into xaml property
+ break;
+
+ case "text-indent":
+ if (isBlock)
+ {
+ xamlElement.SetAttribute(XamlTextIndent, (string) propertyEnumerator.Value);
+ }
+ break;
+
+ case "text-align":
+ if (isBlock)
+ {
+ xamlElement.SetAttribute(XamlTextAlignment, (string) propertyEnumerator.Value);
+ }
+ break;
+
+ case "width":
+ case "height":
+ // Decide what to do with width and height propeties
+ break;
+
+ case "margin-top":
+ marginSet = true;
+ marginTop = (string) propertyEnumerator.Value;
+ break;
+ case "margin-right":
+ marginSet = true;
+ marginRight = (string) propertyEnumerator.Value;
+ break;
+ case "margin-bottom":
+ marginSet = true;
+ marginBottom = (string) propertyEnumerator.Value;
+ break;
+ case "margin-left":
+ marginSet = true;
+ marginLeft = (string) propertyEnumerator.Value;
+ break;
+
+ case "padding-top":
+ paddingSet = true;
+ paddingTop = (string) propertyEnumerator.Value;
+ break;
+ case "padding-right":
+ paddingSet = true;
+ paddingRight = (string) propertyEnumerator.Value;
+ break;
+ case "padding-bottom":
+ paddingSet = true;
+ paddingBottom = (string) propertyEnumerator.Value;
+ break;
+ case "padding-left":
+ paddingSet = true;
+ paddingLeft = (string) propertyEnumerator.Value;
+ break;
+
+ // NOTE: css names for elementary border styles have side indications in the middle (top/bottom/left/right)
+ // In our internal notation we intentionally put them at the end - to unify processing in ParseCssRectangleProperty method
+ case "border-color-top":
+ borderColor = (string) propertyEnumerator.Value;
+ break;
+ case "border-color-right":
+ borderColor = (string) propertyEnumerator.Value;
+ break;
+ case "border-color-bottom":
+ borderColor = (string) propertyEnumerator.Value;
+ break;
+ case "border-color-left":
+ borderColor = (string) propertyEnumerator.Value;
+ break;
+ case "border-style-top":
+ case "border-style-right":
+ case "border-style-bottom":
+ case "border-style-left":
+ // Implement conversion from border style
+ break;
+ case "border-width-top":
+ borderThicknessSet = true;
+ borderThicknessTop = (string) propertyEnumerator.Value;
+ break;
+ case "border-width-right":
+ borderThicknessSet = true;
+ borderThicknessRight = (string) propertyEnumerator.Value;
+ break;
+ case "border-width-bottom":
+ borderThicknessSet = true;
+ borderThicknessBottom = (string) propertyEnumerator.Value;
+ break;
+ case "border-width-left":
+ borderThicknessSet = true;
+ borderThicknessLeft = (string) propertyEnumerator.Value;
+ break;
+
+ case "list-style-type":
+ if (xamlElement.LocalName == XamlList)
+ {
+ string markerStyle;
+ switch (((string) propertyEnumerator.Value).ToLower())
+ {
+ case "disc":
+ markerStyle = XamlListMarkerStyleDisc;
+ break;
+ case "circle":
+ markerStyle = XamlListMarkerStyleCircle;
+ break;
+ case "none":
+ markerStyle = XamlListMarkerStyleNone;
+ break;
+ case "square":
+ markerStyle = XamlListMarkerStyleSquare;
+ break;
+ case "box":
+ markerStyle = XamlListMarkerStyleBox;
+ break;
+ case "lower-latin":
+ markerStyle = XamlListMarkerStyleLowerLatin;
+ break;
+ case "upper-latin":
+ markerStyle = XamlListMarkerStyleUpperLatin;
+ break;
+ case "lower-roman":
+ markerStyle = XamlListMarkerStyleLowerRoman;
+ break;
+ case "upper-roman":
+ markerStyle = XamlListMarkerStyleUpperRoman;
+ break;
+ case "decimal":
+ markerStyle = XamlListMarkerStyleDecimal;
+ break;
+ default:
+ markerStyle = XamlListMarkerStyleDisc;
+ break;
+ }
+ xamlElement.SetAttribute(XamlListMarkerStyle, markerStyle);
+ }
+ break;
+
+ case "float":
+ case "clear":
+ if (isBlock)
+ {
+ // Convert float and clear properties
+ }
+ break;
+
+ case "display":
+ break;
+ }
+ }
+
+ if (isBlock)
+ {
+ if (marginSet)
+ {
+ ComposeThicknessProperty(xamlElement, XamlMargin, marginLeft, marginRight, marginTop, marginBottom);
+ }
+
+ if (paddingSet)
+ {
+ ComposeThicknessProperty(xamlElement, XamlPadding, paddingLeft, paddingRight, paddingTop,
+ paddingBottom);
+ }
+
+ if (borderColor != null)
+ {
+ // We currently ignore possible difference in brush colors on different border sides. Use the last colored side mentioned
+ xamlElement.SetAttribute(XamlBorderBrush, borderColor);
+ }
+
+ if (borderThicknessSet)
+ {
+ ComposeThicknessProperty(xamlElement, XamlBorderThickness, borderThicknessLeft,
+ borderThicknessRight,
+ borderThicknessTop, borderThicknessBottom);
+ }
+ }
+ }
+
+ // Create syntactically optimized four-value Thickness
+ private static void ComposeThicknessProperty(XmlElement xamlElement, string propertyName, string left,
+ string right,
+ string top, string bottom)
+ {
+ // Xaml syntax:
+ // We have a reasonable interpreation for one value (all four edges), two values (horizontal, vertical),
+ // and four values (left, top, right, bottom).
+ // switch (i) {
+ // case 1: return new Thickness(lengths[0]);
+ // case 2: return new Thickness(lengths[0], lengths[1], lengths[0], lengths[1]);
+ // case 4: return new Thickness(lengths[0], lengths[1], lengths[2], lengths[3]);
+ // }
+ string thickness;
+
+ // We do not accept negative margins
+ if (left[0] == '0' || left[0] == '-') left = "0";
+ if (right[0] == '0' || right[0] == '-') right = "0";
+ if (top[0] == '0' || top[0] == '-') top = "0";
+ if (bottom[0] == '0' || bottom[0] == '-') bottom = "0";
+
+ if (left == right && top == bottom)
+ {
+ if (left == top)
+ {
+ thickness = left;
+ }
+ else
+ {
+ thickness = left + "," + top;
+ }
+ }
+ else
+ {
+ thickness = left + "," + top + "," + right + "," + bottom;
+ }
+
+ // Need safer processing for a thickness value
+ xamlElement.SetAttribute(propertyName, thickness);
+ }
+
+ private static void SetPropertyValue(XmlElement xamlElement, DependencyProperty property, string stringValue)
+ {
+ var typeConverter =
+ TypeDescriptor.GetConverter(property.PropertyType);
+ try
+ {
+ var convertedValue = typeConverter.ConvertFromInvariantString(stringValue);
+ if (convertedValue != null)
+ {
+ xamlElement.SetAttribute(property.Name, stringValue);
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+
+ ///
+ /// Analyzes the tag of the htmlElement and infers its associated formatted properties.
+ /// After that parses style attribute and adds all inline css styles.
+ /// The resulting style attributes are collected in output parameter localProperties.
+ ///
+ ///
+ ///
+ ///
+ /// set of properties inherited from ancestor elements. Currently not used in the code. Reserved for the future
+ /// development.
+ ///
+ ///
+ /// returns all formatting properties defined by this element - implied by its tag, its attributes, or its css inline
+ /// style
+ ///
+ ///
+ ///
+ ///
+ /// returns a combination of previous context with local set of properties.
+ /// This value is not used in the current code - inntended for the future development.
+ ///
+ private static Hashtable GetElementProperties(XmlElement htmlElement, Hashtable inheritedProperties,
+ out Hashtable localProperties, CssStylesheet stylesheet, List sourceContext)
+ {
+ // Start with context formatting properties
+ var currentProperties = new Hashtable();
+ var propertyEnumerator = inheritedProperties.GetEnumerator();
+ while (propertyEnumerator.MoveNext())
+ {
+ currentProperties[propertyEnumerator.Key] = propertyEnumerator.Value;
+ }
+
+ // Identify element name
+ var elementName = htmlElement.LocalName.ToLower();
+ var elementNamespace = htmlElement.NamespaceURI;
+
+ // update current formatting properties depending on element tag
+
+ localProperties = new Hashtable();
+ switch (elementName)
+ {
+ // Character formatting
+ case "i":
+ case "italic":
+ case "em":
+ localProperties["font-style"] = "italic";
+ break;
+ case "b":
+ case "bold":
+ case "strong":
+ case "dfn":
+ localProperties["font-weight"] = "bold";
+ break;
+ case "u":
+ case "underline":
+ localProperties["text-decoration-underline"] = "true";
+ break;
+ case "font":
+ var attributeValue = GetAttribute(htmlElement, "face");
+ if (attributeValue != null)
+ {
+ localProperties["font-family"] = attributeValue;
+ }
+ attributeValue = GetAttribute(htmlElement, "size");
+ if (attributeValue != null)
+ {
+ var fontSize = double.Parse(attributeValue)*(12.0/3.0);
+ if (fontSize < 1.0)
+ {
+ fontSize = 1.0;
+ }
+ else if (fontSize > 1000.0)
+ {
+ fontSize = 1000.0;
+ }
+ localProperties["font-size"] = fontSize.ToString(CultureInfo.InvariantCulture);
+ }
+ attributeValue = GetAttribute(htmlElement, "color");
+ if (attributeValue != null)
+ {
+ localProperties["color"] = attributeValue;
+ }
+ break;
+ case "samp":
+ localProperties["font-family"] = "Courier New"; // code sample
+ localProperties["font-size"] = XamlFontSizeXxSmall;
+ localProperties["text-align"] = "Left";
+ break;
+ case "sub":
+ break;
+ case "sup":
+ break;
+
+ // Hyperlinks
+ case "a": // href, hreflang, urn, methods, rel, rev, title
+ // Set default hyperlink properties
+ break;
+ case "acronym":
+ break;
+
+ // Paragraph formatting:
+ case "p":
+ // Set default paragraph properties
+ break;
+ case "div":
+ // Set default div properties
+ break;
+ case "pre":
+ localProperties["font-family"] = "Courier New"; // renders text in a fixed-width font
+ localProperties["font-size"] = XamlFontSizeXxSmall;
+ localProperties["text-align"] = "Left";
+ break;
+ case "blockquote":
+ localProperties["margin-left"] = "16";
+ break;
+
+ case "h1":
+ localProperties["font-size"] = XamlFontSizeXxLarge;
+ break;
+ case "h2":
+ localProperties["font-size"] = XamlFontSizeXLarge;
+ break;
+ case "h3":
+ localProperties["font-size"] = XamlFontSizeLarge;
+ break;
+ case "h4":
+ localProperties["font-size"] = XamlFontSizeMedium;
+ break;
+ case "h5":
+ localProperties["font-size"] = XamlFontSizeSmall;
+ break;
+ case "h6":
+ localProperties["font-size"] = XamlFontSizeXSmall;
+ break;
+ // List properties
+ case "ul":
+ localProperties["list-style-type"] = "disc";
+ break;
+ case "ol":
+ localProperties["list-style-type"] = "decimal";
+ break;
+
+ case "table":
+ case "body":
+ case "html":
+ break;
+ }
+
+ // Override html defaults by css attributes - from stylesheets and inline settings
+ HtmlCssParser.GetElementPropertiesFromCssAttributes(htmlElement, elementName, stylesheet, localProperties,
+ sourceContext);
+
+ // Combine local properties with context to create new current properties
+ propertyEnumerator = localProperties.GetEnumerator();
+ while (propertyEnumerator.MoveNext())
+ {
+ currentProperties[propertyEnumerator.Key] = propertyEnumerator.Value;
+ }
+
+ return currentProperties;
+ }
+
+ ///
+ /// Extracts a value of css attribute from css style definition.
+ ///
+ ///
+ /// Source csll style definition
+ ///
+ ///
+ /// A name of css attribute to extract
+ ///
+ ///
+ /// A string rrepresentation of an attribute value if found;
+ /// null if there is no such attribute in a given string.
+ ///
+ private static string GetCssAttribute(string cssStyle, string attributeName)
+ {
+ // This is poor man's attribute parsing. Replace it by real css parsing
+ if (cssStyle != null)
+ {
+ string[] styleValues;
+
+ attributeName = attributeName.ToLower();
+
+ // Check for width specification in style string
+ styleValues = cssStyle.Split(';');
+
+ foreach (string t in styleValues)
+ {
+ string[] styleNameValue;
+
+ styleNameValue = t.Split(':');
+ if (styleNameValue.Length == 2)
+ {
+ if (styleNameValue[0].Trim().ToLower() == attributeName)
+ {
+ return styleNameValue[1].Trim();
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Converts a length value from string representation to a double.
+ ///
+ ///
+ /// Source string value of a length.
+ ///
+ ///
+ ///
+ private static bool TryGetLengthValue(string lengthAsString, out double length)
+ {
+ length = double.NaN;
+
+ if (lengthAsString != null)
+ {
+ lengthAsString = lengthAsString.Trim().ToLower();
+
+ // We try to convert currentColumnWidthAsString into a double. This will eliminate widths of type "50%", etc.
+ if (lengthAsString.EndsWith("pt"))
+ {
+ lengthAsString = lengthAsString.Substring(0, lengthAsString.Length - 2);
+ if (double.TryParse(lengthAsString, out length))
+ {
+ length = (length*96.0)/72.0; // convert from points to pixels
+ }
+ else
+ {
+ length = double.NaN;
+ }
+ }
+ else if (lengthAsString.EndsWith("px"))
+ {
+ lengthAsString = lengthAsString.Substring(0, lengthAsString.Length - 2);
+ if (!double.TryParse(lengthAsString, out length))
+ {
+ length = double.NaN;
+ }
+ }
+ else
+ {
+ if (!double.TryParse(lengthAsString, out length)) // Assuming pixels
+ {
+ length = double.NaN;
+ }
+ }
+ }
+
+ return !double.IsNaN(length);
+ }
+
+ // .................................................................
+ //
+ // Pasring Color Attribute
+ //
+ // .................................................................
+
+ private static string GetColorValue(string colorValue) => colorValue;
+
+ ///
+ /// Applies properties to xamlTableCellElement based on the html td element it is converted from.
+ ///
+ ///
+ /// Html td/th element to be converted to xaml
+ ///
+ ///
+ /// XmlElement representing Xaml element for which properties are to be processed
+ ///
+ ///
+ /// TODO: Use the processed properties for htmlChildNode instead of using the node itself
+ ///
+ private static void ApplyPropertiesToTableCellElement(XmlElement htmlChildNode, XmlElement xamlTableCellElement)
+ {
+ // Parameter validation
+ Debug.Assert(htmlChildNode.LocalName.ToLower() == "td" || htmlChildNode.LocalName.ToLower() == "th");
+ Debug.Assert(xamlTableCellElement.LocalName == XamlTableCell);
+
+ // set default border thickness for xamlTableCellElement to enable gridlines
+ xamlTableCellElement.SetAttribute(XamlTableCellBorderThickness, "1,1,1,1");
+ xamlTableCellElement.SetAttribute(XamlTableCellBorderBrush, XamlBrushesBlack);
+ var rowSpanString = GetAttribute(htmlChildNode, "rowspan");
+ if (rowSpanString != null)
+ {
+ xamlTableCellElement.SetAttribute(XamlTableCellRowSpan, rowSpanString);
+ }
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlTokenType.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlTokenType.cs
new file mode 100644
index 00000000..7f67764e
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Html/HtmlTokenType.cs
@@ -0,0 +1,22 @@
+// // Copyright (c) Microsoft. All rights reserved.
+// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Xceed.Wpf.Toolkit.Core.Html
+{
+ ///
+ /// types of lexical tokens for html-to-xaml converter
+ ///
+ internal enum HtmlTokenType
+ {
+ OpeningTagStart,
+ ClosingTagStart,
+ TagEnd,
+ EmptyTagEnd,
+ EqualSign,
+ Name,
+ Atom, // any attribute value not in quotes
+ Text, //text content when accepting text
+ Comment,
+ Eof
+ }
+}
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/RichTextBox/Formatters/HtmlFormatter.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/RichTextBox/Formatters/HtmlFormatter.cs
new file mode 100644
index 00000000..66e8a0b1
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/RichTextBox/Formatters/HtmlFormatter.cs
@@ -0,0 +1,45 @@
+using System.IO;
+using System.Text;
+using System.Windows.Documents;
+using System.Xml;
+using System.Xml.Linq;
+using Xceed.Wpf.Toolkit.Core.Html;
+
+namespace Xceed.Wpf.Toolkit
+{
+ ///
+ /// Formats the RichTextBox text as html
+ ///
+ public class HtmlFormatter : ITextFormatter
+ {
+ private readonly XamlFormatter _formatter = new XamlFormatter();
+ public string GetText( FlowDocument document )
+ {
+ string xaml = _formatter.GetText(document);
+ xaml = AddFlowDocumentParentNode(xaml);
+ string html = HtmlFromXamlConverter.ConvertXamlToHtml(xaml);
+
+ return html;
+ }
+
+ private string AddFlowDocumentParentNode(string xaml)
+ {
+ XElement innerXaml = XElement.Parse(xaml);
+ XElement root = new XElement("FlowDocument", innerXaml);
+
+ using (var reader = root.CreateReader())
+ {
+ reader.MoveToContent();
+ xaml = reader.ReadOuterXml();
+ }
+
+ return xaml;
+ }
+
+ public void SetText( FlowDocument document, string text )
+ {
+ string xaml = HtmlToXamlConverter.ConvertHtmlToXaml(text, false);
+ _formatter.SetText(document, xaml);
+ }
+ }
+}
diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj
index 924509db..3a2191d7 100644
--- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj
+++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj
@@ -393,6 +393,14 @@
+
+
+
+
+
+
+
+
@@ -631,6 +639,7 @@
+