Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将此方法添加到网格中并将其放置在网格中的单元格中。我猜我得到的错误是因为我无法转换: 关于如何解决这个问题private void BarCode()的任何想法?System.Windows.Controls.UIElementCollection
private void BarCode()
System.Windows.Controls.UIElementCollection
myGrid.Children.Add(BarCode());
你的BarCode()方法需要返回UIElement
BarCode()
UIElement
你可以这样写你的BarCode函数
BarCode
private UIElement BarCode() { Image myBarCode = new Image(); myBarCode.Source = new BitmapImage(new Uri("bitmap.png", UriKind.RelativeOrAbsolute)); return myBarCode; }