In an MVC WPF project I have a ListVIew that uses a GridView to display items. In order to save column widths I thought that I'd just bind each GridViewColumn's Width member to a property in the Model. This works in that the value in the property is being
asserted to the GridViewColumn but the reverse is not try. Manually resizing the column's width does not result in a publication of a change in the column's width to the Model.
Here's is a (simplified) example of the XAML code.
<ListView
DataContext="{Binding Source={StaticResource LogViewerWindowModel}}" >
<ListView.View>
<GridView>
<GridViewColumn
Width="{Binding LogCol1Width}"
/>
</GridView>
</ListView.View>
</ListView>
And there's nothing special about the Model properties. Standard sort of thing.
public double LogCol1Width
{
get { return _LogCol1Width; }
set
{
if (_LogCol1Width != value)
{
_LogCol1Width = value;
OnPropertyChanged( "LogCol1Width" );
}
}
}
private double _LogCol1Width = 160;
When the View first loads it requests the Property's value. However, no changes made by the user are broadcast to the property.
What am I doing wrong and how can I get the control to notify the Model when a column's width changes?
Richard Lewis Haggard