Custom Tooltip containing list of items in UWP

Ela 21 Reputation points
2021-12-06T21:38:25.09+00:00

Trying to add a tooltip with list of Items(string).How can I achieve it in UWP?
Thanks,
Ela

Developer technologies | Universal Windows Platform (UWP)
{count} votes

Answer accepted by question author
  1. Castorix31 91,416 Reputation points
    2021-12-06T22:28:18.827+00:00

    You can do something like this, with a Tooltip on button1 :

    string[] sColors = { "Red", "Green", "Blue" };  
    List<string> colorList = new List<string>(sColors);  
    ToolTip toolTip = new ToolTip();  
    foreach (string sColor in colorList)  
    {  
        toolTip.Content += (toolTip.Content==null)?sColor:Environment.NewLine + sColor;  
    }  
    toolTip.Foreground = new SolidColorBrush(Colors.Black);  
    toolTip.Background = new SolidColorBrush(Colors.LightYellow);  
    ToolTipService.SetToolTip(button1, toolTip);  
    

    155346-tooltip-list.gif

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.