Skip to content

Commit 1a34113

Browse files
GSonofNunamaitland
authored andcommitted
WPF - Add TemplatePart Attributes to ChromiumBrowser (#2739)
1 parent 3a5e544 commit 1a34113

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ namespace CefSharp.Wpf
3131
/// <seealso cref="System.Windows.Controls.Control" />
3232
/// <seealso cref="CefSharp.Internals.IRenderWebBrowser" />
3333
/// <seealso cref="CefSharp.Wpf.IWpfWebBrowser" />
34+
[TemplatePart(Name = PartImageName, Type = typeof(Image))]
35+
[TemplatePart(Name = PartPopupImageName, Type = typeof(Image))]
3436
public class ChromiumWebBrowser : Control, IRenderWebBrowser, IWpfWebBrowser
3537
{
38+
private const string PartImageName = "PART_image";
39+
private const string PartPopupImageName = "PART_popupImage";
40+
3641
/// <summary>
3742
/// The source
3843
/// </summary>
@@ -1924,12 +1929,12 @@ public override void OnApplyTemplate()
19241929
if (image == null)
19251930
{
19261931
// Create main window
1927-
image = (Image)GetTemplateChild("PART_image");
1932+
image = (Image)GetTemplateChild(PartImageName);
19281933
}
19291934

19301935
if (popupImage == null)
19311936
{
1932-
popupImage = (Image)GetTemplateChild("PART_popupImage");
1937+
popupImage = (Image)GetTemplateChild(PartPopupImageName);
19331938
}
19341939
}
19351940

0 commit comments

Comments
 (0)