Viewing Simple lists

Feb 8, 2011 at 7:47 PM

Hi,

Is it possible to get the property editor to display all items in a list ? I ask because I want to be able to display (and possibly edit) a small list of points. Do I have to write some sort of converter to do this? I am fairly new to using wpf and some help would be welcome.

Thanks Alan

Coordinator
Feb 8, 2011 at 8:44 PM
Edited Feb 8, 2011 at 8:45 PM

hi Alan, see the DataGrid demo - create a DataTemplate and add a "TypeEditor", this should make it possible to edit a collection/list.

Feb 11, 2011 at 10:18 AM

Thanks objo,

As you suggested I added

 <DataTemplate x:Key="DatagridEditor">
     <DataGrid Name="PointDataGrid" ItemsSource="{Binding Value, Mode=TwoWay}" CellEditEnding="PointDataGrid_CellEditEnding" >
          <DataGrid.AutoGenerateColumns>false</DataGrid.AutoGenerateColumns>
          <DataGrid.CanUserAddRows>true</DataGrid.CanUserAddRows>
          <DataGrid.CanUserDeleteRows>true</DataGrid.CanUserDeleteRows>
          <DataGrid.Columns>
              <DataGridTextColumn Header="Profile" Binding="{Binding Path=X, Mode=TwoWay}"  />
              <DataGridTextColumn Header="Depth" Binding="{Binding Path=Y,Mode=TwoWay}" />
          </DataGrid.Columns>
      </DataGrid>
  </DataTemplate>

And this gives me a grid of point values. I can select each individual field and alter the value but the original point value is not changed.  I know this is nothing to do with the property editor I just wondered if you had any suggestions as to why the values were not being updated. My knowledge of wpf is still rudimentary. Is it because I am binding to a Point type and this is not supported for databinding?  The grid itself is bound to an ObservableCollection<Point>.

Alan

 

Feb 11, 2011 at 2:27 PM

Ok,

I found out what was wrong, I wasnt updating the ObservableCollection correctly. So thanks again for the information

Alan

Mar 15, 2013 at 8:13 AM
Hi Guys,

I have the same issue, and im just a bit confused with what to add where.
In my scenario, i have a tree structure going.

To give an example:
I have a Zone describing residential information,
The zone consists of N- landuses which needs to be expandable in the propertygrid.
the Landuses consists of input parameters and has in turn a list of Stops.

So instead of the excel like grid, i would like to explore these items by expanding the grid.

What should i do to get this going? In my xaml typeeditor, should i return a new propertygrid instance?
Mar 15, 2013 at 11:53 AM
Hi

I have the same problem. Can someone post an example solution perhaps?

M