Beispiel #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_list             = (ListBox)GetTemplateChild("SettingsMenuItemList");
            m_menutItemHandler = new ControlClickHandler(OnSelectionChanged, m_list);

            m_menuIcon = (Button)GetTemplateChild("SettingsMenuIconButton");

            m_menuIcon.Click += OnIconClick;

            m_mainContainer = (Grid)GetTemplateChild("SettingsMenuMainContainer");

            var itemShutterOpenStoryboard  = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard  = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            m_menuViewContainer   = (Grid)GetTemplateChild("SettingsMenuViewContainer");
            m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect");

            m_menuIconGrid = (Grid)GetTemplateChild("SettingsIconGrid");

            string settingsAnimString = "SettingsAnim";

            string openMenuViewIconString = "OpenMenuViewIcon";

            m_openMenuIconAnim = ((Storyboard)Template.Resources[openMenuViewIconString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuIconAnim, settingsAnimString + openMenuViewIconString);
            string closeMenuViewIconString = "CloseMenuViewIcon";

            m_closeMenuIconAnim = ((Storyboard)Template.Resources[closeMenuViewIconString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuIconAnim, settingsAnimString + closeMenuViewIconString);

            string openMenuContainerString = "OpenMenuContainer";

            m_openMenuContainerAnim = ((Storyboard)Template.Resources[openMenuContainerString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuContainerAnim, settingsAnimString + openMenuContainerString);
            string closeMenuContainerString = "CloseMenuContainer";

            m_closeMenuContainerAnim = ((Storyboard)Template.Resources[closeMenuContainerString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuContainerAnim, settingsAnimString + closeMenuContainerString);

            string openBackgroundRectString = "OpenBackgroundRect";

            m_openBackgroundRect = ((Storyboard)Template.Resources[openBackgroundRectString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openBackgroundRect, settingsAnimString + openBackgroundRectString);
            string closeBackgroundRectString = "CloseBackgroundRect";

            m_closeBackgroundRect = ((Storyboard)Template.Resources[closeBackgroundRectString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeBackgroundRect, settingsAnimString + closeBackgroundRectString);

            m_adapter = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SettingsMenuItemPanel", m_isInKioskMode);

            PerformLayout(null, null);
        }
Beispiel #2
0
 public MenuDelayedSourceUpdateAnimatorListener(
     List <string> groups,
     List <bool> groupsExpandable,
     Dictionary <string, List <string> > groupToChildren,
     MenuListAdapter adapter)
 {
     m_groups           = groups;
     m_groupsExpandable = groupsExpandable;
     m_groupToChildren  = groupToChildren;
     m_adapter          = adapter;
 }
 public MenuDelayedSourceUpdateAnimatorListener(
     List <string> groups,
     List <bool> groupsExpandable,
     Dictionary <string, List <string> > groupToChildren,
     MenuListAdapter adapter,
     int groupIndex = -1,
     int itemCount  = 0)
 {
     m_groups           = groups;
     m_groupsExpandable = groupsExpandable;
     m_groupToChildren  = groupToChildren;
     m_adapter          = adapter;
     m_groupIndex       = groupIndex;
     m_itemCount        = itemCount;
 }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_list             = (ListBox)GetTemplateChild("SettingsMenuItemList");
            m_menutItemHandler = new ControlClickHandler(OnSelectionChanged, m_list);

            m_menuIcon = (Button)GetTemplateChild("SettingsMenuIconButton");

            m_menuIcon.Click += OnIconClick;

            m_mainContainer = (Grid)GetTemplateChild("SettingsMenuMainContainer");

            var itemShutterOpenStoryboard  = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard  = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            m_menuViewContainer   = (Grid)GetTemplateChild("SettingsMenuViewContainer");
            m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect");

            m_menuIconGrid = (Grid)GetTemplateChild("SettingsIconGrid");

            m_openSearchIconAnim = ((Storyboard)Template.Resources["OpenSearchViewIcon"]).Clone();
            m_closeMenuIconAnim  = ((Storyboard)Template.Resources["CloseSearchViewIcon"]).Clone();

            m_openSearchContainerAnim = ((Storyboard)Template.Resources["OpenSearchContainer"]).Clone();
            m_closeMenuContainerAnim  = ((Storyboard)Template.Resources["CloseSearchContainer"]).Clone();

            m_openBackgroundRect  = ((Storyboard)Template.Resources["OpenBackgroundRect"]).Clone();
            m_closeBackgroundRect = ((Storyboard)Template.Resources["CloseBackgroundRect"]).Clone();

            m_adapter = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SettingsMenuItemPanel");

            PerformLayout(null, null);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_dragInteractionDirectionArrow = (Image)GetTemplateChild("SecondaryMenuDragInteractionArrow");
            m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList");
            m_list.SelectionChanged += SelectionChanged;

            m_dragTabView = (Image)GetTemplateChild("SecondaryMenuDragTabView");

            m_dragTabClickHandler = new ControlClickHandler(m_dragTabView, OnDragTabMouseClick);

            m_dragTabView.MouseLeftButtonDown += OnDragTabMouseLeftButtonDown;
            m_dragTabView.MouseLeftButtonUp += OnDragTabMouseLeftButtonUp;

            m_editText = (TextBox)GetTemplateChild("SecondaryMenuViewSearchEditTextView");
            m_editText = (TextBox)GetTemplateChild("SecondaryMenuViewSearchEditTextView");
            m_editText.KeyDown += OnKeyDown;

            var fadeInItemStoryboard = ((Storyboard)Template.Resources["FadeInNewItems"]).Clone();
            var fadeOutItemStoryboard = ((Storyboard)Template.Resources["FadeOutOldItems"]).Clone();

            m_adapter = new MenuListAdapter(false, m_list, fadeInItemStoryboard, fadeOutItemStoryboard);
        }
Beispiel #6
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_menuOptionsView = (ScrollViewer)GetTemplateChild("MenuOptionsView");

            m_resultsOptionsView            = (ScrollViewer)GetTemplateChild("ResultsMenuOptionsView");
            m_resultsOptionsView.TouchDown += OnResultsListTouchDown;
            m_resultsOptionsView.TouchUp   += OnResultsListTouchUp;
            m_resultsOptionsView.ManipulationBoundaryFeedback += OnResultsListBoundaryFeedback;
            m_resultsOptionsView.ScrollChanged += OnSearchResultsScrolled;

            m_resultsSpinner        = (Grid)GetTemplateChild("SearchResultsSpinner");
            m_resultsCount          = (TextBlock)GetTemplateChild("SearchResultCount");
            m_resultsCountContainer = (Grid)GetTemplateChild("SearchResultCountContainer");
            m_menuViewContainer     = (Grid)GetTemplateChild("SearchMenuViewContainer");
            m_backgroundRectangle   = (Rectangle)GetTemplateChild("BackgroundRect");
            m_searchBox             = (Grid)GetTemplateChild("SearchBox");
            m_searchArrow           = (FrameworkElement)GetTemplateChild("SearchArrow");
            m_resultsSeparator      = (FrameworkElement)GetTemplateChild("ResultsListSeparator");
            m_searchResultsFade     = (Image)GetTemplateChild("SearchResultsFade");
            m_searchResultsButtonAndFadeContainer = (Grid)GetTemplateChild("SearchResultsButtonAndFadeContainer");

            m_searchResultsScrollButton                    = (RepeatButton)GetTemplateChild("SearchResultsScrollButton");
            m_searchResultsScrollButton.Click             += OnResultsScrollButtonMouseDown;
            m_searchResultsScrollButton.PreviewMouseWheel += OnResultsMenuScrollWheel;

            m_resultsClearButton        = (Button)GetTemplateChild("SearchClear");
            m_resultsClearButton.Click += OnResultsClear;

            m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList");
            m_menuListClickHandler    = new ControlClickHandler(OnMenuListItemSelected, m_list);
            m_list.PreviewMouseWheel += OnMenuScrollWheel;

            m_resultsList                    = (ListBox)GetTemplateChild("SearchResultsList");
            m_resultsListClickHandler        = new ControlClickHandler(OnResultsListItemsSelected, m_resultsList);
            m_resultsList.PreviewMouseWheel += OnResultsMenuScrollWheel;

            m_menuIcon     = (Button)GetTemplateChild("SecondaryMenuDragTabView");
            m_menuIconGrid = (Grid)GetTemplateChild("SearchIconGrid");

            m_menuIcon.Click += OnIconClick;

            m_editText              = (TextBox)GetTemplateChild("SearchInputBox");
            m_editText.KeyDown     += OnKeyDown;
            m_editText.GotFocus    += OnSearchBoxSelected;
            m_editText.LostFocus   += OnSearchBoxUnSelected;
            m_editText.TextChanged += OnSearchBoxTextChanged;


            m_mainContainer = (Grid)GetTemplateChild("SerchMenuMainContainer");

            var itemShutterOpenStoryboard  = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard  = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            m_openSearchIconAnim = ((Storyboard)Template.Resources["OpenSearchViewIcon"]).Clone();
            m_closeMenuIconAnim  = ((Storyboard)Template.Resources["CloseSearchViewIcon"]).Clone();

            m_openSearchContainerAnim = ((Storyboard)Template.Resources["OpenSearchContainer"]).Clone();
            m_closeMenuContainerAnim  = ((Storyboard)Template.Resources["CloseSearchContainer"]).Clone();

            m_openBackgroundRect  = ((Storyboard)Template.Resources["OpenBackgroundRect"]).Clone();
            m_closeBackgroundRect = ((Storyboard)Template.Resources["CloseBackgroundRect"]).Clone();

            m_searchInputOpen  = ((Storyboard)Template.Resources["OpenSearchInputBox"]).Clone();
            m_searchInputClose = ((Storyboard)Template.Resources["CloseSearchInputBox"]).Clone();

            m_searchInputTextOpen  = ((Storyboard)Template.Resources["OpenSearchInputBoxText"]).Clone();
            m_searchInputTextClose = ((Storyboard)Template.Resources["CloseSearchInputBoxText"]).Clone();

            m_searchArrowOpen   = ((Storyboard)Template.Resources["OpenSearchArrow"]).Clone();
            m_searchArrowClosed = ((Storyboard)Template.Resources["CloseSearchArrow"]).Clone();

            m_adapter           = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SubMenuItemPanel");
            m_resultListAdapter = new MenuListAdapter(false, m_resultsList, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SearchResultPanel");
        }
Beispiel #7
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_menuOptionsView = (ScrollViewer)GetTemplateChild("MenuOptionsView");

            m_resultsSpinner        = (Grid)GetTemplateChild("SearchResultsSpinner");
            m_resultsCount          = (TextBlock)GetTemplateChild("SearchResultCount");
            m_resultsCountContainer = (Grid)GetTemplateChild("SearchResultCountContainer");
            m_menuViewContainer     = (Grid)GetTemplateChild("SearchMenuViewContainer");
            m_backgroundRectangle   = (Rectangle)GetTemplateChild("BackgroundRect");
            m_searchBox             = (Grid)GetTemplateChild("SearchBox");
            m_searchArrow           = (FrameworkElement)GetTemplateChild("SearchArrow");
            m_resultsSeparator      = (FrameworkElement)GetTemplateChild("ResultsListSeparator");
            m_searchResultsFade     = (Image)GetTemplateChild("SearchResultsFade");
            m_searchResultsButtonAndFadeContainer = (Grid)GetTemplateChild("SearchResultsButtonAndFadeContainer");

            m_searchResultsScrollButton                    = (RepeatButton)GetTemplateChild("SearchResultsScrollButton");
            m_searchResultsScrollButton.Click             += OnResultsScrollButtonMouseDown;
            m_searchResultsScrollButton.PreviewMouseWheel += OnResultsMenuScrollWheel;
            m_searchResultsScrollButton.MouseUp           += OnResultsScrollButtonMouseUp;
            m_searchResultsScrollButton.MouseLeave        += OnResultsScrollButtonMouseLeave;

            m_resultsClearButton        = (Button)GetTemplateChild("SearchClear");
            m_resultsClearButton.Click += OnResultsClear;

            m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList");
            m_menuListClickHandler    = new ControlClickHandler(OnMenuListItemSelected, m_list);
            m_list.PreviewMouseWheel += OnMenuScrollWheel;

            m_resultsList                    = (ListBox)GetTemplateChild("SearchResultsList");
            m_resultsList.TouchDown         += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchDown);
            m_resultsList.TouchUp           += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchUp);
            m_resultsList.TouchLeave        += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchLeave);
            m_resultsList.LostTouchCapture  += new EventHandler <TouchEventArgs>(OnSearchResultsListLostTouchCapture);
            m_resultsListClickHandler        = new ControlClickHandler(OnResultsListItemsSelected, m_resultsList);
            m_resultsList.PreviewMouseWheel += OnResultsMenuScrollWheel;

            m_menuIcon     = (Button)GetTemplateChild("SecondaryMenuDragTabView");
            m_menuIconGrid = (Grid)GetTemplateChild("SearchIconGrid");

            m_menuIcon.Click += OnIconClick;

            m_editText              = (TextBox)GetTemplateChild("SearchInputBox");
            m_editText.KeyDown     += OnKeyDown;
            m_editText.GotFocus    += OnSearchBoxSelected;
            m_editText.LostFocus   += OnSearchBoxUnSelected;
            m_editText.TextChanged += OnSearchBoxTextChanged;


            m_mainContainer = (Grid)GetTemplateChild("SerchMenuMainContainer");

            var itemShutterOpenStoryboard  = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard  = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            string searchAnimString = "SearchAnim";

            string openMenuViewIconString = "OpenSearchViewIcon";

            m_openMenuIconAnim = ((Storyboard)Template.Resources[openMenuViewIconString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuIconAnim, searchAnimString + openMenuViewIconString);
            string closeMenuViewIconString = "CloseSearchViewIcon";

            m_closeMenuIconAnim = ((Storyboard)Template.Resources[closeMenuViewIconString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuIconAnim, searchAnimString + closeMenuViewIconString);

            string openMenuContainerString = "OpenSearchContainer";

            m_openMenuContainerAnim = ((Storyboard)Template.Resources[openMenuContainerString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuContainerAnim, searchAnimString + openMenuContainerString);
            string closeMenuContainerString = "CloseSearchContainer";

            m_closeMenuContainerAnim = ((Storyboard)Template.Resources[closeMenuContainerString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuContainerAnim, searchAnimString + closeMenuContainerString);

            string openBackgroundRectString = "OpenBackgroundRect";

            m_openBackgroundRect = ((Storyboard)Template.Resources[openBackgroundRectString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_openBackgroundRect, searchAnimString + openBackgroundRectString);
            string closeBackgroundRectString = "CloseBackgroundRect";

            m_closeBackgroundRect = ((Storyboard)Template.Resources[closeBackgroundRectString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeBackgroundRect, searchAnimString + closeBackgroundRectString);

            string openSearchInputBoxString = "OpenSearchInputBox";

            m_searchInputOpen = ((Storyboard)Template.Resources[openSearchInputBoxString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchInputOpen, searchAnimString + openSearchInputBoxString);
            m_searchInputClose = ((Storyboard)Template.Resources["CloseSearchInputBox"]).Clone();

            m_searchInputTextOpen  = ((Storyboard)Template.Resources["OpenSearchInputBoxText"]).Clone();
            m_searchInputTextClose = ((Storyboard)Template.Resources["CloseSearchInputBoxText"]).Clone();

            string openSearchArrowString = "OpenSearchArrow";

            m_searchArrowOpen = ((Storyboard)Template.Resources[openSearchArrowString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchArrowOpen, searchAnimString + openSearchArrowString);
            string closeSearchArrowString = "CloseSearchArrow";

            m_searchArrowClosed = ((Storyboard)Template.Resources[closeSearchArrowString]).Clone();
            XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchArrowClosed, searchAnimString + closeSearchArrowString);

            m_adapter           = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SubMenuItemPanel", m_isInKioskMode);
            m_resultListAdapter = new MenuListAdapter(false, m_resultsList, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SearchResultPanel", m_isInKioskMode);

            m_scrollSpeed = (double)Application.Current.Resources["ScrollViewButtonScrollSpeed"];

            m_searchIconOffImageSource   = (ImageSource)Application.Current.Resources["ButtonSearchOffImage"];
            m_searchIconOnImageSource    = (ImageSource)Application.Current.Resources["ButtonSearchOnImage"];
            m_closeIconOffImageSource    = (ImageSource)Application.Current.Resources["ButtonSearchCloseOffImage"];
            m_closeIconOnImageSource     = (ImageSource)Application.Current.Resources["ButtonSearchCloseOnImage"];
            SearchMenuIconOffImageSource = m_searchIconOffImageSource;
            SearchMenuIconOnImageSource  = m_searchIconOnImageSource;
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_menuOptionsView = (ScrollViewer)GetTemplateChild("MenuOptionsView");
            m_resultsOptionsView = (ScrollViewer)GetTemplateChild("ResultsMenuOptionsView");
            m_resultsSpinner = (Grid)GetTemplateChild("SearchResultsSpinner");
            m_resultsCount = (TextBlock)GetTemplateChild("SearchResultCount");
            m_resultsCountContainer = (Grid)GetTemplateChild("SearchResultCountContainer");
            m_menuViewContainer = (Grid)GetTemplateChild("SearchMenuViewContainer");
            m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect");
            m_searchBox = (Grid)GetTemplateChild("SearchBox");
            m_searchArrow = (FrameworkElement)GetTemplateChild("SearchArrow");
            m_resultsSeparator = (FrameworkElement)GetTemplateChild("ResultsListSeparator");

            m_resultsClearButton = (Button)GetTemplateChild("SearchClear");
            m_resultsClearButton.Click += OnResultsClear;

            m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList");
            m_menuListClickHandler = new ControlClickHandler(OnMenuListItemSelected, m_list);
            m_list.PreviewMouseWheel += OnMenuScrollWheel;

            m_resultsList = (ListBox)GetTemplateChild("SearchResultsList");
            m_resultsListClickHandler = new ControlClickHandler(OnResultsListItemsSelected, m_resultsList);
            m_resultsList.PreviewMouseWheel += OnResultsMenuScrollWheel;

            m_menuIcon = (Button)GetTemplateChild("SecondaryMenuDragTabView");
            m_menuIconGrid = (Grid)GetTemplateChild("SearchIconGrid");

            m_menuIcon.Click += OnIconClick;

            m_editText = (TextBox)GetTemplateChild("SearchInputBox");
            m_editText.KeyDown += OnKeyDown;
            m_editText.GotFocus += OnSearchBoxSelected;
            m_editText.LostFocus += OnSearchBoxUnSelected;
            m_editText.TextChanged += OnSearchBoxTextChanged;
            m_defaultEditText = m_editText.Text;

            m_mainContainer = (Grid)GetTemplateChild("SerchMenuMainContainer");

            var itemShutterOpenStoryboard = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            m_openSearchIconAnim = ((Storyboard)Template.Resources["OpenSearchViewIcon"]).Clone();
            m_closeMenuIconAnim = ((Storyboard)Template.Resources["CloseSearchViewIcon"]).Clone();

            m_openSearchContainerAnim = ((Storyboard)Template.Resources["OpenSearchContainer"]).Clone();
            m_closeMenuContainerAnim = ((Storyboard)Template.Resources["CloseSearchContainer"]).Clone();

            m_openBackgroundRect = ((Storyboard)Template.Resources["OpenBackgroundRect"]).Clone();
            m_closeBackgroundRect = ((Storyboard)Template.Resources["CloseBackgroundRect"]).Clone();

            m_searchInputOpen = ((Storyboard)Template.Resources["OpenSearchInputBox"]).Clone();
            m_searchInputClose = ((Storyboard)Template.Resources["CloseSearchInputBox"]).Clone();

            m_searchInputTextOpen = ((Storyboard)Template.Resources["OpenSearchInputBoxText"]).Clone();
            m_searchInputTextClose = ((Storyboard)Template.Resources["CloseSearchInputBoxText"]).Clone();

            m_searchArrowOpen = ((Storyboard)Template.Resources["OpenSearchArrow"]).Clone();
            m_searchArrowClosed  = ((Storyboard)Template.Resources["CloseSearchArrow"]).Clone();

            m_adapter = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SubMenuItemPanel");
            m_resultListAdapter = new MenuListAdapter(false, m_resultsList, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SearchResultPanel");
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_list = (ListBox)GetTemplateChild("SettingsMenuItemList");
            m_menutItemHandler = new ControlClickHandler(OnSelectionChanged, m_list);

            m_menuIcon = (Button)GetTemplateChild("SettingsMenuIconButton");

            m_menuIcon.Click += OnIconClick;

            m_mainContainer = (Grid)GetTemplateChild("SettingsMenuMainContainer");

            var itemShutterOpenStoryboard = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone();
            var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone();

            var slideInItemStoryboard = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone();
            var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone();

            m_menuViewContainer = (Grid)GetTemplateChild("SettingsMenuViewContainer");
            m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect");

            m_menuIconGrid = (Grid)GetTemplateChild("SettingsIconGrid");

            m_openSearchIconAnim = ((Storyboard)Template.Resources["OpenSearchViewIcon"]).Clone();
            m_closeMenuIconAnim = ((Storyboard)Template.Resources["CloseSearchViewIcon"]).Clone();

            m_openSearchContainerAnim = ((Storyboard)Template.Resources["OpenSearchContainer"]).Clone();
            m_closeMenuContainerAnim = ((Storyboard)Template.Resources["CloseSearchContainer"]).Clone();

            m_openBackgroundRect = ((Storyboard)Template.Resources["OpenBackgroundRect"]).Clone();
            m_closeBackgroundRect = ((Storyboard)Template.Resources["CloseBackgroundRect"]).Clone();

            m_adapter = new MenuListAdapter(false, m_list,slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SettingsMenuItemPanel");

            PerformLayout(null, null);
        }