New to Telerik UI for WPFStart a free 30-day trial

How to set the Command property of the button part

Updated on Sep 15, 2025

Environment

Product Version2019.2.618
ProductRadButtons for WPF

Description

How to bind the Command property of the RadButton element(the left part) inside the RadSplitButton.

Solution

Handle the Loaded event of the RadSplitButton, use the ChildrenOfType extension method in order to locate its RadButton child and set its Command property.

Example 1: Setting the Command of the RadButton inside the RadSplitButton

C#
	
    private void RadSplitButton_Loaded(object sender, RoutedEventArgs e)
    {
        var splitButton = (RadSplitButton)sender;
        var buttonPart = splitButton.ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "ButtonPart");
        if (buttonPart != null)
        {
            buttonPart.Command = new DelegateCommand(OnExecute, OnCanExecute);
        }
    }

    private bool OnCanExecute(object obj)
    {
        // If this method returns false, only the button part of the RadSplitButton will be disabled
        return true;
    }

    private void OnExecute(object obj)
    {
        MessageBox.Show("Button clicked!");
    }

See Also