wpf 如何绑定到列显示模板中的当前行数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18899407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 09:40:52  来源:igfitidea点击:

how to bind to current row data in a column display template

c#wpfdata-bindingdevexpress

提问by TrustyCoder

In the devexpress grid below how do I bind to the current row data in the column template and use a converter object.

在下面的 devexpress 网格中,我如何绑定到列模板中的当前行数据并使用转换器对象。

                        <dxg:GridColumn Header="Field1" FieldName="Field1">
                            <dxg:GridColumn.DisplayTemplate>
                                <ControlTemplate>
                    <!-- how do i bind to current row data-->
                                </ControlTemplate>
                            </dxg:GridColumn.DisplayTemplate>
                        </dxg:GridColumn>
                    </dxg:GridControl.Columns>
                </dxg:GridControl>

回答by TrustyCoder

<ControlTemplate>
<TextBlock Text="{Binding Path=RowData.Row.FieldName}">
</TextBlock>
</ControlTemplate>