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
Width
property 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
Width
property. As you can tell from the double click handler, it gets set toNaN
to make the column automatically resize. This means that even if your property setter gets called, it is going to getNaN
passed to it. You could bind toActualWidth
using aOneWayToSource
binding mode, unless you actually need the binding to beTwoWay
for other reasons.