Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 绑定Intellisense不适用于某些继承了DataContext的控件_C#_Wpf_Autocomplete_Intellisense_Datacontext - Fatal编程技术网

C# 绑定Intellisense不适用于某些继承了DataContext的控件

C# 绑定Intellisense不适用于某些继承了DataContext的控件,c#,wpf,autocomplete,intellisense,datacontext,C#,Wpf,Autocomplete,Intellisense,Datacontext,我在XAML中将窗口的DataContext设置为我的ViewModel 当我现在想要为某个控件上的属性创建绑定时,我通常会使用Intellisense(显示ViewModel的属性)。在下面的示例中,这适用于Grid和TabControl。然而,在TabItem上,Intellisense不再工作 绑定本身可以正常工作,只是Intellisense无法工作 下面是我的示例代码: <Window x:Class="MyApp.View.MainWindow" xmlns="

我在XAML中将窗口的
DataContext
设置为我的ViewModel

当我现在想要为某个控件上的属性创建绑定时,我通常会使用Intellisense(显示ViewModel的属性)。在下面的示例中,这适用于
Grid
TabControl
。然而,在
TabItem
上,Intellisense不再工作

绑定本身可以正常工作,只是Intellisense无法工作

下面是我的示例代码:

<Window x:Class="MyApp.View.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MyApp.View"
        xmlns:vm="clr-namespace:MyApp.ViewModel"
        mc:Ignorable="d"
        Title="My App" Height="768" Width="1024">
    <Window.DataContext>
        <vm:MainWindowViewModel></vm:MainWindowViewModel>
    </Window.DataContext>
    <Grid> <!-- Intellisense works here -->
        <TabControl x:Name="MainTabControl"> <!-- Intellisense works here too -->
            <TabItem Header="{Binding Heading}"> <!-- Intellisense DOES NOT work here -->
              ...

...