我可以在 Silverlight 4 中将按钮放入 RichTextBox 中吗?

发布于 2024-10-08 16:11:43 字数 100 浏览 0 评论 0原文

我想允许用户将 System.Windows.Controls.Button 放入 System.Windows.Controls.RichTextBox 中。该按钮将执行预定义的操作。

I would like to allow users to put a System.Windows.Controls.Button in the System.Windows.Controls.RichTextBox. The button would do a pre-defined thing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别再吹冷风 2024-10-15 16:11:43

我想出了如何做到这一点。它称为 InlineUIContainer,您可以执行类似的操作来使其正常工作。虽然它没有将其保存到 Xaml 中

var p = new Paragraph();
var inlineUIContainer = new InlineUIContainer() { Child = new Button() { Content = "This is a Button!" } };
p.Inlines.Add(inlineUIContainer);
_richTextBox.Blocks.Add(p);

I figured out how to do this. It's called an InlineUIContainer you can do something like this to get it working. Although it doesn't save it into the Xaml

var p = new Paragraph();
var inlineUIContainer = new InlineUIContainer() { Child = new Button() { Content = "This is a Button!" } };
p.Inlines.Add(inlineUIContainer);
_richTextBox.Blocks.Add(p);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文