question

65010773 avatar image
0 Votes"
65010773 asked 65010773 answered

How to set maxdowndropitems of a combobox uwp

Hi

In windows form application combobox has maxdowndropitems propertie but not in uwp so how i can limit the drop items ?


Thanks

windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

65010773 avatar image
0 Votes"
65010773 answered
        Dim cbitem As ComboBoxItem
    
 Comboyears.MaxDropDownHeight = 344
      For i = 1900 to 2020 
                 cbitem = New ComboBoxItem
                 With cbitem
                     .Background = brushseg
                     .FontFamily = New FontFamily("calibri")
                     .FontWeight = Windows.UI.Text.FontWeights.Bold
                     .FontSize = "21"
                     .Height = "36"
                     ..Content = "years & " " & i
                       
                 End With
                 Comboyears.Items.Add(cbitem)
        
             Next






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

65010773 avatar image
0 Votes"
65010773 answered RichardZhang-MSFT commented

Ok
I found that is better to popup the combobox using comboboxitem and i also can play with the backcolor and using the MaxDropDownHeight

Comboyears.MaxDropDownHeight = 344
Dim cbitem As ComboBoxItem
For i = 1900 to 2020
cbitem = New ComboBoxItem
With cbitem
.Background = brushseg
.FontFamily = New FontFamily("calibri")
.FontWeight = Windows.UI.Text.FontWeights.Bold
.FontSize = "21"
.Height = "36"
.Content = "years & " " & i

         End With
         Comboyears.Items.Add(cbitem)

     Next
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, I‘m glad that you have found a solution. You can accept your own answer, which will help more people.

However, there are some problems with the code display in your answer, please try to use the code tool in the editor toolbar to insert the code, so as to have a better display effect.

0 Votes 0 ·