页面引用上下文
<Page x:Class="页面后台类名"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="335" d:DesignWidth="1105"
Title="标题名"
DataContext="{Binding 你VM的类名, Source={StaticResource Locator}}">
绑定方法
<DataGrid Margin="10"
AutoGenerateColumns="False"
DataContext="{Binding DataContent}"
ItemsSource="{Binding EmployeeEntity,Mode=TwoWay}"
SelectedItem="{Binding SelectedEmployee,Mode=TwoWay}" >
<DataGrid.Columns>
<DataGridTextColumn Header="姓名" Binding

本文介绍了如何在MVVM架构的WPF应用中,将DataGrid的某一列绑定到ComboBox,详细说明了使用DataGridTemplateColumn设置ComboBox绑定数据的步骤和注意事项。
最低0.47元/天 解锁文章
5454





