开发者

How to customize WPF TreeView columns individually?

I have the Xaml code that show everything correctly but I want to make it so the first column's content is bold:

<c:TreeView Name="JobList" SelectedItemChanged="JobList_SelectedItemChanged">
    <c:TreeView.Columns>
        <GridViewColumn Header="Jobs" Width="350" DisplayMemberBinding="{Binding Name}"/>
        <GridViewColumn Header="Goal" Width="100" DisplayMemberBinding="{Binding Goal}"/>
        <GridViewC开发者_如何学JAVAolumn Header="Messages" Width="120" DisplayMemberBinding="{Binding MessageType}"/>
    </c:TreeView.Columns>
</c:TreeView>

Also can I also do this based on whether the item in the first column has sub treeview nodes or not?


I havent used the TreeListView, but usually you can put other UIElements in the header. Give this a try:

        <GridViewColumn Header="Jobs" Width="350" DisplayMemberBinding="{Binding Name}">
        <GridViewColumn.Header>
            <TextBlock FontWeight="Bold" Text="{Binding Goal}"></TextBlock>
        </GridViewColumn.Header>
    </GridViewColumn>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜