【发布时间】:2015-02-14 01:14:33
【问题描述】:
我正在尝试将数据绑定到组合框。数据是来自数据库表的名称。从数据库中获取数据工作正常,因为我试图将其绑定到列表视图并且显示正常。我的问题是将它绑定到一个组合框,它没有显示任何内容。
谁能看到我哪里出错了?
我的代码如下...
public string FullName
{
get
{
return String.Format("{0} {1}", _customer.ContactFirstName, _customer.ContactLastName);
}
}
XAML 是
<ComboBox x:Name="comboBox" Grid.Row="1" Grid.ColumnSpan="2" Height="20" ItemsSource="{Binding Path=FullName}" >
使用列表视图的 XAML 如下..
<ListView
AlternationCount="2"
DataContext="{StaticResource WorkorderGroups}"
ItemContainerStyle="{StaticResource WorkorderItemStyle}"
ItemsSource="{Binding}"
Grid.Row="2" Grid.ColumnSpan="3" Margin="1,0,-1,0>
<ListView.GroupStyle>
<StaticResourceExtension ResourceKey="WorkorderGroupStyle/>
</ListView.GroupStyle>
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=FullName}" />
</GridView>
</ListView.View>
</ListView>
【问题讨论】:
-
请发布更多代码...
标签: c# wpf xaml data-binding combobox