我正在尝试在XAML中的TextBox底部添加图形 [英] I am Trying to add a graphic to the bottom of a TextBox in XAML

查看:84
本文介绍了我正在尝试在XAML中的TextBox底部添加图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我尝试使用模板创建它。

问题是当文本框变为多行时图形没有重新定位它。



我想在很多地方重复使用它。



问题0:我是否需要添加依赖属性?



问题1:这应该是UserControl,资源还是模板?



谢谢。

解决方案

使用堆栈面板作为解决方法。

例如

 <   StackPanelOrientation   = 水平 >  
< < span class =code-leadattribute> Image Source = image.jpg 可见性 = 折叠 / >
< TextBlock 文字 = 文字 / >
< / StackPanel >


我发现了如何在SO上进行操作的想法。这是任何有兴趣的人的链接。 http: //stackoverflow.com/questions/337181/how-do-i-create-a-custom-wpf-control-like-a-cartoon-bubble-with-constant-corners [ ^ ]

As the title say's, I tried to create this using a template.
The problem is when the text box went multiline the graphic did not relocate with it.

I wish to reuse this in many places.

Question 0: Will i have to add a Dependency Property?

Question 1: Should this be a UserControl, a resource or a template?

Thank You.

解决方案

Use a stack panel as a workaround.
E.g.

<StackPanelOrientation="Horizontal">
 <Image Source="image.jpg" Visibility="Collapsed"/>
 <TextBlock Text="Text"/>
</StackPanel>


I found a idea on how to do it on SO. Here is the link for anyone interested. http://stackoverflow.com/questions/337181/how-do-i-create-a-custom-wpf-control-like-a-cartoon-bubble-with-constant-corners[^]


这篇关于我正在尝试在XAML中的TextBox底部添加图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆