2016-08-11 3 views
1

나는 그것의 itemssource를 'Employee 's'의리스트에 묶는 rad 격자보기를 가지고있다. 'Employee'엔터티에 'Roles'속성 목록이 있습니다. 다음과 같이이 '역할'을 ListView에 바인딩하려면 어떻게합니까?격자 셀 템플릿의 RadRibbonDropDownButton 안에 ListView를 바인딩하는 방법은 무엇입니까?

예 : 두 번째 열에서 RadComboBox이 제대로 바인딩됩니다. 마지막 열에서 RadRibbonDropDownButton은 제대로 바인딩되지 않습니다. RolesList를 ListViewRadRibbonDropDownButton 안에 바인딩하려면 어떻게해야합니까?

도와주세요.

class Employee 
{ 
    public string Name {get; set;} 
    public List<Role> RolesList {get; set;} 
} 
class Role 
{ 
    public int RoleId {get; set;} 
    public string RoleName {get; set;} 
    public string RoleCategory {get; set;} 
} 
<tk:RadGridView ItemsSource="{Binding Path=EmployeeList,Mode=TwoWay}" AutoGenerateColumns="False"> 
    <tk:RadGridView.Columns> 
     <tk:GridViewDataColumn Header="Employee Name" DataMemberBinding="{Binding Name}" IsReadOnly="True"/> 
     <tk:GridViewDataColumn Header="Roles" Width="410"> 
      <tk:GridViewDataColumn.CellTemplate> 
       <DataTemplate> 
        <!--this binds properly--> 
        <tk:RadComboBox ItemsSource="{Binding RolesList}" DisplayMemberPath="RoleName" SelectedValuePath="RoleId" /> 
       </DataTemplate> 
      </tk:GridViewDataColumn.CellTemplate> 
     </tk:GridViewDataColumn> 
     <tk:GridViewDataColumn Header="Roles" Width="410"> 
      <tk:GridViewDataColumn.CellTemplate> 
       <DataTemplate> 
        <tk:RadRibbonDropDownButton> 
         <tk:RadRibbonDropDownButton.DropDownContent> 
          <ListView ItemsSource="{Binding RolesList}"> 
           <ListView.View> 
            <GridView AllowsColumnReorder="False"> 
             <GridViewColumn DisplayMemberBinding="{Binding RoleName}" Header="Role Name" Width="75" ></GridViewColumn> 
             <GridViewColumn DisplayMemberBinding="{Binding RoleCategory}" Header="Role Category" Width="175" ></GridViewColumn> 
            </GridView> 
           </ListView.View> 
          </ListView> 
         </tk:RadRibbonDropDownButton.DropDownContent> 
        </tk:RadRibbonDropDownButton> 
       </DataTemplate> 
      </tk:GridViewDataColumn.CellTemplate> 
     </tk:GridViewDataColumn> 
    </tk:RadGridView.Columns> 
</tk:RadGridView> 
+0

음, 왜 Gridview에서 Ribbon-Element를 사용하고 있습니까? – lokusking

+0

드롭 다운을 그리드로 지정합니다. – Jeevan

답변

0

DataContext를 추가하면 {바인딩}이 바인딩 문제를 해결했습니다.

관련 문제