找到你要的答案

Q:Filter/Group GridDataControl Column by Referenced Display Name

Q:滤波器/组的显示名称griddatacontrol列引用

I have a view model with a list of portfolios and a list of portfolio owners. Portfolios is a view model that references the owner by the field OwnerId.

I want to have the grid display the owner's name rather than the Id, so I set the column style to DropDownList, providing the details to set up the reference between the two lists.

<syncfusion:GridDataControl ItemsSource="{Binding Portfolios}"
                            AutoPopulateColumns="false"
                            ShowGroupDropArea="True"
                            >
    <syncfusion:GridDataControl.VisibleColumns>
        <syncfusion:GridDataVisibleColumn MappingName="OwnerId" HeaderText="Collector" AllowFilter="True" IsReadOnly="True">
            <syncfusion:GridDataVisibleColumn.ColumnStyle>
                <syncfusion:GridDataColumnStyle CellTypeEnum="DropDownList"  DisplayMember="OwnerName" ValueMember="OwnerId" ItemsSource="{StaticResource ownersSource}" />
            </syncfusion:GridDataVisibleColumn.ColumnStyle>
        </syncfusion:GridDataVisibleColumn>
    </syncfusion:GridDataControl.VisibleColumns>
</syncfusion:GridDataControl>

My issue is, both the automatic filter and group by header display the OwnerId rather than the OwnerName, ignoring the column style I set. How can I get those to display the OwnerName as well?

I have a view model with a list of portfolios and a list of portfolio owners. Portfolios is a view model that references the owner by the field OwnerId.

我想有网格显示主人的名字而不是ID,所以我列式下拉框,设置两个表之间的引用提供细节。

<syncfusion:GridDataControl ItemsSource="{Binding Portfolios}"
                            AutoPopulateColumns="false"
                            ShowGroupDropArea="True"
                            >
    <syncfusion:GridDataControl.VisibleColumns>
        <syncfusion:GridDataVisibleColumn MappingName="OwnerId" HeaderText="Collector" AllowFilter="True" IsReadOnly="True">
            <syncfusion:GridDataVisibleColumn.ColumnStyle>
                <syncfusion:GridDataColumnStyle CellTypeEnum="DropDownList"  DisplayMember="OwnerName" ValueMember="OwnerId" ItemsSource="{StaticResource ownersSource}" />
            </syncfusion:GridDataVisibleColumn.ColumnStyle>
        </syncfusion:GridDataVisibleColumn>
    </syncfusion:GridDataControl.VisibleColumns>
</syncfusion:GridDataControl>

我的问题是,无论是自动过滤和组标题显示ownerid而不是机主姓名,忽略我设置的栏目风格。我怎么能让那些显示机主姓名吗?

c#  wpf  syncfusion