How to use relative binding Mode=FindAncestor

后端 未结 1 1283
说谎
说谎 2021-01-24 18:26

I have a ListView control that has 3 columns: Name, Surname and address. I want all 3 columns to have the same width. The only way I came up with was to bind each column\'s widt

相关标签:
1条回答
  • 2021-01-24 18:55

    You are correct, GroupBox is not an ancestor - this is because the GridViewColumn is not added to the visual tree, so bindings that rely on visual tree navigation will not work. You could bind your columns to a static resource instead:

    To achieve what you are after will require quite a bit of custom code. See teh following MSDN forum thread:

    http://social.msdn.microsoft.com/forums/en-US/wpf/thread/83bd7ab9-3407-461f-a0bc-69e04870075c

    And the code here that gives much more options for specifying column sizes:

    http://www.codeproject.com/KB/grid/ListView_layout_manager.aspx

    0 讨论(0)
提交回复
热议问题