Tool Tip
hey, have listbox data added mysql database. how can make when user clicks on or hovers on listbox item small info box pops , shows listbox item content. code using data is:
connection.open(); mysqlcommand updatecommand = new mysqlcommand("select concat('(',accounts.name,')',' ',updates.posted_update) posted_update updates inner join accounts on updates.user_id = accounts.id order updates.update_id desc limit 0,25"); updatecommand.connection = connection; dataset updates = new dataset(); mysqldataadapter mysqladapter = new mysqldataadapter(updatecommand); mysqladapter.fill(updates, "updates"); listbox1.datasource = updates.tables["updates"]; listbox1.displaymember = "posted_update"; connection.close();
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.tooltip.aspx
the listboxitem part of frameworkelement heirarchy. result can set tool tip on each listbox item individually or binding faciltites can bind it. because set datasource shown above, need (in xaml) create binding items in listbox , bind tooltip path within datasource.
this link shows how specify item's datatemplate:
http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplate.aspx
this example carries 1 step farther , shows how set tool tip container of item (in case stackpanel)
http://stackoverflow.com/questions/655223/databinding-tooltip-in-listbox
jp
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment