No textbox when PropertyDefinition.IsReadOnly = True

4 posts, 0 answers
  1. Brian
    Brian avatar
    2 posts
    Member since:
    May 2015

    Posted 21 May 2015 Link to this post

    Easier to see in the attached picture than to explain.  I have an enum property with corresponding propertydefinition.isreadonly set to true that shows up as expected.  I have a string readonly property with corresponding propertydefinition.isreadonly set to true which does not show up as expected.  The text box for the value seems to be missing although I can see the property value and it is not editable. 

    XAML

    <telerik:RadPropertyGrid x:Name="SelectionPropertyGrid" x:FieldModifier="private" Grid.Column="1"
    AutoGeneratePropertyDefinitions="True"
    AutoGenerateBindingPaths="True"
    EditorTemplateSelector="{StaticResource PropertyItemTemplateSelector}"
    >

    </telerik:RadPropertyGrid>

    C#

    [DataContract]
    public abstract class BaseTemplate : INotifyPropertyChanged
    {

    #region Properties

    [DataMember]
    public virtual string WorkflowDefinitionDisplayName { get; set; }

    [DataMember]
    public virtual Enumerations.CLScreenType ScreenType { get; set; }

    ...

    public partial class AuthoringPanel
    {

    private void OnGeneratingPropertyDefinitions(object sender, AutoGeneratingPropertyDefinitionEventArgs e)
    {
    var propertyGrid = sender as RadPropertyGrid;
    if (propertyGrid == null) return;
    if (propertyGrid.Item == null) return;

    if (propertyGrid.Item is BaseTemplate)
    {

    if (e.PropertyDefinition.SourceProperty.Name.Equals("WorkflowDefinitionDisplayName"))
    {
    if (((BaseTemplate)propertyGrid.Item).ScreenType == Enumerations.CLScreenType.Configuration)
    {
    e.Cancel = true;
    return;
    }
    e.PropertyDefinition.IsReadOnly = true;
    e.PropertyDefinition.DisplayName = "Workflow";
    e.PropertyDefinition.Description = "Associated workflow which will be called after completing the Right Click Job screen.";
    }

  2. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 22 May 2015 Link to this post

    Hi Brian,

    I am not able to reproduce such behavior with RadPropertyGrid. Please find attached a sample project I set up, based on the code you pasted. Can you please check it an let me know how it differs from your project setup? Have you applied any styles to RadPropertyGrid?

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Brian
    Brian avatar
    2 posts
    Member since:
    May 2015

    Posted 26 May 2015 in reply to Stefan X1 Link to this post

    I've come to realize that there is no issue actually and that I'm only seeing things differently because of the theme that is being used.  If you use the Windows8 theme for example your readonly properties will display identical to the one in the attached screenshot from my original post.
  5. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 29 May 2015 Link to this post

    Hello Brian,

    Indeed, the described behavior is by design for Windows8 theme. For modifying it, you can benefit from the ReadOnlyEditorState property of RadPropertyGrid.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top