Modification to the PropertyStatus control

Modification to the PropertyStatus control

Old forum URL: forums.lhotka.net/forums/t/6031.aspx


Fintanv posted on Friday, December 19, 2008

I am using the PropertyStatus control in the XamDataGrid (see thread: http://forums.lhotka.net/forums/thread/28927.aspx).

I noticed an issue where the icon is not clearing correctly if I have rules that trigger the BO's state from Error to Warning.  In this case the edges of the Error icon are still visible behind the warning icon.  Worse yet if the rules trigger from warning back to error, then the error icon is hidden behind the warning icon.

My workaround was to modifiy the PropertyStatus controls GoToState method to always run the valid storyboard.  Then if the _isValid field is false, run the error storyboard.

My questions are:
    Has anyone else seen this issue?
    Is there a better way to handle this situation?
    Does it make sense to make this change to the csla version of PropertyStatus?

Regards,
Fintan

------------------------------------------------

        private void GoToState(bool useTransitions)
        {
            if (IsLoaded && !DataPortal.IsInDesignMode)
            {
                DisablePopup(_lastImage);
                HandleTarget();

                FrameworkElement root = (FrameworkElement)Template.FindName("root", this);

                if (root != null)
                {
                    // use the following mechanism to clear out the prior icon
                    Storyboard validStoryboard = (Storyboard)Template.Resources["Valid"];
                    validStoryboard.Begin(root);

                    if (!_isValid)
                    {
                        Storyboard errorStoryboard = (Storyboard)Template.Resources[_worst.ToString()];
                        errorStoryboard.Begin(root);
                        _lastImage = (FrameworkElement)Template.FindName(string.Format("{0}Image", _worst.ToString().ToLower()), this);
                        EnablePopup(_lastImage);
                    }
                }
            }
        }

RockfordLhotka replied on Friday, December 19, 2008

Is this problem unique to this grid, or is it a general problem that occurs in other scenarios too?

Copyright (c) Marimer LLC