Exemplo n.º 1
0
        public override FrameworkElement CreateElement(PropertyItem propertyItem)
        {
            var textbox = new System.Windows.Controls.TextBox
            {
                IsReadOnly = propertyItem.IsReadOnly
            };

            textbox.SetBinding(System.Windows.Controls.TextBox.TextProperty, CreateBinding(propertyItem));

            return(textbox);
        }
Exemplo n.º 2
0
    public Form1()
    {
        InitializeComponent();
        var binding = new System.Windows.Data.Binding("Name");

        binding.Source = new ViewModel {
            Name = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
        };
        // this will update data source every time, when TextBox.Text will changed
        binding.UpdateSourceTrigger = System.Windows.Data.UpdateSourceTrigger.PropertyChanged;
        var textBox = new System.Windows.Controls.TextBox();

        textBox.SetBinding(System.Windows.Controls.TextBox.TextProperty, binding);
        elementHost1.Child = textBox;
    }