Example #1
0
        internal EditItem(Window owner, bool isReadOnly = false, ItemModel model = null) : this()
        {
            this.Owner = owner;
            var localModel = new ItemModel();

            if (null == model)
            {
                this._model = new ItemModel();
            }
            else
            {
                this._model = model;
                localModel.CopyFrom(model);
            }
            localModel.IsReadOnly = isReadOnly;
            this.DataContext      = localModel;
            this.cIcon.ByteSource = localModel.Icon;
            this.cEdit.Visibility = isReadOnly ? Visibility.Visible : Visibility.Hidden;
            this.c*K.Visibility   = isReadOnly ? Visibility.Hidden : Visibility.Visible;
            this.c*K.IsEnabled    = (0 < this._model.DisplayName?.Length);
        }