I have a grid with more records than can be displayed. The first element in the grid is XamCheckEditor. When I scroll away from me, it checks the current record, when I scroll toward me it unchecks the current record. I don't want the scroll wheel changing any data. Is their a property that I'm missing?
Hello air1kdf,
I have been looking into your posts and I can suggest you comment this following two rows, which change the state of the selected XamCheckEditor during scrolling :
Expression.Blend.SampleData.SampleDataSource.ItemCollection collection = (Expression.Blend.SampleData.SampleDataSource.ItemCollection)XamDataGrid1.DataSource;
collection[dataRecord.DataItemIndex].Boolean_Value = Convert.ToBoolean(chk.Value);
If you have any other questions, feel free to ask.
Yanko Nikolov"] Hello air1kdf, I have been looking into your posts and I can suggest you comment this following two rows, which change the state of the selected XamCheckEditor during scrolling : Expression.Blend.SampleData.SampleDataSource.ItemCollection collection = (Expression.Blend.SampleData.SampleDataSource.ItemCollection)XamDataGrid1.DataSource; collection[dataRecord.DataItemIndex].Boolean_Value = Convert.ToBoolean(chk.Value); If you have any other questions, feel free to ask.
I commented those 2 lines, and it doesn't make a difference in my project. It's still changing data. One of my questions is why is this event firing at all. For example, if I select something in the grid on the left side (not the checkbox), then scroll wheel, the event fires off, and you'll notice the state of the checkbox changes.
I appreciate the help.
My post is just hanging out over here aging like a fine wine.
Should I just open a ticket for this issue?
I have created a supported ticket for you : CAS-84668-8N1KHC.
I have been looking into your posts and the reason, that the ValueChanged event is firing multiple times, is because it fires for all the XamCheckedEditors. This is so because the style has been implicitly created (without a key). This way when a new cell is scrolled into view a visual element (XamCheckEditor) is being initialized for it and its value is being set. This is why the label changes its Content without the selected XamCheckEditor changing its state.
I was wondering what exactly is the purpose of the two lines of code that I have suggested removing because it seems that they make the selected check box change its state ?
I am looking forward to hearing from you.
Hello air1kfd,
I am very glad that you have solved your issue. I hope that all this can be heplful for other visitors of our community.
Somehow I missed your fix. I downloaded this yesterday, and was able to incorporate changes to a much larger project, and it appears to be working great. Since this was a simple project I modified the project to be a little more complex. In the end this worked great.
Thanks for the help, and thanks for the last message.
private void XamDataGrid1_CellChanged(object sender, Infragistics.Windows.DataPresenter.Events.CellChangedEventArgs e) { switch (e.Cell.Field.Name) { case "String_Value2": lblState.Content = "String_Value2 Changed"; break; case "Boolean_Value": if ((e.Editor as XamCheckEditor).IsChecked == true) { lblState.Content = "Boolean_Value Checked"; } else if ((e.Editor as XamCheckEditor).IsChecked == false) { lblState.Content = "Boolean_Value Unchecked"; } break; case "Boolean_Value2": if ((e.Editor as XamCheckEditor).IsChecked == true) { lblState.Content = "Boolean_Value2 Checked"; } else if ((e.Editor as XamCheckEditor).IsChecked == false) { lblState.Content = "Boolean_Value2 Unchecked"; } break; default: break; } }
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
I have been looking into your post and I understood that you wish if an user checks/unchecks a checkbox, some action happens and the scroll wheel does not interfere with the state of the checkbox. I am sending you a modified version of your project(scroll_modified.zip) where this functionality is achieved by handling the event ‘CellChanged’ instead of ‘ValueChanged’.
If you need any further assistance, feel free to ask.
What you are saying does not work that way in my example. I'll just explain what I want, and you can give me an example of how this can be accomplished.
I have a collection of items, some of the data types are boolean. I want to see checkboxes in the grid for boolean values. When the user changes from checked to unchecked, I would like to do something with all the data in that row (say console.writeline). The state of the collection must also match what's in the grid. And the scroll wheel must not interfere with the state of the checkbox.
Simple, and I'm positive that this would benefit others as well.