Welcome to the Xceed Community | Help
Community Search  
More Search Options

Modifying a simple array

Sort Posts: Previous Next
  •  03-02-2009, 10:55 AM Post no. 18995

    Modifying a simple array

    Hello,

    I want to manipulate a simple array with xCeed grid. Is this possible? I can view items, but editing and creating doesn't function. 

    public partial class Window1 : Window {
    public ObservableCollection<int> deneme { get; set; }

    public Window1() {
    InitializeComponent();
    dummy = new ObservableCollection<int>();
    dummy.Add( 1 );
    DataGridCollectionView collectionView = new DataGridCollectionView(dummy, typeof(int));
    dataGridControl1.ItemsSource = collectionView ;
    }

    }

    When I create a dummy class with an int property and create the observable collection with that type, then it's ok. But this solution isn't applicable in my case unfortunately. Additionally I've also experimented turning off autocolumn creation and creating a column with no parameters in Binding.

    Any help is appreciated.

    Best Regards.

    Aykut.

     

  •  03-02-2009, 6:18 PM Post no. 19001 in reply to 18995

    Re: Modifying a simple array

    Hello,

    I think you could define a CellEditor:

    <xcdg:CellEditor x:Key="myEditor">
          <xcdg:CellEditor.EditTemplate>
            <DataTemplate>
              <TextBox Text="{xcdg:CellEditorBinding}" />
            </DataTemplate>
          </xcdg:CellEditor.EditTemplate>
        </xcdg:CellEditor>

    Then you could add this CellEditor to the Columns property of DataGridControl :

    <xcdg:Column Width="150" Title="My Title" FieldName="Name" CellEditor="{StaticResource myEditor}">

    Before, you would have to define a DataGridItemProperty to bind this editable column to items in your ObservableCollection<int>.

    <xcdg:DataGridCollectionViewSource x:Key="myCollectionViewSource" AutoCreateItemProperties="False">
          <xcdg:DataGridCollectionViewSource.ItemProperties>
            <xcdg:DataGridItemProperty Name="Name" ValuePath="What here?" />
          </xcdg:DataGridCollectionViewSource.ItemProperties>
        </xcdg:DataGridCollectionViewSource>

    The problem is that I don't know what to put in the ValuePath property to do it. This property is used to define a path in classes.

    So, if someone knows how to define correctly a DataGridItemProperty to 'self'...

    Thanks

  •  03-03-2009, 1:47 AM Post no. 19007 in reply to 19001

    Re: Modifying a simple array

    It seems this is not possible with this control because of its architecture.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.