Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

[RESOLVED] Build toolbar buttons at runtime with tooltips

$
0
0
I was using the "commented" out code below to create BUTTONS on a TOOLBAR at runtime - worked nicely.

Code:

                //List<String> list = new List<string>();
                //list.Clear();
                //for (int i = 0; i < x.Suggestions2.Count; i++)
                //{
                //    list.Add(x.Suggestions2[i]);
                //}
                //ToolList.ItemsSource = list;

So I am now trying to build these buttons with tooltips as well - but when I run the code below it shows no buttons at all.

Code:

               
                ToolBar tb = new ToolBar();
                tb.Items.Clear();
                for (int i = 0; i < x.Suggestions2.Count; i++)
                {
                    Button ib = new Button();
                    ib.Content = x.Suggestions2[i];
                    ib.ToolTip = "tool tip " + x.Suggestions2[i];
                    tb.Items.Add(ib);
                }
                ToolList.ItemsSource = tb.ItemsSource;
                //ToolList = tb;  <------- I tried this first - it also did not work


Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>