It seems that WPF has no ready-made components. You can write
Using system; <br/> using system. collections. generic; <br/> using system. LINQ; <br/> using system. text; <br/> using system. windows; <br/> using system. windows. controls; <br/> using system. windows. data; <br/> using system. windows. documents; <br/> using system. windows. input; <br/> using system. windows. media; <br/> using system. windows. media. imaging; <br/> using system. windows. navigation; <br/> using system. windows. shapes; <br/> namespace downbox2 <br/> {<br/> // <summary> <br/> // interaction logic of usercontrol1.xaml <br/> // </Summary> <br/> Public partial class downbox: border <br/> {<br/> private int I = 0; <br/> private double H = 20, W = 120; <br/> private lineargradientbrush LGB; <br/> private fontfamily dbfont; <br/> private int dbfontsize = 15; <br/> private list <string> itemcontent; <br/> Public downbox () <br/>{< br/> initializecomponent (); <br/> Object Ob = findresource ("S1"); <br/> LGB = (lineargradientbrush) ob; <br/> itemcontent = new list <string> (); <br/>}< br/> Public void setwandh (double H, double W) <br/>{< br/> This. H = H; <br/> This. W = W; <br/>}< br/> Public void setdbfontsize (INT dbfontsize) <br/>{< br/> This. dbfontsize = dbfontsize; <br/>}< br/> Public void setdbfont (fontfamily dbfont) <br/>{< br/> This. dbfont = dbfont; <br/>}< br/> Public void addrow (string s) <br/>{< br/> G. rowdefinitions. add (New rowdefinition (); <br/> textblock TB = new textblock (); <br/> TB. height = H; <br/> TB. width = W; <br/> TB. TEXT = s; <br/> TB. fontfamily = dbfont; <br/> TB. fontsize = dbfontsize; <br/> TB. mouseenter + = new mouseeventhandler (tb_mouseenter); <br/> TB. mouseleave + = new mouseeventhandler (tb_mouseleave); <br/> G. children. add (TB); <br/> TB. setvalue (grid. rowproperty, I); <br/> I ++; <br/> itemcontent. add (s); <br/>}< br/> Public String getitemcontent (int I) // obtain the text of the specified drop-down box <br/>{< br/> return itemcontent [I]; <br/>}< br/> Public Boolean removeitemcontent (int I) <br/>{< br/> if (I <itemcontent. count) <br/> {<br/> G. children. removeat (I); <br/> itemcontent. removeat (I); <br/> return true; <br/>}< br/> return false; <br/>}< br/> Public void tb_mouseleave (Object sender, mouseeventargs e) <br/>{< br/> textblock TB = (textblock) sender; <br/> TB. background = brushes. white; <br/>}< br/> Public void tb_mouseenter (Object sender, mouseeventargs e) <br/>{< br/> textblock TB = (textblock) sender; <br/> TB. background = LGB; <br/>}< br/> Public void setvi () <br/>{< br/> This. opacity = 1; <br/>}< br/> Public void sethide () <br/>{< br/> This. opacity = 0; <br/>}< br/> private void border_lostfocus (Object sender, routedeventargs e) <br/>{< br/> This. opacity = 0; <br/>}< br/>}
Below is the code in XAML
<Border X: class = "downbox2.downbox" <br/> xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" <br/> xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" <br/> xmlns: MC = "http://schemas.openxmlformats.org/markup-compatibility/2006" <br/> xmlns: D = "http://schemas.microsoft.com/expression/blend/2008" <br/> MC: ignorable = "D" <br/> Height = "Auto" borderthickness = "1" borderbrush = "black" lostfocus = "border_lostfocus"> <br/> <grid name = "G "> </P> <p> </GRID> <br/> </Border> <br/>
Below is a piece: