我正在开发一个地铁应用程序在那里,我想有一个自定义的条形幻灯片时,用户点击屏幕上的东西。
这就是我所说的:
 --------------
|          |   |
|          |   |  <----
|          |   |
 ---------------
main screen  side
              bar在这个侧边栏,我想有一些简单的控制,如图像和文本块等。
1)我该怎么做,如果有任何帮助,我将不胜感激
2)这并不违反metro原则,对吧?
发布于 2012-12-10 13:19:52
您可以尝试利用弹出按钮,如设置弹出按钮。你可能想看看Callisto。
否则,您可以包含一个Xaml元素,该元素位于所有其他元素之上,并在屏幕上切换其可见性和位置。如何定位取决于您使用的根元素。为了在画布中定位元素,将Canvas.Right="0"添加到子元素中。
发布于 2012-12-10 13:18:47
您可以使用PopUp。
看一下这个例子,
http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49
发布于 2012-12-10 13:23:38
你可以使用下面的helper
WinRT Flyout Helper
public class FlyoutHelper
{
    protected Popup m_Popup = new Popup();
    public Popup Show(Popup popup, FrameworkElement button, double offset = 35d)
    {
        if (popup == null)
            throw new Exception("Popup is not defined");
        m_Popup = popup;
        if (button == null)
            throw new Exception("Button is not defined");
        if (double.IsNaN(offset))
            throw new Exception("Offset is not defined");
        var _Child = popup.Child as FrameworkElement;
        if (_Child == null)
            throw new Exception("Popup.Child is not defined");
        if (double.IsNaN(_Child.Height))
            throw new Exception("Popup.Child.Height is not defined");
        if (double.IsNaN(_Child.Width))
            throw new Exception("Popup.Child.Width is not defined");
        // get position of the button
        var _Page = Window.Current.Content as Page;
        var _Visual = button.TransformToVisual(_Page);
        var _Point = _Visual.TransformPoint(new Point(0, 0));
        var _Button = new
        {
            Top = _Point.Y,
            Left = _Point.X,
            Width = button.ActualWidth,
            Height = button.ActualHeight,
        };
        // determine location
        var _TargetTop = (_Button.Top + (_Button.Height / 2)) - 
                         _Child.Height - offset;
        var _TargetLeft = (_Button.Left + (_Button.Width / 2)) - 
                          (_Child.Width / 2);
        if ((_TargetLeft + _Child.Width) > Window.Current.Bounds.Width)
            _TargetLeft = Window.Current.Bounds.Width - _Child.Width - offset;
        if (_TargetLeft < 0)
            _TargetLeft = offset;
        // setup popup
        popup.VerticalOffset = _TargetTop;
        popup.HorizontalOffset = _TargetLeft;
        // add pretty animation(s)
        popup.ChildTransitions = new TransitionCollection 
        { 
            new EntranceThemeTransition 
            { 
                FromHorizontalOffset = 0, 
                FromVerticalOffset = 20 
            }
        };
        // setup
        m_Popup.IsLightDismissEnabled = true;
        m_Popup.IsOpen = true;
        // handle when it closes
        m_Popup.Closed -= popup_Closed;
        m_Popup.Closed += popup_Closed;
        // handle making it close
        Window.Current.Activated -= Current_Activated;
        Window.Current.Activated += Current_Activated;
        // return
        return m_Popup;
    }
    protected void Current_Activated(object sender, WindowActivatedEventArgs e)
    {
        if (m_Popup == null)
            return;
        if (e.WindowActivationState == CoreWindowActivationState.Deactivated)
            m_Popup.IsOpen = false;
    }
    protected void popup_Closed(object sender, object e)
    {
        Window.Current.Activated -= Current_Activated;
        if (m_Popup == null)
            return;
        m_Popup.IsOpen = false;
    }
}https://stackoverflow.com/questions/13795260
复制相似问题