From 85533d9d49c49bd095eec4b142d28bea89a42b26 Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Fri, 24 Jun 2011 15:44:05 +0000 Subject: [PATCH] ChildWindow: fixed bug in the .NET 3.5 version when setting the FocusVisualStyle in the OnApplyTemplate method. .NET 3.5 doesn't support setting Setter.Value with a ContentControl so it is a limitation of the .net framework. Luckily this works in .NET 4.0. The work around was to not use a focus visual style in the .NET 3.5 version and to set it to null. --- .../ChildWindow/Implementation/ChildWindow.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/Implementation/ChildWindow.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/Implementation/ChildWindow.cs index 5c449150..8c0a8578 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/Implementation/ChildWindow.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/Implementation/ChildWindow.cs @@ -430,6 +430,9 @@ namespace Microsoft.Windows.Controls _root = GetTemplateChild("Root") as Grid; +#if VS2008 + FocusVisualStyle = null; +#else Style focusStyle = _root.Resources["FocusVisualStyle"] as Style; if (focusStyle != null) { @@ -437,7 +440,7 @@ namespace Microsoft.Windows.Controls focusStyle.Setters.Add(focusStyleDataContext); FocusVisualStyle = focusStyle; } - +#endif _root.Children.Add(_modalLayerPanel); }