Ejemplo n.º 1
0
        public static void ShowTeachingTip(this Window app, FrameworkElement target, string text, Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode placement = Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode.TopRight)
        {
            ShowTeachingTip(app, target, new FormattedText(text, new TextEntity[0]), placement);
            return;

            var tip = new Microsoft.UI.Xaml.Controls.TeachingTip
            {
                Target                = target,
                PreferredPlacement    = placement,
                IsLightDismissEnabled = true,
                Subtitle              = text
            };

            if (app.Content is FrameworkElement element)
            {
                element.Resources["TeachingTip"] = tip;
            }
            else
            {
                target.Resources["TeachingTip"] = tip;
            }
            tip.IsOpen = true;
        }
Ejemplo n.º 2
0
        public static void ShowTeachingTip(this Window app, FrameworkElement target, FormattedText text, Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode placement = Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode.TopRight)
        {
            var label = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap
            };
            var tip = new Microsoft.UI.Xaml.Controls.TeachingTip
            {
                Target                     = target,
                PreferredPlacement         = placement,
                IsLightDismissEnabled      = true,
                Content                    = label,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch
            };

            TextBlockHelper.SetFormattedText(label, text);

            if (app.Content is FrameworkElement element)
            {
                element.Resources["TeachingTip"] = tip;
            }
            else
            {
                target.Resources["TeachingTip"] = tip;
            }
            tip.IsOpen = true;
        }
Ejemplo n.º 3
0
 public static void ShowTeachingTip(this Window app, FrameworkElement target, string text, Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode placement = Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode.TopRight)
 {
     ShowTeachingTip(app, target, new FormattedText(text, new TextEntity[0]), placement);
 }