wpf autocompletebox default dropdown area is too small -
wpf autocompletebox default dropdown area is too small -
i set autocompletebox this:
<stackpanel orientation="horizontal"> <stackpanel width="120"> <label content="address"/> <controls:autocompletebox x:name="addressbox" maxdropdownheight="300" populating="address_populating"/> </stackpanel> <stackpanel width="120" margin="40, 0, 0, 0"> <label content="port"/> <textbox x:name="portbox" /> </stackpanel> <button x:name="connectbutton" content="connect" margin="40, 0, 0, 0" verticalalignment="bottom" width="80" height="35" click="connectbutton_clicked"/> </stackpanel> but max number of items displayed in dropdown window 3. sure candidate number larger 3. want increment number of items displayed in dropdown window.
for example, want show 15 candidateaddress's items. , dropdown window displayed , 3 items showed firstly. hope can show 5 items firstly, means display area should expanded.
the logical code of command is:
private void address_populating(object sender, populatingeventargs e) { string dirfile = "../../config/address.config"; if (file.exists(dirfile)) { var candidateaddress = new list<string>(); string input = null; using (streamreader sr = file.opentext(dirfile)) { while ((input = sr.readline()) != null) { candidateaddress.add(input); } } addressbox.itemssource = candidateaddress; addressbox.populatecomplete(); } else { system.windows.messagebox.show("address.config not exist"); } }
i can't add together pic comment. add together here.
top pic : maxdropdownheight=50
bottom: maxdropdownheight=300
you mean this?
you can creat new project:
<grid> <control:autocompletebox x:name="addressbox" fontsize="30" maxdropdownheight="300" populating="address_populating" margin="0,0,0,287.283" /> </grid> background code:
private void address_populating(object sender, populatingeventargs e) { list<int> lst = new list<int>(); (int = 10; < 25; i++) { lst.add(i); } addressbox.itemssource = lst; addressbox.populatecomplete(); } the reason found kylejan: found reason. display area influenced former window. example, window set command on opend main window. autocomplete box influenced size of main window
wpf autocompletebox
Comments
Post a Comment