【问题标题】:who to bind listviewcolumn header into a column cell in WPF谁将listviewcolumn标题绑定到WPF中的列单元格中
【发布时间】:2013-08-21 22:46:02
【问题描述】:

我有以下问题。我想设置一个与 path=columnHeader 绑定的触发器

 <DataTrigger Binding="{DynamicResource ResourceKey=ActualColumnHeader}" Value="1"/>

(我真的不知道怎么称呼这个......)

我的代码是这样的:

<ListView Name="LV_Reporte" >
        <ListView.View>
            <GridView x:Name="GV_Reporte">
                <GridViewColumn Header="Order1">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock>
                                <TextBlock.Style>
                                    <Style>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{DynamicResource ResourceKey=ActualColumnHeader}" Value="1">

                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
            </GridView>
        </ListView.View>
    </ListView>

但问题是我真的不知道列的标题,它们是动态创建的,这就是为什么我想在不知道的情况下获取标题。

我希望有人可以帮助我。 谢谢。

【问题讨论】:

    标签: wpf listview binding


    【解决方案1】:

    您也许可以使用StringFormat 标记

      <GridViewColumn Header="Order1" DisplayMemberBinding="{Binding Property1, StringFormat=Order1 {0}}"/>
    

    【讨论】:

    • 但问题是我真的不知道列标题,因为我要让他们动态添加,我想使用列名在数据模板中设置
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-13
    • 1970-01-01
    • 2011-06-27
    • 2013-12-27
    • 1970-01-01
    • 2015-07-31
    • 1970-01-01
    相关资源
    最近更新 更多