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.
Thanks for looking at it, and creating a ticket.
I can't agree with your reasoning. If I don't select a record the state doesn't change. This is contradictory to what you are saying about them getting created in and out of view.
FYI those 2 lines just update the boolean value. I'm sure not the best way, but it works. Commenting out those 2 lines has zero impact on the event. Thus it's not re-firing the event.
I'm just learning WPF, so it's all new to me. I am not the expert, and could very well be wrong about the event handling. Right now I just need to make it work.
I have been looking into your post and I assume that by these two lines of code you would like to assure that the value of the activated record will be changed when its XamCheckEditor is checked/unchecked. This is usually not necessary because it is part of the built-in functionality and the value will be changed automatically when the particular XamCheckEditor is checked/unchecked.
As I mentioned above, declaring the Style implicitly(without a key) makes the event fire for all XamCheckEditors and when you are scrolling the Content of the Label changes multiple times and this causes the unexpected behavior.
If I misunderstood the purpose of your implementation in the event’s body, please explain us what exactly you would like to achieve.
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.
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
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; } }
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.