<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>wpg Forum Rss Feed</title><link>http://www.codeplex.com/wpg/Thread/List.aspx</link><description>wpg Forum Rss Description</description><item><title>New Post: ComboBox </title><link>http://wpg.codeplex.com/discussions/427884</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;&lt;span&gt;How do I use a combobox in a propertygrid without using enum, for &lt;span&gt;
string property that i want to limit to a few&amp;nbsp;&lt;/span&gt;&lt;span&gt;choices but to enabled&amp;nbsp;&lt;span&gt;free-form&amp;nbsp;&lt;/span&gt;&lt;span&gt;entry?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;Any suggestions?&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</description><author>damir3003</author><pubDate>Fri, 28 Dec 2012 09:19:30 GMT</pubDate><guid isPermaLink="false">New Post: ComboBox  20121228091930A</guid></item><item><title>New Post: Dynamic Categories? </title><link>http://wpg.codeplex.com/discussions/401123</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Is it possible to have dynamic categories?&lt;/p&gt;
&lt;p&gt;Depending on the data imported to program, I need to create property grid with different categories. Any ideas?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;/div&gt;</description><author>anejad</author><pubDate>Mon, 29 Oct 2012 14:18:02 GMT</pubDate><guid isPermaLink="false">New Post: Dynamic Categories?  20121029021802P</guid></item><item><title>New Post: Add validation routine for a field</title><link>http://wpg.codeplex.com/discussions/396769</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi, for a property grid class, I want to limit the values that its field may contain. Can you please give me some idea, how to achieve that please? Thanks.&lt;/p&gt;
&lt;/div&gt;</description><author>ranacseruet</author><pubDate>Tue, 25 Sep 2012 06:17:44 GMT</pubDate><guid isPermaLink="false">New Post: Add validation routine for a field 20120925061744A</guid></item><item><title>New Post: Working with List&lt;T&gt;</title><link>http://wpg.codeplex.com/discussions/389040</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi everybody,&lt;/p&gt;
&lt;p&gt;I cannot make the following class work with WPG.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;    public class Person
    {
        public string FirstName { get; set; }
        public string SecondName { get; set; }
        public int Age { get; set; }
        
        public List&amp;lt;Point&amp;gt; Curve { get; set; }


        public Person()
        {
            Curve = new List();
        }

    }

    public class Point
    {
        public double X { get; set; }
        public double Y { get; set; }
    }&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I went through all discussion, and kind of understand where I have to make changes. Spent whole day, with no result. Could anybody help me with it?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried to use&amp;nbsp;approach&amp;nbsp;with IList (from one of the discussions here), but it doesn't work with&amp;nbsp;CollectionEditorControl... &amp;nbsp;Maybe I'm doing somethung wrong, maybe some required attributes are missing... Not sure.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;nbsp;also&amp;nbsp;ready to use strong types&amp;nbsp;instead&amp;nbsp;of T, say this Point class can be hardcoded to WPG. It's not a problem for me (however it's not&amp;nbsp;beautiful). I work on app where I need to represent only few&amp;nbsp;different&amp;nbsp;types.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</description><author>sumus17</author><pubDate>Wed, 25 Jul 2012 20:46:40 GMT</pubDate><guid isPermaLink="false">New Post: Working with List&lt;T&gt; 20120725084640P</guid></item><item><title>New Post: openFile property</title><link>http://wpg.codeplex.com/discussions/362383</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I want to create a customized property when I click on its value-which is button- OpenFileDialogue appears to select the file and return file path to that property.&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;
&lt;/div&gt;</description><author>mAmged</author><pubDate>Sat, 07 Jul 2012 19:48:50 GMT</pubDate><guid isPermaLink="false">New Post: openFile property 20120707074850P</guid></item><item><title>New Post: Property validation, IDataErrorInfo "Instance"</title><link>http://wpg.codeplex.com/discussions/271140</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi hisss,&lt;/p&gt;
&lt;p&gt;Thanks for your help...&lt;/p&gt;
&lt;p&gt;-Rafael&lt;/p&gt;&lt;/div&gt;</description><author>RafaelNadal</author><pubDate>Mon, 02 Jul 2012 12:53:15 GMT</pubDate><guid isPermaLink="false">New Post: Property validation, IDataErrorInfo "Instance" 20120702125315P</guid></item><item><title>New Post: Property validation, IDataErrorInfo "Instance"</title><link>http://wpg.codeplex.com/discussions/271140</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hello Rafael,&lt;/p&gt;
&lt;p&gt;I will start from down down to up the last piece of code has number 1:&lt;/p&gt;
&lt;p&gt;1. piece is located should be located in WPGTemplates.xaml (Themes/THEME/WPGTemplates.xaml)&lt;/p&gt;
&lt;p&gt;This piece causes that default template (textbox) starts normal wpf validation. Before that there was only ExceptionValidateRule or nothing. I wanted to use DataErrorValidationRule.&lt;/p&gt;
&lt;p&gt;2. You should add this to other editors templates if you want to use them. again in WPGTemplates.xaml or in custom templates. It is standard in WPF.&lt;/p&gt;
&lt;p&gt;3. I wanted to create form, that you can't close until your property grid is valid. So if you want to do something like that, just add this code to the propertyGrid.cs and bind for example enabled property of "ok" button to IsValid property.&lt;/p&gt;
&lt;p&gt;4. This is implementation of IDataErrorInfo interface on "Property" class. It causes validation only if yours instance object implements IDataErrorInfo.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So Example: Just add this code to the concreate files (WPGTemplates.xaml, PropertyViewModel, PropertyGrid. And try to show any object which implements IDataErrorInfo interface. If you have any validation error there yours textxtboxes appears "red" bordered.&lt;/p&gt;
&lt;p&gt;Actualy i stopped using WPG. I don't want to write to this forum the reasons. if you want to know my reasons, and solution write me an email:&lt;/p&gt;
&lt;p&gt;\P\E\T\E\R\.\L\A\P\I\N\.\1\1\8\@\G\M\A\I\L\.\C\O\M&lt;/p&gt;
&lt;p&gt;WITHOUT SLASHES...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>hisss</author><pubDate>Fri, 29 Jun 2012 09:03:10 GMT</pubDate><guid isPermaLink="false">New Post: Property validation, IDataErrorInfo "Instance" 20120629090310A</guid></item><item><title>New Post: Property validation, IDataErrorInfo "Instance"</title><link>http://wpg.codeplex.com/discussions/271140</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I am a newbie.. Could u please explain everything fully rather than telling it in parts.. I dont know where to put the data template that u mentioned in this discussion. It would be nice if u explain the above code through a simple example again..&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Nadal&lt;/p&gt;&lt;/div&gt;</description><author>RafaelNadal</author><pubDate>Fri, 29 Jun 2012 07:44:19 GMT</pubDate><guid isPermaLink="false">New Post: Property validation, IDataErrorInfo "Instance" 20120629074419A</guid></item><item><title>New Post: Style Does Not Seem To Set</title><link>http://wpg.codeplex.com/discussions/350394</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Ok...So I do know that for example the PropertyGrid.xaml can have its colors changed from the Brush ResourceId to raw colors and I can see the difference.&amp;nbsp; However, I am still a little bit stumped as to what is going on.&amp;nbsp; Apparently, I don't get anything out of the Brush Xaml file.&amp;nbsp; I guess I will have to look and see why but for now I'm not sure.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks much.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;/div&gt;</description><author>etoraaso</author><pubDate>Thu, 29 Mar 2012 00:44:55 GMT</pubDate><guid isPermaLink="false">New Post: Style Does Not Seem To Set 20120329124455A</guid></item><item><title>New Post: Style Does Not Seem To Set</title><link>http://wpg.codeplex.com/discussions/350394</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;It may have something to do with the Brushes having their colors contain Hex values?&amp;nbsp; I have been playing with other controls and using the Color set for say a background will not work with "#FFFFFFFF" but does for the explicit "Black" (I tried both a SolidColorBrush and the raw Color).&amp;nbsp; Anyways, I wonder if I'm missing a TypeConverter or something?&amp;nbsp; Changing the Brushes to use a Color string instead of the Hex value didn't seem to work either so the hook into that file seems to be broken somehow.&amp;nbsp; I changed many of them to a single Color (Green) and everything is still white.&amp;nbsp; That must be the "At least we tried" style I guess.&lt;/p&gt;
&lt;p&gt;Anyways, I'll post if I find anything else.&amp;nbsp; Thanks much.&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;/div&gt;</description><author>etoraaso</author><pubDate>Thu, 29 Mar 2012 00:30:10 GMT</pubDate><guid isPermaLink="false">New Post: Style Does Not Seem To Set 20120329123010A</guid></item><item><title>New Post: Style Does Not Seem To Set</title><link>http://wpg.codeplex.com/discussions/350394</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hello all,&lt;/p&gt;
&lt;p&gt;I am using .Net 4.0 with the Expression Blend version and while my property grid looks pretty decent, I am not getting any colors.&amp;nbsp; I'm not sure if I should be expecting the black expression blend image on the Home page, but something appears to be
 wrong.&amp;nbsp; I would like to customize the feel but it seems that any changes I make in my Brushes.xaml page don't seem to change anything.&amp;nbsp; Is there something I need to do to activate it?&lt;/p&gt;
&lt;p&gt;I checked out the version right before it was converted back to .Net 3.5 and I am using VS 2010.&amp;nbsp; I did have to change some things to make mine work but they didn't take too long to track down. (Changes:&amp;nbsp; Add in the Generic.xaml/ExpressionBlend.xaml
 into my own App.xaml.&amp;nbsp; Update some of the paths in the MergedDictionaries to account for my project name rather than the included Demo project.&amp;nbsp; Had to add the trick to get my project to be able to resolve the Dictionaries in my app.xaml file...notice
 the snippet at the bottom with the dummy style. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Anyways, any help would be much appreciated.&amp;nbsp; The Grid looks great and I am curious how active anyone is here.&amp;nbsp; I figure if my grid is able to locate the other Xaml files that correspond to the different Windows Controls, it should be able to find
 the Brushes file.&amp;nbsp; Additionally, I would expect my app to have an error if it were unable to resolve an Id for a specific brush.&amp;nbsp; Anyways, seems strange to me.&lt;/p&gt;
&lt;p&gt;Erik&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Snippet Mentioned Above (In my App.xaml):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ResourceDictionary&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ResourceDictionary Source=&amp;quot;/Platform;component/Themes/Generic.xaml&amp;quot; /&amp;gt;&amp;nbsp;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Style TargetType=&amp;quot;{x:Type Window}&amp;quot;/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ResourceDictionary&amp;gt;&lt;/p&gt;
&lt;/div&gt;</description><author>etoraaso</author><pubDate>Wed, 28 Mar 2012 23:20:21 GMT</pubDate><guid isPermaLink="false">New Post: Style Does Not Seem To Set 20120328112021P</guid></item><item><title>New Post: use the property grid with .Net 4.0 WF Activities like this</title><link>http://wpg.codeplex.com/discussions/222511</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;I did figure out how to use the fade-out editor that the default grid uses. Here is some sample code:&lt;/p&gt;
&lt;p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Activities.Presentation.PropertyEditing;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Reflection;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Windows;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Windows.Data;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Company.Services;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Company.Units;

&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Company.Ui.Wpf.Converters
{
	&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; UnitOfMeasureEditor: PropertyValueEditor
	{
		&lt;span style="color: blue;"&gt;public&lt;/span&gt; UnitOfMeasureEditor()
		{
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; type = &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(PropertyValueEditor).Assembly.GetType(&lt;span style="color: #a31515;"&gt;"System.Activities.Presentation.Internal.PropertyEditing.Automation.AutomatedChoiceEditor"&lt;/span&gt;, &lt;span style="color: blue;"&gt;true&lt;/span&gt;, &lt;span style="color: blue;"&gt;false&lt;/span&gt;);
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; itemSourceProperty = (DependencyProperty)type.BaseType.GetField(&lt;span style="color: #a31515;"&gt;"ItemsSourceProperty"&lt;/span&gt;, BindingFlags.Public | BindingFlags.Static).GetValue(&lt;span style="color: blue;"&gt;null&lt;/span&gt;);
			&lt;span style="color: blue;"&gt;var&lt;/span&gt; itemValueProperty = (DependencyProperty)type.BaseType.GetField(&lt;span style="color: #a31515;"&gt;"ValueProperty"&lt;/span&gt;, BindingFlags.Public | BindingFlags.Static).GetValue(&lt;span style="color: blue;"&gt;null&lt;/span&gt;);

			&lt;span style="color: blue;"&gt;var&lt;/span&gt; lbfac = &lt;span style="color: blue;"&gt;new&lt;/span&gt; FrameworkElementFactory(type);

			&lt;span style="color: blue;"&gt;var&lt;/span&gt; sourceBinding = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Binding();
			sourceBinding.Mode = BindingMode.OneTime;

			&lt;span style="color: blue;"&gt;var&lt;/span&gt; um = ServiceRegistry.Get&amp;lt;UnitsManager&amp;gt;();
			sourceBinding.Source = um.AllUnits;

			lbfac.SetBinding(itemSourceProperty, sourceBinding);

			&lt;span style="color: blue;"&gt;var&lt;/span&gt; valueBinding = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Binding(&lt;span style="color: #a31515;"&gt;"Value"&lt;/span&gt;);
			valueBinding.Mode = BindingMode.TwoWay;

			lbfac.SetBinding(itemValueProperty, valueBinding);

			&lt;span style="color: blue;"&gt;var&lt;/span&gt; dt = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DataTemplate();
			dt.VisualTree = lbfac;

			InlineEditorTemplate = dt;
		}
	}
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;</description><author>brantheman</author><pubDate>Thu, 22 Mar 2012 14:39:07 GMT</pubDate><guid isPermaLink="false">New Post: use the property grid with .Net 4.0 WF Activities like this 20120322023907P</guid></item><item><title>New Post: ould not load file or assembly 'WPG, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</title><link>http://wpg.codeplex.com/discussions/347206</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi there.&lt;/p&gt;
&lt;p&gt;I'm using PRISM and&amp;nbsp;this new control which. While I was testing the DEMO, it was everthing going well. But since I used PRISM, if I put the control in a Shell, also goes well, but if I put the control in a Module, it throws an error.&lt;/p&gt;
&lt;p&gt;Could not load file or assembly 'WPG, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.&lt;/p&gt;
&lt;p&gt;Someone knows why it show me this exception?&lt;/p&gt;
&lt;pre&gt;&lt;a href="http://i.stack.imgur.com/n6Ffh.png"&gt;http://i.stack.imgur.com/n6Ffh.png&lt;/a&gt;&lt;/pre&gt;
&lt;/div&gt;</description><author>ofimbres</author><pubDate>Sun, 04 Mar 2012 03:54:27 GMT</pubDate><guid isPermaLink="false">New Post: ould not load file or assembly 'WPG, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. 20120304035427A</guid></item><item><title>New Post: Row height issues</title><link>http://wpg.codeplex.com/discussions/261055</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;It also gets worse if you use a font that is bigger as well.&lt;/p&gt;&lt;/div&gt;</description><author>smurfiv</author><pubDate>Tue, 21 Feb 2012 19:13:36 GMT</pubDate><guid isPermaLink="false">New Post: Row height issues 20120221071336P</guid></item><item><title>New Post: Name/ Value width</title><link>http://wpg.codeplex.com/discussions/266532</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Adjust the "NameWidth" in the Other category, when in the designer.&lt;/p&gt;&lt;/div&gt;</description><author>smurfiv</author><pubDate>Tue, 21 Feb 2012 19:11:48 GMT</pubDate><guid isPermaLink="false">New Post: Name/ Value width 20120221071148P</guid></item><item><title>New Post: Hide search box</title><link>http://wpg.codeplex.com/discussions/291041</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Yes I have done this, and the type property as well (I'll post a Patch sometime)&lt;/p&gt;
&lt;p&gt;Here are the details for PropertyGrid.cs&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;        &lt;span style="color: blue;"&gt;#region&lt;/span&gt; Show Search Property

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;Identifies the ShowSearch dependency property&amp;lt;/value&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; DependencyProperty ShowSearchProperty =
            DependencyProperty.Register(&lt;span style="color: #a31515;"&gt;"ShowSearch"&lt;/span&gt;, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue;"&gt;bool&lt;/span&gt;), &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(PropertyGrid),
                                        &lt;span style="color: blue;"&gt;new&lt;/span&gt; FrameworkPropertyMetadata(&lt;span style="color: blue;"&gt;false&lt;/span&gt;));

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;description for ShowSearch property&amp;lt;/value&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; ShowSearch
        {
           &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; (&lt;span style="color: blue;"&gt;bool&lt;/span&gt;)GetValue(ShowSearchProperty); }
           &lt;span style="color: blue;"&gt;set&lt;/span&gt; { SetValue(ShowSearchProperty, value); }
        }

        &lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;

        &lt;span style="color: blue;"&gt;#region&lt;/span&gt; Show Type Property

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;Identifies the ShowType dependency property&amp;lt;/value&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; DependencyProperty ShowTypeProperty =
            DependencyProperty.Register(&lt;span style="color: #a31515;"&gt;"ShowType"&lt;/span&gt;, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue;"&gt;bool&lt;/span&gt;), &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(PropertyGrid),
                                        &lt;span style="color: blue;"&gt;new&lt;/span&gt; FrameworkPropertyMetadata(&lt;span style="color: blue;"&gt;false&lt;/span&gt;));

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;description for ShowType property&amp;lt;/value&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; ShowType
        {
           &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; (&lt;span style="color: blue;"&gt;bool&lt;/span&gt;)GetValue(ShowTypeProperty); }
           &lt;span style="color: blue;"&gt;set&lt;/span&gt; { SetValue(ShowTypeProperty, value); }
        }

        &lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And here are the details for PropertyGrid.Xaml (I'm sure you will be able to work out their locations)&lt;/p&gt;
&lt;pre&gt;&lt;div style="color: black; background-color: white;"&gt;&lt;pre&gt;								&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt; &lt;span style="color: red;"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                              &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt; &lt;span style="color: red;"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{TemplateBinding local:PropertyGrid.ShowType}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Top&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Margin&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;6 2 0 4&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
										&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt; &lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Left&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;PART_InstanceType&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Bold&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
										&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt; &lt;span style="color: red;"&gt;Width&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Left&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;:&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
										&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt; &lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Left&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;PART_InstanceName&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                 &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel.Visibility&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                    &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                       &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.Converter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                          &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;BooleanToVisibilityConverter&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
                                       &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.Converter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                    &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                 &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel.Visibility&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                              &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
...
...
...
                                &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox&lt;/span&gt; &lt;span style="color: red;"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{TemplateBinding local:PropertyGrid.ShowSearch}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Left&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Margin&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;8 0 8 0&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=SearchTextBoxStyle}}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Filter, UpdateSourceTrigger=PropertyChanged}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                    &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox.Visibility&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                       &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                          &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.Converter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                             &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;BooleanToVisibilityConverter&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
                                          &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.Converter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                       &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                    &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox.Visibility&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                                 &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
									&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;&lt;/div&gt;</description><author>smurfiv</author><pubDate>Tue, 21 Feb 2012 19:08:46 GMT</pubDate><guid isPermaLink="false">New Post: Hide search box 20120221070846P</guid></item><item><title>New Post: Hide search box</title><link>http://wpg.codeplex.com/discussions/291041</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;Is there a way to Hide the search Box?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;/div&gt;</description><author>lsdisciples</author><pubDate>Fri, 03 Feb 2012 03:52:31 GMT</pubDate><guid isPermaLink="false">New Post: Hide search box 20120203035231A</guid></item><item><title>New Post: Is WPG ComboBoxItem style in ComboBox.xaml unused?</title><link>http://wpg.codeplex.com/discussions/282701</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Dear every one:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; when I use WPG with these code:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color:#0000ff"&gt;public enum&lt;/span&gt; &lt;span style="color:#008080"&gt;
ServiceState&lt;/span&gt;&amp;nbsp; &amp;nbsp; {&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color:#ff00ff"&gt;
UnSpecific&lt;/span&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color:#ff00ff"&gt;Launch&lt;/span&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;span style="color:#ff00ff"&gt;Initializing&lt;/span&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color:#ff00ff"&gt;
Running&lt;/span&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color:#ff00ff"&gt;Stop&lt;/span&gt;,&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color:#0000ff"&gt;public class&lt;/span&gt; &lt;span style="color:#008080"&gt;
Service&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; public&amp;nbsp;&lt;span style="color:#008080"&gt;ServiceState &lt;span style="color:#000000"&gt;
State&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008080"&gt;&lt;span style="color:#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008080"&gt;&lt;span style="color:#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008080"&gt;&lt;span style="color:#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private set;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008080"&gt;&lt;span style="color:#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;set the &lt;span style="color:#008080"&gt;Service&lt;/span&gt; object to WPF's Instance property, then I found it WPG's ComboBox that correspond&amp;nbsp;&lt;span style="color:#ff00ff"&gt;State
&lt;span style="color:#000000"&gt;property of the Service object&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;can be&amp;nbsp;select-able(I thought it can't be select-able cause the&amp;nbsp;&lt;span style="color:#ff00ff"&gt;State&amp;nbsp;&lt;/span&gt;property is read only), and when you select a new value, WPG will crash&lt;/p&gt;
&lt;p&gt;and the exception is StackOverflow.&lt;/p&gt;
&lt;p&gt;So, I try to modify the&amp;nbsp;&lt;span style="color:#808000"&gt;ComboBoxItem style &lt;span style="color:#000000"&gt;
defines in&amp;nbsp;&amp;nbsp;ComboBox.xaml, add one line code just for test:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#808000"&gt;&lt;span style="color:#000000"&gt;&amp;lt;Setter Property=&amp;quot;IsEnable&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#808000"&gt;&lt;span style="color:#000000"&gt;But nothing is changed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#808000"&gt;&lt;span style="color:#000000"&gt;Could some one help me? many thanks for any help.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</description><author>linguohua</author><pubDate>Mon, 12 Dec 2011 22:59:51 GMT</pubDate><guid isPermaLink="false">New Post: Is WPG ComboBoxItem style in ComboBox.xaml unused? 20111212105951P</guid></item><item><title>New Post: Collections editors and other objects ? </title><link>http://wpg.codeplex.com/discussions/279396</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Is there a way to show all collections include in an object displayed in the WPF propertyGrid ?&amp;nbsp; The classname is shown instead of the button to access to the collection.&lt;/p&gt;
&lt;p&gt;- Is it because the WPG need some config to be able to display the "collection"&amp;nbsp;(All the editors)&lt;/p&gt;
&lt;p&gt;- Is there a commercial WPF propertyGrid who can display ***ALL**** the properties using a kind of collection editor&amp;nbsp;(JUST LIKE IN VISUAL STUDIO&amp;nbsp;when creating a control)&lt;/p&gt;
&lt;p&gt;I need to use a propertyGrid in WPF (very similar to VisualStudio WPG) to display mostly WPF controls properties,&lt;/p&gt;
&lt;p&gt;Thanks for any help&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;/div&gt;</description><author>lsdisciples</author><pubDate>Mon, 14 Nov 2011 16:49:06 GMT</pubDate><guid isPermaLink="false">New Post: Collections editors and other objects ?  20111114044906P</guid></item><item><title>New Post: Property validation, IDataErrorInfo "Instance"</title><link>http://wpg.codeplex.com/discussions/271140</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;&lt;strong&gt;Problem definition:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I wanted to validate fields in WPG &lt;/li&gt;
&lt;li&gt;I didn't want to make big changes in WPG implementation &lt;/li&gt;
&lt;li&gt;I wanted to put WPG into "OK|Cancel" dialog and disable "OK" button if values in property grid are not valid. &lt;/li&gt;
&lt;li&gt;Instance of my edited object implements IDataErrorInfo &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Here is my Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Implementation IDataErrorInfo on Property. &lt;/li&gt;
&lt;li&gt;Implementation IsValid and Error on PropertyGrid. &lt;/li&gt;
&lt;li&gt;Set validation rules for bindings&amp;nbsp; in Templates. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Implementation IDataErrorInfo on Property&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;		&lt;span style="color: blue;"&gt;#region&lt;/span&gt; IDataErrorInfo Members

		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Error
		{
			&lt;span style="color: blue;"&gt;get&lt;/span&gt; 
			{
				&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;this&lt;/span&gt;._instance &lt;span style="color: blue;"&gt;is&lt;/span&gt; IDataErrorInfo)
				{
					&lt;span style="color: blue;"&gt;return&lt;/span&gt; (_instance &lt;span style="color: blue;"&gt;as&lt;/span&gt; IDataErrorInfo).Error;
				}
				&lt;span style="color: blue;"&gt;else&lt;/span&gt; 
					&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;null&lt;/span&gt;;
			}
		}

		&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; &lt;span style="color: blue;"&gt;this&lt;/span&gt;[&lt;span style="color: blue;"&gt;string&lt;/span&gt; columnName]
		{
			&lt;span style="color: blue;"&gt;get&lt;/span&gt; 
			{
				&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: blue;"&gt;this&lt;/span&gt;._instance &lt;span style="color: blue;"&gt;is&lt;/span&gt; IDataErrorInfo)
				{
					&lt;span style="color: blue;"&gt;return&lt;/span&gt; (_instance &lt;span style="color: blue;"&gt;as&lt;/span&gt; IDataErrorInfo)[&lt;span style="color: blue;"&gt;this&lt;/span&gt;._property.Name];
				}
				&lt;span style="color: blue;"&gt;else&lt;/span&gt;
					&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;null&lt;/span&gt;;
			}
		}

		&lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Implementation IsValid and Error on PropertyGrid&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In PropertyGrid i need to know about every change in my internal Instance to provide global "IsValid" and "Error" property. So I Added this code snippet to PropertyGrid.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Invoked on Instance change.&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;param name="d"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The object that was changed&amp;lt;/param&amp;gt;&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;param name="e"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;Dependency property changed event arguments&amp;lt;/param&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; OnInstanceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            &lt;span style="color: blue;"&gt;var&lt;/span&gt; propertyGrid = d &lt;span style="color: blue;"&gt;as&lt;/span&gt; PropertyGrid;

            propertyGrid.SelectedProperty = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;

            propertyGrid.Refresh();

            propertyGrid.RaiseInstanceChanged();

            &lt;span style="color: green;"&gt;//My method. Hook to new instance&lt;/span&gt;
            propertyGrid.InstanceObjectChanged(e.NewValue, e.OldValue);
            
            &lt;span style="color: green;"&gt;//First time initialize an Error&lt;/span&gt;
            propertyGrid.InstancePropertyChanged(propertyGrid.Instance, &lt;span style="color: blue;"&gt;null&lt;/span&gt;);
        }

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Registers my PropertyChanged event listener to Instance object.&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Unregisters my PropertyChaned event listener from old Instance.&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; InstanceObjectChanged(&lt;span style="color: blue;"&gt;object&lt;/span&gt; newInstace, &lt;span style="color: blue;"&gt;object&lt;/span&gt; oldInstance)
        {
            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (newInstace &lt;span style="color: blue;"&gt;is&lt;/span&gt; INotifyPropertyChanged)
            {
                (newInstace &lt;span style="color: blue;"&gt;as&lt;/span&gt; INotifyPropertyChanged)
                    .PropertyChanged += InstancePropertyChanged;
            }

            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (oldInstance &lt;span style="color: blue;"&gt;is&lt;/span&gt; INotifyPropertyChanged)
            {
                (newInstace &lt;span style="color: blue;"&gt;as&lt;/span&gt; INotifyPropertyChanged)
                    .PropertyChanged -= InstancePropertyChanged;
            }
        }

        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Change the Error property.&lt;/span&gt;
        &lt;span style="color: gray;"&gt;///&lt;/span&gt; &lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;void&lt;/span&gt; InstancePropertyChanged(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, PropertyChangedEventArgs e)
        {
            &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Error = Instance &lt;span style="color: blue;"&gt;is&lt;/span&gt; IDataErrorInfo ?
                     (Instance &lt;span style="color: blue;"&gt;as&lt;/span&gt; IDataErrorInfo).Error :
                     &lt;span style="color: blue;"&gt;string&lt;/span&gt;.Empty;
        }


        &lt;span style="color: blue;"&gt;#region&lt;/span&gt; IsValid Dependency Property
        
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; IsValid
        {
            &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; (&lt;span style="color: blue;"&gt;bool&lt;/span&gt;)GetValue(IsValidProperty); }
            &lt;span style="color: blue;"&gt;set&lt;/span&gt; { SetValue(IsValidProperty, value); }
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;readonly&lt;/span&gt; DependencyProperty IsValidProperty = 
            DependencyProperty.Register(&lt;span style="color: #a31515;"&gt;"IsValid"&lt;/span&gt;, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue;"&gt;bool&lt;/span&gt;), &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(PropertyGrid), &lt;span style="color: blue;"&gt;new&lt;/span&gt; UIPropertyMetadata(&lt;span style="color: blue;"&gt;true&lt;/span&gt;));

        &lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;

        &lt;span style="color: blue;"&gt;#region&lt;/span&gt; Error Dependency Property
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Error
        {
            &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; (&lt;span style="color: blue;"&gt;string&lt;/span&gt;)GetValue(ErrorProperty); }
            &lt;span style="color: blue;"&gt;set&lt;/span&gt; { SetValue(ErrorProperty, value); }
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;readonly&lt;/span&gt; DependencyProperty ErrorProperty = 
            DependencyProperty.Register(&lt;span style="color: #a31515;"&gt;"Error"&lt;/span&gt;, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue;"&gt;string&lt;/span&gt;), &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(PropertyGrid), &lt;span style="color: blue;"&gt;new&lt;/span&gt; UIPropertyMetadata(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Empty, OnErrorChanged));

        &lt;span style="color: green;"&gt;//When Error changes we need to change IsValid property&lt;/span&gt;
        &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; OnErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyGrid pg = d &lt;span style="color: blue;"&gt;as&lt;/span&gt; PropertyGrid;
            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (pg.Instance &lt;span style="color: blue;"&gt;is&lt;/span&gt; IDataErrorInfo)
            {
                pg.IsValid = &lt;span style="color: blue;"&gt;string&lt;/span&gt;.IsNullOrEmpty((pg.Instance &lt;span style="color: blue;"&gt;as&lt;/span&gt; IDataErrorInfo).Error);
            }
        }
        &lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;
&lt;br /&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Set validation rules for bindings in Templates.&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally i needed to set Validation rules to Templates to show error templates on every field:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;                    &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.ValidationRules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DataErrorValidationRule&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;ExceptionValidationRule&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.ValidationRules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;on every template: Here is for example "default" template:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;	&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DataTemplate&lt;/span&gt; &lt;span style="color: red;"&gt;x:Key&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=default}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
		&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox&lt;/span&gt; &lt;span style="color: red;"&gt;IsReadOnly&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{Binding Path=IsReadOnly}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBoxStyle}}&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
			&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox.Text&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
				&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt; &lt;span style="color: red;"&gt;Mode&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;TwoWay&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;Path&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Value&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
					&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.ValidationRules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
						&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DataErrorValidationRule&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
						&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;ExceptionValidationRule&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
					&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding.ValidationRules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
				&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
			&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox.Text&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
		&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBox&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
	&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</description><author>hisss</author><pubDate>Thu, 01 Sep 2011 12:52:52 GMT</pubDate><guid isPermaLink="false">New Post: Property validation, IDataErrorInfo "Instance" 20110901125252P</guid></item></channel></rss>