DataGrid에 DataGrid가 있고 DataGridTemplateColumn으로 하나의 열을 넣을 수있는 뷰가 있습니다. 하나의 콤보 상자를 DataGridTemplate 열에 넣었고 사용자의 combobox.Hence 내에 datatemplate을 정의했습니다. 콤보 상자에 텍스트를 입력 할 수 있습니다. 결과는 CustomeDatagrid로 필터링되고 사용자는 CustomeDatagrid에서 항목을 선택할 수 있습니다. 나는 그것을 acheive하려고 Wpf : 콤보 박스 내의 사용자 정의 Datagrid
:
여기 내 요구 사항입니다. 여기 내 XAML입니다 :
<DataGrid AutoGenerateColumns="False"
ItemsSource="{Binding OrderItems}"
AlternatingRowBackground="{DynamicResource InflowDataGridAlternateBackgroundBrush>
<DataGrid.Columns>
<DataGridTemplateColumn Width="200" Header="Item">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ProductName,Mode=OneWay}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox>
<ComboBox.ItemTemplate>
<DataTemplate>
<vw:CustomDatagrid />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
CustomDataGrid :
<UserControl x:Class="RH_Maize.View.CustomDatagrid"
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" Width="590" Height="251">
<Grid Background="{DynamicResource GridBackgroundBrush}">
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn MinWidth="150" Header="Category"/>
<DataGridTextColumn MinWidth="180" Header="Item"/>
<DataGridTextColumn MinWidth="130" Header="Rate"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
하지만이 DatagridTemplate 열을 클릭 할 때 난 단지 일반 콤보없는 정의에서 Datagrid를 얻을.
내 코드가 뭐니?
위의 (이미지) wpf에서 콤보 상자 내 CustomDatagrid를 달성하는 방법은 무엇입니까?
편집 : 콤보 상자의 텍스트가 결합을 통해 변경 될 때
가 어떻게 customDataGrid을 채우는?
하지만 어떻게 결합 및 콤보 상자의 텍스트 변경 – Angel
@Angel 당신은 당신의 질문에 바인딩에 대해 아무것도 언급하지 않은 경우 CustomDatagrid 채우기 않는다 . – Sajeetharan
내 질문을 편집하십시오 내 질문에 – Angel