Beispiel #1
0
        internal void CallBeforeSetByUi(IDataUi dataUi)
        {
            if (BeforeSetByUi != null)
            {
                BeforePropertyChangedArgs args = new BeforePropertyChangedArgs();
                object value;
                dataUi.TryGetValueOnUi(out value);

                args.NewValue = value;

                BeforeSetByUi(this, args);

                if (args.WasManuallySet)
                {
                    // The event changed it, so let's force it back on the UI
                    dataUi.TrySetValueOnUi(args.OverridingValue);
                }
            }
        }
Beispiel #2
0
        public void RefreshDisplay()
        {
            if (mContainer.HasEnoughInformationToWork())
            {
                Type type = mContainer.GetPropertyType();

                InstancePropertyType = type;
            }

            object valueOnInstance;
            bool   successfulGet = mContainer.TryGetValueOnInstance(out valueOnInstance);

            if (successfulGet)
            {
                if (valueOnInstance != null)
                {
                    mContainer.TrySetValueOnUi(valueOnInstance);
                }
                else
                {
                    mAssociatedTextBox.Text = null;
                }
            }


            bool isDefault = InstanceMember.IsDefault;

            if (isDefault)
            {
                mAssociatedTextBox.Foreground = System.Windows.Media.Brushes.Green;
            }
            else
            {
                mAssociatedTextBox.Foreground = System.Windows.Media.Brushes.Black;
            }
        }
Beispiel #3
0
        internal void CallBeforeSetByUi(IDataUi dataUi)
        {
            if (BeforeSetByUi != null)
            {
                BeforePropertyChangedArgs args = new BeforePropertyChangedArgs();
                object value;
                dataUi.TryGetValueOnUi(out value);

                args.NewValue = value;

                BeforeSetByUi(this, args);

                if (args.WasManuallySet)
                {
                    // The event changed it, so let's force it back on the UI
                    dataUi.TrySetValueOnUi(args.OverridingValue);
                }
            }
        }