Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert source type 'System.Nullable<bool>' to target type 'bool'

Maybe this is a simple question, but I can't find the answer. Using XAML I have this code:

<CheckBox Grid.Column="2"  Grid.Row="3" Height="23" HorizontalAlignment="Left" Name="tbIsInheriting"  VerticalAlignment="Top" Width="191" Margin="0,4,0,0" />

so in .cs file I need to get value of this Checkbox: so I have:

res.IsInheriting = tbIsInheriting.IsChecked;

but this is a mistake (cannot convert source type 'System.Nullable' to target type 'bool').

like image 814
revolutionkpi Avatar asked Sep 07 '11 07:09

revolutionkpi


1 Answers

tblsInheriting.IsChecked.GetValueOrDefault();
like image 159
MattDavey Avatar answered Oct 10 '22 05:10

MattDavey