EditableAttribute data modeling attribute

suggest change

EditableAttribute sets whether users should be able to change the value of the class property.

public class Employee
    public string FirstName { get; set; }

Simple usage example in XAML application

<Window x:Class="WpfApplication.MainWindow"
        Height="70" Width="360" Title="Display name example">

        <wpfApplication:EditableConverter x:Key="EditableConverter"/>

    <StackPanel Margin="5">
        <!-- TextBox Text (FirstName property value) -->
        <!-- TextBox IsEnabled (Editable attribute) -->
        <TextBox Text="{Binding Employee.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                 IsEnabled="{Binding Employee, Converter={StaticResource EditableConverter}, ConverterParameter=FirstName}"/>

namespace WpfApplication
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        private Employee _employee = new Employee() { FirstName = "This is not editable"};

        public MainWindow()
            DataContext = this;

        public Employee Employee
            get { return _employee; }
            set { _employee = value; }

namespace WpfApplication
    public class EditableConverter : IValueConverter
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            // return editable attribute's value for given instance property,
            // defaults to true if not found
            var attribute = value.GetType()

            return attribute != null ? attribute.AllowEdit : true;

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            throw new NotImplementedException();

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents