Exemple #1
0
        /// <summary>
        /// Called when the ContextMenu is opened.
        /// </summary>
        /// <param name="sender">Event source.</param>
        /// <param name="e">Event arguments.</param>
        private void ContextMenu_Opened(object sender, RoutedEventArgs e)
        {
            // Offset the ContextMenu correctly
#if SILVERLIGHT
            _contextMenuInitialOffset = _contextMenu.TransformToVisual(null).Transform(new Point());
#else
            _contextMenuInitialOffset = TranslatePoint(new Point(0, ActualHeight), _contextMenu);
#endif
            UpdateContextMenuOffsets();

            // Hook LayoutUpdated to handle application resize and zoom changes
            LayoutUpdated += new EventHandler(SplitButton_LayoutUpdated);
        }