locked
button in Popup won't change to Normal from PointerOver(with skydrive sample) RRS feed

  • Question

  • Hello,

    I upload a sample project for this bug on SkyDrive,the linkage is : https://skydrive.live.com/redir?resid=6DDDD4F2639093C8!140

    and the bug description is as followed,(once I post the bug which is a Ms Known Issue,) Any one can help me find a workaround ?

    I put a buttonA on appbar, click buttonA will call up a Popup, which contain a buttonB, click buttonB will disappear appbar  & popup.

    THE Problem is :

    Initially the buttonB is Red, move pointer to buttonB it will turn to Yellow, after click it changed to DarkGray; after click buttonB i hide the Popup by setting IsOpen = false; then I reopen the popup, but the color of buttonB still keep Yellow, buttonB won't be Red unless I first move the pointer into buttonB then move outside buttonB.

    Why?  did I hide the Popup won't reset the buttonB status ?

    (by the way, if i navigate to another page, then navigate back this page, try to show buttonB,  buttonB will show Red; If i keep in the same page, after click buttonB, then reopen to show buttonB, it always show Yellow, which is wrong.)

    Please help.


    programmer

    Monday, May 6, 2013 10:05 AM

Answers

  • Hello programmer

    In your sample code I have added just two lines(Bold Lines) as follow,

    private void OnAppBarShowPopupClicked(object sender, RoutedEventArgs e)
            {
                try
                {
    
                    if (!DeleteConfirmPopup.IsOpen)
                    {
                        // 计算位置
                        Rect rect = GetElementRect((FrameworkElement)sender);
    
                        DeleteConfirmPopup.VerticalOffset = rect.Y - 150;
                        DeleteConfirmPopup.HorizontalOffset = (rect.X > (Window.Current.Bounds.Width / 2) ? (rect.X - 350) : (rect.X));
    
                        DeleteConfirmPopup.IsOpen = true;
                        DeleteConfirmBtn.Visibility = Visibility.Visible;
                    }
    
                }
                catch (Exception)
                {
                    // 
                } 
            }
    
    
    
    private void OnBugHelpButtonClicked(object sender, RoutedEventArgs e)
            {
                if (bottomAppbar_test.IsOpen)
                {
                    bottomAppbar_test.IsOpen = false;
    
                }
    
                if (DeleteConfirmPopup.IsOpen)
                {
                    
                    DeleteConfirmPopup.IsOpen = false;
                }
                DeleteConfirmBtn.Visibility = Visibility.Collapsed;
            }

    by doing this way the problem is solved,

    but there can be better solution for this. Please check this with your requirement and then implement.

    Thanks.

    Please remember to mark the replies as answers it will help others too.

    • Proposed as answer by RishiRajIT Monday, May 6, 2013 12:43 PM
    • Marked as answer by strongpan Tuesday, May 7, 2013 1:34 AM
    Monday, May 6, 2013 12:20 PM

All replies

  • Hello programmer

    In your sample code I have added just two lines(Bold Lines) as follow,

    private void OnAppBarShowPopupClicked(object sender, RoutedEventArgs e)
            {
                try
                {
    
                    if (!DeleteConfirmPopup.IsOpen)
                    {
                        // 计算位置
                        Rect rect = GetElementRect((FrameworkElement)sender);
    
                        DeleteConfirmPopup.VerticalOffset = rect.Y - 150;
                        DeleteConfirmPopup.HorizontalOffset = (rect.X > (Window.Current.Bounds.Width / 2) ? (rect.X - 350) : (rect.X));
    
                        DeleteConfirmPopup.IsOpen = true;
                        DeleteConfirmBtn.Visibility = Visibility.Visible;
                    }
    
                }
                catch (Exception)
                {
                    // 
                } 
            }
    
    
    
    private void OnBugHelpButtonClicked(object sender, RoutedEventArgs e)
            {
                if (bottomAppbar_test.IsOpen)
                {
                    bottomAppbar_test.IsOpen = false;
    
                }
    
                if (DeleteConfirmPopup.IsOpen)
                {
                    
                    DeleteConfirmPopup.IsOpen = false;
                }
                DeleteConfirmBtn.Visibility = Visibility.Collapsed;
            }

    by doing this way the problem is solved,

    but there can be better solution for this. Please check this with your requirement and then implement.

    Thanks.

    Please remember to mark the replies as answers it will help others too.

    • Proposed as answer by RishiRajIT Monday, May 6, 2013 12:43 PM
    • Marked as answer by strongpan Tuesday, May 7, 2013 1:34 AM
    Monday, May 6, 2013 12:20 PM
  • Thanks so much.

    programmer

    Tuesday, May 7, 2013 1:34 AM