本文介绍了如何在wpf数据网格控件中包含列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 想要在datgrid点击单元格时在wpf datagrid控件中包含listbox,就像outlook calander一样。 我的Xaml代码 < DataGrid Name = Grid1高度= 550宽度= 850 AutoGenerateColumns = False CanUserResizeRows = False CanUserDeleteRows = False CanUserAddRows = False AreRowDetailsFrozen = False SelectionUnit = CellOrRowHeader SelectedCellsChanged = Grid1_SelectedCellsChanged CellEditEnding = Grid1_CellEditEnding LoadingRow = Grid1_LoadingRow SelectionMode = 扩展 > < DataGrid.RowHeaderTemplate> < DataTemplate> < StackPanel Orientation = 水平 VerticalAlignment = 中心 HorizontalAlignment = 中心 > < TextBlock Text = {Binding RelativeSource = {RelativeSource Mode = FindAncestor, AncestorType = {x:Type DataGridRow}}, Path = Item.Time} FontSize = 16 /> < TextBlock Text = 00 Foreground = #9493CF /> < / StackPanel > < / DataTemplate > < / DataGrid.RowHeaderTemplate > < DataGrid.Style> < Style TargetType = DataGrid > < Setter Property = AlternatingRowBackground值= LightYellow /> < / 风格 > < / DataGrid.Style > < DataGrid.Columns> < DataGridTextColumn Header = Sunday Binding = {Binding Sunday} /> < DataGridTextColumn Header = Monday Binding = {Binding Monday} /> < DataGridTextColumn Header = Tuesday Binding = {Binding Tuesday} /> < DataGridTextColumn Header = Wednesday Binding = {Binding Wednesday} /> < DataGridTextColumn Header = Thursday Binding = {Binding Thursday} /> < DataGridTextColumn Header = Friday Binding = {Binding Friday} /> < DataGridTextColumn Header = Saturday Binding = {Binding Saturday} /> < / DataGrid.Columns > < DataGrid.ContextMenu> < ContextMenu x:Name = LeftClickMenu > < MenuItem Header = 新约会请点击= MenuItem_Click /> < Separator /> < MenuItem Header = 退出 /> < / ContextMenu > < / DataGrid.ContextMenu > < / DataGrid > 解决方案 这篇关于如何在wpf数据网格控件中包含列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 20:56