是否可以在组合框上绑定多个项目的"列标题"?例如,显示人名的组合框.组合框将显示John Doe.但我想显示列标题:
First Last
John Doe
Jane Doe
Jimmy Doe
Run Code Online (Sandbox Code Playgroud)
如果不使用数据网格,这可能吗?那么一个简单的解决方案包括使用数据网格呢?我找到了一种将数据网格嵌入到组合框中的解决方案,但它看起来很困难,需要MS Blend.
如果我能把一些标题作为下拉列表的第一行,我会很高兴.
G
这是我的xaml代码与HB的尝试产生编译错误,如评论中所述.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Run Code Online (Sandbox Code Playgroud)
<ComboBox Name="cboPlaceNames" Grid.IsSharedSizeScope="True" ItemsSource="{DynamicResource items}" Height="22" Width="285" Margin="0,6,165,0" SelectedIndex="0" HorizontalAlignment="Right" VerticalAlignment="Top" SelectionChanged="cboPlaceNames_SelectionChanged">
<ComboBox.Resources>
<CompositeCollection x:Key="items">
<ComboBoxItem IsEnabled="False">
<Grid TextElement.FontWeight="Bold">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="C"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<TextBlock Grid.Column="0" Text="Name"/>
<TextBlock Grid.Column="2" Text="CLLI"/>
<TextBlock Grid.Column="4" Text="Street"/>
</Grid.Children>
</Grid>
</ComboBoxItem>
<Separator/>
<CollectionContainer Collection="{Binding Source={x:Reference cboPlaceNames}, Path=DataContext.Data}"/>
</CompositeCollection>
<DataTemplate DataType="x:Type obj:PlaceName">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/> …Run Code Online (Sandbox Code Playgroud) 我有一个带有UIElement网格的WPF用户控件,里面有几个文本框和组合框.我有一个Button(btnApply),当表单加载完成后,其IsEnabled状态应为false.但是,TextChanged事件在填充网格时被触发,并将IsEnabled更改为true.我添加了一个布尔方法,在用户控件完成加载后确实保持btnApply.IsEnabled = false.但是,我无法分辨用户控件何时完全加载以改变我的方法的布尔状态以允许更改btnApply.IsEnabled.我已经在User Control上尝试了Loaded事件并尝试检查IsLoaded事件,并且在用户控件上的所有元素加载完毕之前它们都被触发.
编辑:用户控件的UIElement网格通过ItemsSource = List填充.通过TextChanged和SelectionChanged事件捕获文本框和组合框更改.
是否可以在摘要注释中使用ac#definition?而不是对象列表
/// <summary>
/// Gets a List of Objects given a Table ID
/// </summary>
/// <param name="p_Table">The Table name to search for</param>
/// <param name="p_Id">The ID field within the p_Table to search for</param>
/// <param name="ObjectList">A List of Objects as an out parameter</param>
/// <returns>A List of Objects</returns>
Run Code Online (Sandbox Code Playgroud)
我想List<Object>在摘要中专门使用
/// <summary>
/// Gets a List<Objects> given a Table ID
/// </summary>
/// <param name="p_Table">The Table name to search for</param>
/// <param name="p_Id">The ID field within the …Run Code Online (Sandbox Code Playgroud)