I need activeItem for columnlayout as it's for xamgrid to modify a column in other popup,So i need an active item to get this value.What Shall i do?
Thanks
Hello,
Thank you for your post. I have been looking into it and I suggest you set the XamGrid’s SelectionSettings’ ColumnSelection to “Single” and you can use the XamGrid’s SelectionSettings’ SelectedColumns’ FirstOrDefault method to get the selected column. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
in reality ,i need the selected object of the columnlayout to modify just a colmn in it ,but by a popup .Thanks
I'm working with MVVM .So i need the selected object in this Columnlayout to modify it;not by editing in the xamgrid directly
Hi Mesnel,
We also need the "ActiveItem for ColumnLayout" feature.
We understand it is not easy as object type can be different for each level.
Anyway, we used this workaround :
Code example :
public PageConstructor(){ this.DataContext = new MyViewModel(); this.MyXamGrid.SelectedRowsCollectionChanged += new EventHandler<SelectionCollectionChangedEventArgs<SelectedRowsCollection>>(MyXamGrid_SelectedRowsCollectionChanged); } void MyXamGrid_SelectedRowsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedRowsCollection> e){ if(e.NewSelectedItems.Count > 0) ((MyViewModel)this.DataContext).SelectedElement = (MyElementType)((RowBase)(e.NewSelectedItems[0])).Data; else ((MyViewModel)this.DataContext).SelectedElement = null;}
Look likes the event is firered after everything else, so we can, at the end, update "SelectedElement".
Hope this will help you.
Alain.