This is a migrated thread and some comments may be shown as answers.

No textbox when PropertyDefinition.IsReadOnly = True

3 Answers 82 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 21 May 2015, 05:50 PM

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.";
}

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 22 May 2015, 03:54 PM
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
0
Brian
Top achievements
Rank 1
answered on 26 May 2015, 07:35 PM
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.
0
Stefan
Telerik team
answered on 29 May 2015, 03:28 PM
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
Tags
PropertyGrid
Asked by
Brian
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Brian
Top achievements
Rank 1
Share this question
or