如何将源类型'System.Nullable <bool>'转换为目标类型'bool' - c#

也许这是一个简单的问题,但我找不到答案。使用XAML,我有以下代码:

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

所以在.cs文件中,我需要获取此复选框的值:
所以我有:

res.IsInheriting = tbIsInheriting.IsChecked;

但这是一个错误(无法将源类型“ System.Nullable”转换为目标类型“ bool”)。

参考方案

tblsInheriting.IsChecked.GetValueOrDefault();

preg_replace排除<a href='''> </a> PHP - php

我正在使用preg_replace来替换带有href标签的文本中的关键字,我的正则表达式工作非常好,现在我的代码是:$newstring2 = preg_replace("/\p{L}*?".preg_quote($match[$i])."\p{L}*/ui", "<a href='"…

将'System.Collections.Generic.IEnumerable <string>'转换为'string [] - c#

我在转换一段代码以使其与.NET3.5兼容时遇到问题。static Dictionary<string, object> dictionary = new Dictionary<string, object> { {"key","value"}, {"key2","…

IAsyncOperation <IReadOnlyList <UserNotification >>'不包含'GetAwaiter'的定义 - c#

我正在使用Visual Studio 2017专业版。我一直在遵循本指南:https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/notification-listener我的问题代码如下:using System.Collections.Generi…

如何使整个<div>可选? - javascript

我看过几篇有关使整个div可点击的文章,但我希望使其成为可选择的。我所拥有的是一个php while循环,该循环显示基于用户进入mySQL数据库的表。该代码如下所示: <div class='tracksub'> <div class='headname'><div class='…

TypeError:对象#<HTMLDivElement>没有方法'fadeTo' - php

我正在尝试使用以下代码淡出div:Javascript:<script type="text/javascript"> function show(id) { //document.getElementsByName(id)[0].style.visibility = "visible"; document…