日期:2014-05-17 浏览次数:21420 次
DockPanel myDockPanel = new DockPanel(); //定义停靠容器控件
Rectangle rect1 = new Rectangle(); //定义一个矩形
DockPanel.SetDock(rect1, Dock.Top); //设置矩形的停靠位置是置顶
myDockPanel.Children.Add(rect1); //容器控件里添加这个矩形
TextBlock t = new TextBlock();
Button b=new Button();
TextBlock c=new TextBlock();
c.Text="button";
b.Content=c;
t.Inlines.Add(b);
this.Container.Children.Add(t);
namespace System.Windows.Controls
{
[Localizability(LocalizationCategory.Text), ContentProperty("Inlines")]
public class TextBlock : FrameworkElement, IContentHost, IAddChildInternal, IAddChild, IServiceProvider
{
......................
namespace System.Windows.Controls
{
[DefaultEvent("OnItemsChanged"), DefaultProperty("Items"), Localizability(LocalizationCategory.None, Readability = Readability.Unreadable), ContentProperty("Items"), StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(FrameworkElement))]