Binding column width like this
<ListView ...>
<ListView.View>
<GridView>
<GridViewColumn Width="{Binding Width, Mode=TwoWay}" ... />
... more columns
</GridView>
</ListView.View>
</ListView>
The problem: when double clicking column header line (to autosize column) no Width setter is triggered, which means binding source is not updated after such column width changing. Normal column resizing works without problems.
Suggestions?
I don't want to prevent double-click autosizing, only to fix an issue.
Looking at the double click handler source code, it looks like the
Widthproperty should be updated. Perhaps something is going wrong in the binding? You might want to make your binding verbose and see what prints in the output window.That issue aside, you may not get the behavior you desire by binding to the
Widthproperty. As you can tell from the double click handler, it gets set toNaNto make the column automatically resize. This means that even if your property setter gets called, it is going to getNaNpassed to it. You could bind toActualWidthusing aOneWayToSourcebinding mode, unless you actually need the binding to beTwoWayfor other reasons.