Live Chat Icon For mobile
Live Chat Icon

How do I embed a Button into a TextBox?

Platform: WPF| Category: TextBlock

This is very easy to do in XAML, as follows:

[XAML]
        <TextBlock x:Name='myTextBlock' Width='100' Height='40'>
            <Button>Test</Button>
        </TextBlock>

And you can do something similar in C# as follows:

[C#]
            Button btn = new Button();
            btn.Content = 'Test';
            this.myTextBlock.Inlines.Add(btn);

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.