This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have used the below code to register the custom property. ============================== public static readonly DependencyProperty IsRequiredProperty= DependencyProperty.RegisterAttached( ============== And I have created the get; set methods to it. ================= [Category(@"Mandatory Field Validations")] ==================== I have added the a DataTemplate and property Editor in the xaml file =================== <DataTemplate x:Key="cmbIsRequiredTemplate">
<ms:PropertyEditor PropertyName="ExtProperties.IsRequired" EditorTemplate="{StaticResource cmbIsRequiredTemplate}"/> ================================= I have set an Intial value to it. ============= txt.SetValue(ExtProperties.IsRequiredProperty, string.Empty); ============ I have filtere property to filter the properties ; using the below code ============= TextProperties.Add("ExtProperties.SetSetasMandatoryProperties"); I am unable to view the custom property in my property grid using the above code. ===================== |
|
|
This occurs because your DependencyProperty declaration is incorrect. You must use the same name for the accessor methods and the DP name. You have used “{Get|Set}SetasMandatory” for the accessor methods and “IsMandatory” for the DP name (you also use “IsRequired” for the property object field name, which is a bit confusing though it doesn’t appear to cause a problem). Finally your property editor declaration uses the DP object field name, not the property name. It should be <ms:PropertyEditor PropertyName="ExtProperties.IsMandatory" />. Change your accessor methods to be named GetIsMandatory and SetIsMandatory, fix up the names in the filter and editor declaration, and you should be good to go. |
|