Is it possible to let the drop down content open with bottom right aligned placement? Currently, when setting the drop down placement to "Bottom", it opens left aligned relative to the the split button.
Please see attachment for how it should look
1 Answer, 1 is accepted
1
Accepted
Stenly
Telerik team
answered on 05 May 2022, 08:03 AM
Hello Claus,
To achieve the desired result, you could subscribe to the DropDownOpened event of the RadSplitButton control. In it, retrieve the Popup element via the ChildrenOfType extension method. After that, modify its HorizontalOffset property, by calculating the ActualWidth property of both the RadSplitButton instance and that of its child element's ActualWidth.
The following code snippet shows this approach's implementation:
privatevoidRadSplitButton_DropDownOpened(object sender, RoutedEventArgs e)
{
var splitButton = ((RadSplitButton)sender);
var popup = splitButton.ChildrenOfType<Popup>().FirstOrDefault();
if (popup != null)
{
var popupChild = popup.Child as Grid;
popup.HorizontalOffset = this.button.ActualWidth - popupChild.ActualWidth;
}
}
The produced result is as follows:
In conclusion, could you give this approach a try?
in the last line. Other than that it works, thanks!
Stenly
Telerik team
commented on 09 May 2022, 07:57 AM
I am happy to hear that the proposed approach is a suitable solution to this matter.
Regarding the shared line of code, indeed, in the last line of the if conditional check, the proposed code snippet should be used instead. With this in mind, I have modified the code snippet to include this suggestion:
privatevoidRadSplitButton_DropDownOpened(object sender, RoutedEventArgs e)
{
var splitButton = ((RadSplitButton)sender);
var popup = splitButton.ChildrenOfType<Popup>().FirstOrDefault();
if (popup != null)
{
var popupChild = popup.Child as Grid;
popup.HorizontalOffset = splitButton.ActualWidth - popupChild.ActualWidth;
}
}