Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.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
.net WPF按钮编号';单击';属性_.net_Wpf_.net 4.5 - Fatal编程技术网

.net WPF按钮编号';单击';属性

.net WPF按钮编号';单击';属性,.net,wpf,.net-4.5,.net,Wpf,.net 4.5,我是WPF的新手。我正在使用.NET4.5 由于某些原因,我的按钮在intellisense中没有单击属性。当我像下面一样输入它时,我在Blend中得到一个“无效标记”错误 为什么这里没有点击属性 我必须使用命令吗 我的XAML: <Window x:Class="Project.UI.Windows.windowLoadFiles" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

我是WPF的新手。我正在使用.NET4.5

由于某些原因,我的按钮在intellisense中没有
单击
属性。当我像下面一样输入它时,我在Blend中得到一个“无效标记”错误

为什么这里没有
点击
属性

我必须使用命令吗

我的XAML:

<Window x:Class="Project.UI.Windows.windowLoadFiles"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Load Files" Height="350" Width="525">
    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top" x:Name="menuMain" IsMainMenu="True" Height="Auto">
            <MenuItem Header="_File">
                <MenuItem x:Name="menuItem_Main_File_Exit" Header="E_xit" Click="menuItem_Main_File_Exit_Click"></MenuItem>
            </MenuItem>
        </Menu>
        <StackPanel Margin="10">
            <GroupBox Margin="5,0,5,5" Header="Source *" HorizontalAlignment="Stretch">
                <TextBox x:Name="textSourceDirectory"></TextBox>
                <Button x:Name="buttonSelectSourceDirectory" Content="Browse..." Click="buttonSelectSourceDirectory_Click"></Button>
            </GroupBox>
        </StackPanel>
    </DockPanel>
</Window>

正如上面AjS所建议的,在Visual Studio中构建解决方案可以准确地说明这个问题

GroupBox
只能有一个子元素。这意味着,如果需要多个,则需要将它们添加到某种类型的
面板中

以下内容解决了我的问题:

<Window x:Class="Project.UI.Windows.windowLoadFiles"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Load Files" Height="350" Width="525">
    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top" x:Name="menuMain" IsMainMenu="True" Height="Auto">
            <MenuItem Header="_File">
                <MenuItem x:Name="menuItem_Main_File_Exit" Header="E_xit" Click="menuItem_Main_File_Exit_Click"></MenuItem>
            </MenuItem>
        </Menu>
        <StackPanel Margin="10">
            <GroupBox Margin="5,0,5,5" Header="Source *" HorizontalAlignment="Stretch">
                <StackPanel>
                    <TextBox x:Name="textSourceDirectory"></TextBox>
                    <Button x:Name="buttonSelectSourceDirectory" Content="Browse..." Click="buttonSelectSourceDirectory_Click"></Button>
                </StackPanel>
            </GroupBox>
        </StackPanel>
    </DockPanel>
</Window>

我需要等几天。我还将等待,看看是否发布了更全面的答案。