XAML:
<DataGrid.Columns>
<DataGridTextColumn x:Name="colDisplayName" Width="Auto" IsReadOnly="True" Header="Name" Binding="{Binding ssn.SSN_DISPLAY_NAME}"></DataGridTextColumn>
<DataGridTextColumn x:Name="colValue" Width="Auto" Header="Value" Binding="{Binding ssv.SSV_VALUE}" CellStyle="{StaticResource SingleClickEditing}"></DataGridTextColumn>
<DataGridTextColumn x:Name="colDescription" Width="Auto" IsReadOnly="True" Header="Description" Binding="{Binding ssn.SSN_DESCRIPTION}"></DataGridTextColumn>
<DataGridTextColumn x:Name="colUnit" Width="Auto" IsReadOnly="True" Header="Unit Abbreviation" Binding="{Binding ssn.UNIT_TYPE.UNIT_NAME.UN_ABBREVIATION}"></DataGridTextColumn>
</DataGrid.Columns>
Run Code Online (Sandbox Code Playgroud)
CS:
private void tvSystemConfiguration_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
dgSystemSettings.ItemsSource =
((tvSystemConfiguration.SelectedItem as SYSTEM_SETTINGS_GROUP).SYSTEM_SETTINGS_NAMEs.Join
(ssdc.SYSTEM_SETTINGS_VALUEs, x => x.SSN_ID, y => y.SSV_SSN_ID, (x, y) => new DataGridItem{ ssn = x, ssv = y })).ToList();
}
Run Code Online (Sandbox Code Playgroud)
当列大小增加时,列宽会缩小以正确拟合,但在列大小减小时,列宽不会适当缩小以适应.在增加后,它不会减少ItemsSource更新上列的大小.希望有道理.任何帮助表示赞赏.谢谢.
我想知道是否有人举例说明如何设置/模板组合框只显示默认初始状态的按钮.有点像功能区栏的DropDownButton画廊.我希望用户能够单击按钮并列出组合框项目.选择后,它不会在文本字段中保存所选项目,因为没有文本字段只有一个按钮.谢谢 :)