I have a WPF application with an XAML Window containing a few Buttons and a DataGrid. When buttons are pressed, some logic is performed in the background which builds a list of some type and finally assigns the list to a (MVVM) model property "DataSource" to which an ItemsSource of the DataGrid is bound to like:
<DataGrid x:Name="DataGrid" Grid.Row ="10" ...
ItemsSource="{Binding Path=DataSource, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}">
When the content of DataSource is changed, DataGrid is aware of that and shows the new data. So far all good, application works as intended and with no problems. I can copy the bin output of build and sucessfully run it just about everywhere.
Then comes ClickOnce publish. If published so that it installs from, and is installed from an Unc network share, e.g. \SomeServer\SomePath\InstallFromDir\, everything still works fine.
But if published so that it installs from, and is installed from an online url, e.g. http://companydomain.com/InstallFromDir/, DataGrid simply does not update.
Nothing else is changed but the method of app and updates availability from unc to web.
What I gathered from debugging trace points still applies. The list in the background is built anew. It is assigned to the DataSource property (if I verify the contained data, it does contain the new data). But if I access the DataGrids ItemsSource it still contains the OLD, initial data.
I have tried re-assigning the DataSource to ItemsSource -- doesn't help. I have tried re-binding the data when it changes programatically, as in:
var sourceBinding = new System.Windows.Data.Binding
{
Path = new PropertyPath("DataSource"),
Mode = BindingMode.TwoWay,
NotifyOnSourceUpdated = true,
NotifyOnTargetUpdated = true
};
BindingOperations.SetBinding(((MainWindow)_window).DataGrid,
System.Windows.Controls.DataGrid.ItemsSourceProperty, sourceBinding);
and even changing the xaml so that it is ONLY bound in code:
<DataGrid x:Name="DataGrid" Grid.Row ="10" ... >
and it still works the same as described above: works as direct copy or unc install, but doesn't work as web install.
I am totally lost as to either finding the cause or finding the workarounds. Anyone encountered this before? Any ideas? Many thanks!
Update: I have initially thought this was a DataGrid issue, but I have since also tried replacing DataGrid with ListView, and it doesn't work either.