我是新來的WPF,並試圖找出所有這些數據綁定的東西。當我做我的代碼之後,當我運行我的應用我的組合框填充:WPF新手 - 在XAML中設置ItemsSource似乎不起作用
public NewForm()
{
InitializeComponent();
Product.ItemsSource = Products;
}
public List<string> Products
{
get { return _productsComponents.Keys.ToList(); }
}
然而,在我的XAML時,我有以下的中,ComboBox中沒有任何內容,當我跑我的應用程序:
<ComboBox Height="23" HorizontalAlignment="Left" Margin="138,116,0,0"
Name="Product" VerticalAlignment="Top" Width="120"
ItemsSource="{Binding Path=Products}"/>
我是否引用了一些不正確的東西? This tutorial很有幫助,但他從來沒有在XAML中設置ItemsSource,始終在C#中。
)<= ComboBox Height =「23」HorizontalAlignment =「Left」Margin =「138,116,0,0」Name =「Product」VerticalAlignment =「Top」Width =「120」ItemsSource =「{Binding Path = Products,當我運行應用程序時,仍然給我一個空的組合框:( – 2010-07-30 14:31:07
)當我剛纔有''謝謝! –
2010-07-30 14:32:24
@Sarah In第一種情況是,您是否在Window元素中指定了名稱「thisWindow」?'x:Name =「thisWindow」' – Jay 2010-07-30 14:36:14