WPF using xaml and C#

I am learning how to WPF :smiley:

Finding it way more confusing than winforms!

My code behind is in C# but the WPF is in xaml…

Question #1 : Is this how you guys do it or is there a better way?

Question #2: I have some tickboxes. I want to be able to select multiple rows, tick a tickbox and for ALL the selected rows to fill in (or unfill)… but I cannot get it to work… Has anyone cracked this and what method did you use? Any tips gratefully received :slight_smile:

2 Likes

Thanks.

I’ve made the WPF… I’ve got the tickboxes but when I select several rows at once, then tick a tickbox, only one fills in. I want them all to fill in/ unfill…

Does your code allow the tickboxes to fill in?

Mine is just a sample of a WPF window, so no checkboxes. But that is doable.

You could subscribe to an event in your XAML.

PSeudo Code:

///WPF Side
MyCheckBox.OnMouseDown => OnCheckedHandler

///CodeBehind
OnCheckedHandler()
{
 for eachCheckbox in Selection:
    eachCheckbox .Checked = !eachCheckbox .Checked 
}
2 Likes

I’ve tried several things… but it makes the stuff in my data grid vanish.

I’ll have closer looky at this suggestion on Monday. Thanks :slight_smile:

1 Like

Hi @Alien, please look at this video for an example of selecting multiple checkboxes. The GitHub link to the code is in the description. Otherwise, you can send me your code (both XAML and C#); maybe I can help.

WPF CHECKED LISTBOX SAMPLE - YouTube

3 Likes