Forum guidelines
AuthorQuestion
CheckBox Binding
Posted on: 11 Oct 2008
Hi ,

I have a scenario where my customized checkbox should be able to bind values (IsChecked) anything ex: Y, N or 1, 0 as Booleans. Currently I have implemented the IValueConverter interface and overrided the Convert and ConvertBack method adding my logic to convert the different values into bool appropriately. This works fine. 

But now what I need to do is instead of putting this logic into the class file of customized checkbox, I would like to have all this code in my xaml file itself where I can using Templates configure different values as Booleans. Can you please guide me in achieving the same.

Thanks in Advance.


AuthorReply
Re: CheckBox Binding
Posted on: 16 Apr 2009  
Hi,

You can set checked or unchecked CheckBox in XAML instead doing that in code. I have a property whose value is set either True or False and in XAML i bind the checkbox with that Property

<GridViewColumn Header="Configured Authorization" HeaderContainerStyle="{StaticResource myHeaderStyle}" Width="Auto">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Path=CompAuthConfigValue}"></CheckBox>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>

Here CompAuthConfigValue is property in the Class which i used. So as the Property changed the CheckBox will be checked or unchecked.

Hope that Helps.



Hope this will help. 
Don't forget to Mark Do you like this Answer

"Don't forget to mark this as Answer"

Kapil Deo Malhotra

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.