0
有沒有辦法修改UIElement的內容?如何修改UIElement的內容?
我有這樣的事情:
System.IO.FileStream rdr = System.IO.File.OpenRead(xamlFilePath);
System.Windows.UIElement uie = (System.Windows.UIElement)System.Windows.Markup.XamlReader.Load(rdr);
當我運行調試,並添加UIE到「觀察」窗口,它給了我下面的:
[-]uie
[-]System.Windows.Controls.Textbox {System.Windows.Controls.Textbox:Title}
<some stuff...>
Text "Title"
現在我需要能夠做兩件事:(1)閱讀文本框中的文本,(2)隨時修改它。
I was hoping for something in the lines of:
{
Textbox tb = (Textbox)uie.GetChild();
tb.Text = "New Title"
uie.SetChild(tb);
}
,但它不起作用。如果任何人都可以將我指向執行此功能的方法,我會非常感激。
請提供您的XAML文件的內容。 – Athari 2010-10-25 20:34:06