0
我正在編程構建一個XAML塊,並希望爲TextElement對象(此例中爲下劃線)提供名稱x:Name
,但即使名稱prop也提供了setter,但它不能按照此MSDN文章設置:XAML:如何設置TextElement.Name屬性
獲取或設置對象的唯一標識。名稱只能從初始解析XAML中設置。
這裏是我的代碼:
public void AddLink(string token, string text, string uri)
{
var elem = new Underline();
elem.Name.Name = token; // <-- I would expect this would work...
elem.Inlines.Add();
if (Container == null)
Container = new Paragraph();
Container.Inlines.Add(elem);
}
我喜歡它。這個標籤爲'[XAML]',但我在這裏沒有看到XAML。 –
@HighCore哈!正在等待... –