AutoCompleteBox with Floating Label same as a RadWatermarkTextBox?

1 Answer 24 Views
AutoCompleteBox WatermarkTextBox
Evangelista
Top achievements
Rank 1
Evangelista asked on 27 Feb 2023, 02:04 PM

Hi,

Would it be possible to have an editable AutoCompleteBox TextBox Part to mimic the RadWatermarkTextBox with floating Label?

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 01 Mar 2023, 04:16 PM

Hello Evangelista,

To achieve this requirement, you could subscribe to the Loaded event of the RadAutoCompleteBox control and retrieve the RadWatermarkTextBox element using the ChildrenOfType extension method. On it, set the KeepLabelFloated property to True and the Label property to the desired value.

The following code snippet shows this suggestion's implementation:

private void radAutoCompleteBox_Loaded(object sender, RoutedEventArgs e)
{
    RadWatermarkTextBox radWatermarkTextBox = ((RadAutoCompleteBox)sender)
        .ChildrenOfType<RadWatermarkTextBox>()
        .FirstOrDefault(x => x.Name == "WatermarkTextBox");

    if (radWatermarkTextBox != null)
    {
        radWatermarkTextBox.KeepLabelFloated = true;
        radWatermarkTextBox.Label = "Floating Label";
    }
}

With this being said, could you give this suggestion a try and let me know how it goes?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Evangelista
Top achievements
Rank 1
commented on 06 Mar 2023, 12:37 PM

Good job, thank you.
Tags
AutoCompleteBox WatermarkTextBox
Asked by
Evangelista
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or