How to create a DropdownButton Menu using Model binding.

1 Answer 38 Views
Buttons ContextMenu Menu
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
Psyduck asked on 11 Jun 2021, 08:37 AM | edited on 14 Jun 2021, 09:33 AM

Hello.

 

I want to make it similar to an image.

I made the design, but binding is the problem.
There is a model, there is a displayname, and there are values.

The dropdown shows the sub item name when selected, and the value uses the value when the button is selected later.

(I know listbox doesn't support this. So I try to use dropdown.)

A parent item may have a value and a child may not. This shouldn't be an option.

The IsSelected function does not exist.

 

How do I put the binding and do it?

<telerik:RadDropDownButton Content="{Binding }">
	<telerik:RadDropDownButton.DropDownContent>
		<telerik:RadContextMenu x:Name="ContextMenu" ItemsSource="{Binding }">
			<telerik:RadMenuItem Header="parent name binding 1">
				<telerik:RadMenuItem Header="child name binding 1.1"/>
				<telerik:RadMenuItem Header="child name binding 1.2"/>
				<telerik:RadMenuItem Header="child name binding 1.3"/>
			</telerik:RadMenuItem>
			<telerik:RadMenuItem Header="parent name binding 2">
				<telerik:RadMenuItem Header="child name binding 2.1"/>
				<telerik:RadMenuItem Header="child name binding 2.2"/>
			</telerik:RadMenuItem>
			<telerik:RadMenuItem Header="parent name binding 3">
				<telerik:RadMenuItem Header="child null"/>
			</telerik:RadMenuItem>
		</telerik:RadContextMenu>
	</telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>

 

Thanks.

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
answered on 28 Jun 2021, 05:32 AM

I couldn't solve this problem, so I looked for another solution.

I would use AutoCompleteBox or AutoSuggestBox.

Tags
Buttons ContextMenu Menu
Asked by
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
Answers by
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
Share this question
or