How can I put a checkbox in a grid column which binds to a sqlite integer (sqlite doesn't have booleans)?
i'm trying to put the checkbox in the column, it's the change cs which keep throwing errors.
In this case you need additional not mapped property which will represent the boolean value of your original data field value.
yes, my question to you is how to do that, if you can, please explain the cs to do that, i've tried for the last 4 days and no luck.
Checkbox in gridcolumn for sqlite integer field.zip (397.1 KB)
[NotMapped]
public bool MyProperty
{
get
{
return MyIntProperty == 1;
}
set
{
MyIntProperty = value ? 1 : 0;
}
}
Change event handler argument should be object not bool. Not sure why you need it at all since you already have two-way binding.
chatgtp told me, after a few other ideas, to use this... what would you recommend that's simpler?
I’m not that smart as ChatGPT however I can assure you there isn’t anything simpler. You can simply delete the Change handler.
sorry to drag this on... cs is next to impossible for me to figure out - i took out as much as i though could go but am now getting in the browser console "Error: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: s.Included'"
Your property is missing the [NotMapped]
attribute. It is important.
i know that this is beyond support policy, but maybe if you could help me past this hopefully last little snag "Error: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: s.Included'."
thanks thanks thanks!!!
it work AMAZING now, and just the minimal tweaks. i think my issue was i didn't set the field to NOT NULL