Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.

### Fixed
- WPF - OxyPlot doesn't render inside a Popup (#1796)
- SkiaSharp.WPF - OxyPlot doesn't render inside an ElementHost (#1800)
- NullReference in SkiaSharp WPF renderer if UIElement has no PresentationSource (#1798)

## [2.1.0] - 2021-10-02
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Don Syme <[email protected]>
DotNetDoctor <[email protected]>
efontana2
elliatab
Elia Herzog
Elmar Strittmatter
episage <[email protected]>
eric
Expand Down
4 changes: 1 addition & 3 deletions Source/OxyPlot.SkiaSharp.Wpf/OxySKElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,16 @@ static bool IsPositive(double value)
/// <summary>
/// Returns a reference to the visual object that hosts the dependency object in the visual tree.
/// </summary>
/// <returns> The host window from the visual tree.</returns>
/// <returns> The host visual from the visual tree.</returns>
private Visual GetAncestorVisualFromVisualTree(DependencyObject startElement)
{

DependencyObject child = startElement;
DependencyObject parent = VisualTreeHelper.GetParent(child);
while (parent != null)
{
child = parent;
parent = VisualTreeHelper.GetParent(child);
}

return child is Visual visualChild ? visualChild : Window.GetWindow(this);
}

Expand Down
7 changes: 7 additions & 0 deletions Source/OxyPlot.Wpf.Shared/PlotViewBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace OxyPlot.Wpf
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using System.Windows.Documents;
using CursorType = OxyPlot.CursorType;

/// <summary>
Expand Down Expand Up @@ -454,6 +455,12 @@ private bool IsInVisualTree()
return true;
}

//Check if the parent is an AdornerDecorator like in an ElementHost
if (dpObject is AdornerDecorator)
{
return true;
}
Comment thread
AELIENUS marked this conversation as resolved.

//Check if the logical parent is a popup. If so, we found the popuproot
var logicalRoot = LogicalTreeHelper.GetParent(dpObject);
if (logicalRoot is Popup)
Expand Down