2013-11-04 3 views
0

여러 유형의 열이있는 gridcontrol을 만들었습니다. 원하는 특정 셀 (내 listboxedit 열에서 만든)을 클릭하면 표시 할 목록 상자가 필요합니다. 어떻게해야합니까? 나는 목록 상자를 셀 안에 넣고 싶지 않다.목록 상자 열 wpf 만드는 방법

+1

GridControl의 레벨에서 Click 이벤트를 포착하고 ListBox를 표시합니다. –

답변

1
<DataGridTemplateColumn Header="Header"> 
     <DataGridTemplateColumn.CellTemplate> 
       <DataTemplate> 
       <Grid> 
        <TextBlock Content="{Binding Title}"/> 
        <Popup IsOpen="{Binding RelativeSource={RelativeSource AncestorType=DataGridCell}, Path=IsSelected}"> 
          <ListBox> 
           <ListBoxItem>Item 1</ListBoxItem> 
           <ListBoxItem>Item 2</ListBoxItem> 
           <ListBoxItem>Item 3</ListBoxItem> 
           <ListBoxItem>Item 4</ListBoxItem> 
           <ListBoxItem>Item 5</ListBoxItem> 
          </ListBox> 
         </Popup> 
        </Grid> 
      </DataTemplate> 
     </DataGridTemplateColumn.CellTemplate> 
    </DataGridTemplateColumn>