Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Make field visible on a per-row basis?
posted

I have a XamDataGrid and I'd like to make one of the fields visible on a per-row basis. Meaning, I have a boolean field (let's call it HavingABlast) and it's represented by a checkbox. This is a field on a grid, let's say it's a grid of today's activities. For some of those activities, I want to be able to check the HavingABlast checkbox. For other activities (say, "begging for help on the forums") HavingABlast does not apply, and I don't want to even display it.

With WPF and standard DataBinding, I create a second field on my ViewModel called "HavingABlastSectionVisibility" and set it in my ViewModel appropriately. Then, armed with this knowledge on a row-by-row basis, I do:

<CheckBox 

    IsChecked="{Binding HavingABlast}"

    Visibility="{Binding HavingABlastSectionVisibility}" />

Unfortunately I'm new to XamDataGrids and I'm not sure how to create this effect. So...any tips? How do I hide a field on a row-by-row basis in a XamDataGrid?

Here's my (broken) XAML:

<!-- broken -->

<igDP:Field

    Name="HavingABlast"

    Label="Having a blast?"

    Visibility="{Binding Path=DataItem.HavingABlastSectionVisibility}"/>