CM and non MVVM third party controls

Topics: UI Architecture
Oct 29, 2011 at 3:35 PM
Edited Oct 29, 2011 at 6:20 PM

I am sorry if this has been asked before.


I have been tasked with converting a windows forms system to WPF.  Many of the screen use the devexpress pivot grid which is populated like this:


private void FillGrid_Click(object sender, RoutedEventArgs e)
IEnumerable<GridRow> NewData;

PivotGrid1.ReloadData(); // this function has to be called to refresh the ui grid

I would like to convert this to:


 <dxpg:PivotGridControl HorizontalAlignment="Left" Margin="24,20,0,0" x:Name="pivotGridControl1" VerticalAlignment="Top" />



IEnumerable<GridRow> NewData;

Void GetNewData()
//populate NewData
//reload data
 This has two problems. First, I am not sure how to bind to the data source but that can be over come with a general wpf binding:
 <dxg:GridControl ItemsSource="{Binding Source}" x:Name="grid" 
                         ColumnsSource="{Binding Columns}". . . .
        public IList<Employee> Source { get; private set; } 
      public ObservableCollection<Column> Columns { get; private set; }

The bigger problem is how do I can call ReloadData from my ViewModel.

I could set up my viewmodel to be intialize with my view but I don't like my view being that accessible to viewmodel. 
(fear of descending back into a mix of view and model)
I could use the codebehind to call the viewmodel then call Reload Data:
private void FillGrid_Click(object sender, RoutedEventArgs e)

This is not pretty but does not allow the view info to pollute view model.
I could set up an event to tell the view to update itself. 

Has anybody come across this problem.