diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/ReadOnlyTextBoxEditor.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/ReadOnlyTextBoxEditor.cs new file mode 100644 index 000000000..77a1c82e2 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/ReadOnlyTextBoxEditor.cs @@ -0,0 +1,28 @@ +using System.Windows; +using System.Windows.Controls; +using Xceed.Wpf.Toolkit.PropertyGrid.Editors; + +namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors +{ + public class ReadOnlyTextBoxEditor : TypeEditor + { + protected override TextBox CreateEditor() + { + return new PropertyGridReadOnlyTextBoxEditor(); + } + + protected override void SetValueDependencyProperty() + { + ValueProperty = TextBox.TextProperty; + } + + } + + public class PropertyGridReadOnlyTextBoxEditor : TextBox + { + static PropertyGridReadOnlyTextBoxEditor() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(PropertyGridReadOnlyTextBoxEditor), new FrameworkPropertyMetadata(typeof(PropertyGridReadOnlyTextBoxEditor))); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs index bf7d819dd..260e6f8ed 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs @@ -16,9 +16,11 @@ This program is provided to you under the terms of the Microsoft Public using System.Windows.Controls; using System.Windows; +using System; namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors { + [Obsolete("Use ReadOnlyTextBoxEditor instead which uses a TextBox control for displaying content since TextBlock doesn't support ControlTemplate for customization")] public class TextBlockEditor : TypeEditor { protected override TextBlock CreateEditor() diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs index c4e5efe47..561a64d45 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs @@ -469,7 +469,7 @@ internal FrameworkElement GenerateChildrenEditorElement( PropertyItem propertyIt if( editorElement == null ) { if( pd.IsReadOnly ) - editor = new TextBlockEditor(); + editor = new ReadOnlyTextBoxEditor(); // Fallback: Use a default type editor. if( editor == null ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGridUtilities.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGridUtilities.cs index 081a20aa2..6df246e22 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGridUtilities.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGridUtilities.cs @@ -132,7 +132,7 @@ internal static ITypeEditor CreateDefaultEditor( Type propertyType, TypeConverte // Otherwise, return a TextBlock editor since no valid editor exists. editor = (typeConverter != null && typeConverter.CanConvertFrom( typeof( string ) )) ? (ITypeEditor)new TextBoxEditor() - : (ITypeEditor)new TextBlockEditor(); + : (ITypeEditor)new ReadOnlyTextBoxEditor(); } } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml index 19767ddd6..2e6342ed0 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml @@ -280,7 +280,19 @@ Value="Gray" /> - + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml index d25d07f78..a61657085 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml @@ -286,7 +286,20 @@ Value="Gray" /> - + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj index 6e2315923..112ce2242 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj @@ -441,6 +441,7 @@ +