Beispiel #1
0
        /// <summary>
        /// Builds the popup.
        /// </summary>
        private void BuildPopup()
        {
            // initialize the pop up
            listPopup.PopupAnimation     = PopupAnimation.Fade;
            listPopup.Placement          = PlacementMode.Relative;
            listPopup.PlacementTarget    = this;
            listPopup.PlacementRectangle = new Rect(0, this.ActualHeight, 30, 30);
            listPopup.Width = this.ActualWidth;
            // initialize the sections' list
            if (ShowSectionButton)
            {
                listSection = new ListBoxEx((int)m_itemStyle + ListBoxEx.ItemStyles.NormalStyle);

                listSection.Items.Clear();
                if (SectionsList != null)
                {
                    foreach (string item in SectionsList)
                    {
                        listSection.Items.Add(item);
                    }
                }

                listSection.Width       = this.Width;
                listSection.MouseLeave += new MouseEventHandler(ListSection_MouseLeave);
            }

            // initialize the previous items' list
            listPreviousItem                   = new ListBoxEx();
            listPreviousItem.MouseLeave       += new MouseEventHandler(ListPreviousItem_MouseLeave);
            listPreviousItem.SelectionChanged += new SelectionChangedEventHandler(ListPreviousItem_SelectionChanged);
            listPreviousItem.Width             = this.Width;
        }
Beispiel #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// @fn private void BuildPopup()
        ///
        /// @brief  Builds the pop up and related items
        ///
        /// @author Le Duc Anh
        /// @date   8/14/2010
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private void BuildPopup()
        {
            // initialize the pop up
            m_listPopup.PopupAnimation     = PopupAnimation.Fade;
            m_listPopup.Placement          = PlacementMode.Relative;
            m_listPopup.PlacementTarget    = this;
            m_listPopup.PlacementRectangle = new Rect(0, this.ActualHeight, 30, 30);
            m_listPopup.Width = this.ActualWidth;

            //限制popup的最大高度
            m_listPopup.MaxHeight = 120;

            //添加 设置popup的初始高度

            if (this.ActualHeight > 10)
            {
                m_listPopup.MinHeight = this.ActualHeight;
            }
            else
            {
                m_listPopup.MinHeight = 90;
            }

            // initialize the sections' list
            if (ShowSectionButton)
            {
                m_listSection = new ListBoxEx((int)m_itemStyle + ListBoxEx.ItemStyles.NormalStyle);

                //////////////////////////////////////////////////////////////////////////
                m_listSection.Items.Clear();
                // add items into the list
                // is there any smarter way?
                if (SectionsList != null)
                {
                    foreach (string item in SectionsList)
                    {
                        m_listSection.Items.Add(item);
                    }
                }
                //////////////////////////////////////////////////////////////////////////

                m_listSection.Width       = this.Width;
                m_listSection.MouseLeave += new MouseEventHandler(ListSection_MouseLeave);
            }

            // initialize the previous items' list
            m_listPreviousItem                   = new ListBoxEx();
            m_listPreviousItem.MouseLeave       += new MouseEventHandler(ListPreviousItem_MouseLeave);
            m_listPreviousItem.SelectionChanged += new SelectionChangedEventHandler(ListPreviousItem_SelectionChanged);
            m_listPreviousItem.Width             = this.Width;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// @fn private void BuildPopup()
        ///
        /// @brief  Builds the pop up and related items
        ///
        /// @author Le Duc Anh
        /// @date   8/14/2010
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private void BuildPopup()
        {
            // initialize the pop up
            m_listPopup.PopupAnimation     = PopupAnimation.Fade;
            m_listPopup.Placement          = PlacementMode.Relative;
            m_listPopup.PlacementTarget    = this;
            m_listPopup.PlacementRectangle = new Rect(0, this.ActualHeight, 30, 30);
            m_listPopup.Width = this.ActualWidth;
            // initialize the sections' list
            if (ShowSectionButton)
            {
                m_listSection = new ListBoxEx((int)m_itemStyle + ListBoxEx.ItemStyles.NormalStyle);

                //////////////////////////////////////////////////////////////////////////
                m_listSection.Items.Clear();
                // add items into the list
                // is there any smarter way?
                if (SectionsList != null)
                {
                    foreach (NonUnique item in SectionsList)
                    {
                        // Image a = new Image().Source = item.Key;
                        StackPanel sp = new StackPanel()
                        {
                            Orientation = Orientation.Horizontal
                        };
                        Image myImage3 = new Image();


                        BitmapImage bi3 = new BitmapImage();
                        bi3.BeginInit();
                        bi3.UriSource = new Uri(item.KEY, UriKind.RelativeOrAbsolute);
                        bi3.EndInit();
                        myImage3.Stretch = Stretch.None;
                        myImage3.Source  = bi3;

                        //sp.Children.Add(myImage3);


                        Label value = new Label();
                        value.Content = item.VALUE;

                        if (m_listSection.ExtendedStyle != ListBoxEx.ItemStyles.NormalStyle)
                        {
                            sp.Children.Add(myImage3);
                        }

                        sp.Children.Add(value);


                        m_listSection.Items.Add(sp);
                    }
                }
                //////////////////////////////////////////////////////////////////////////

                m_listSection.Width       = this.Width;
                m_listSection.MouseLeave += new MouseEventHandler(ListSection_MouseLeave);
            }

            // initialize the previous items' list
            m_listPreviousItem                   = new ListBoxEx();
            m_listPreviousItem.MouseLeave       += new MouseEventHandler(ListPreviousItem_MouseLeave);
            m_listPreviousItem.SelectionChanged += new SelectionChangedEventHandler(ListPreviousItem_SelectionChanged);
            m_listPreviousItem.Width             = this.Width;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// @fn private void BuildPopup()
        ///
        /// @brief  Builds the pop up and related items
        ///
        /// @author Le Duc Anh
        /// @date   8/14/2010
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private void BuildPopup()
        {
            // initialize the pop up
            m_listPopup.PopupAnimation = PopupAnimation.Fade;
            m_listPopup.Placement = PlacementMode.Relative;
            m_listPopup.PlacementTarget = this;
            m_listPopup.PlacementRectangle = new Rect(0, this.ActualHeight, 30, 30);
            m_listPopup.Width = this.ActualWidth;
            // initialize the sections' list
            if (ShowSectionButton)
            {
                m_listSection = new ListBoxEx((int)m_itemStyle + ListBoxEx.ItemStyles.NormalStyle);

                //////////////////////////////////////////////////////////////////////////
                m_listSection.Items.Clear();
                // add items into the list
                // is there any smarter way?
                if (SectionsList != null)
                    foreach (string item in SectionsList)
                        m_listSection.Items.Add(item);
                //////////////////////////////////////////////////////////////////////////

                m_listSection.Width = this.Width;
                m_listSection.MouseLeave += new MouseEventHandler(ListSection_MouseLeave);

            }

            // initialize the previous items' list
            m_listPreviousItem = new ListBoxEx();
            m_listPreviousItem.MouseLeave += new MouseEventHandler(ListPreviousItem_MouseLeave);
            m_listPreviousItem.SelectionChanged += new SelectionChangedEventHandler(ListPreviousItem_SelectionChanged);
            m_listPreviousItem.Width = this.Width;
        }