Skip to content

Embedding UI controls in third party apps

Zev Spitz edited this page Jul 19, 2021 · 3 revisions

(This is overcomplicated; I hope to add some dependency properties on both controls to make this easier.)

You can embed the visualizer UI in your own applications:

  1. Install the ParseTreeVisualizer.UI.Standard NuGet package if you're using Antlr.Runtime.Standard; or the ParseTreeVisualizer.UI.Legacy if you're using the older Antlr.Runtime.
  2. Add the ParseTreeVisualizer.VisualizerControl to your XAML.
  3. Create an instance of ParseTreeVisualizer.Serialization.VisualizerData; pass a string, Antlr.Runtime.BufferedTokenStream, or Antlr.Runtime.RuleContext, or a derived instance, into the constructor.
  4. Create an instance of ParseTreeVisualizer.Serialization.Config; set the options on this instance.
  5. Create an instance of ParseTreeVisualizer.VisualizerDataViewModel using the above VisualizerData and Config.
  6. Set the VisualizerDataViewModel instance as the DataContext of the control.

You can also similarly embed the settings control:

  1. Add the ParseTreeVisualizer.SettingsControl to your XAML.
  2. Get an instance of ParseTreeVisualizer.Serialization.Config.
  3. Create an instance of ParseTreeVisualizer.ConfigViewModel from the Config and VisualizerData.
  4. Set the ConfigViewModel as the DataContext of the settings control.
Clone this wiki locally