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
C# WPF中的下拉文本区域_C#_Wpf_Wpf Controls - Fatal编程技术网

C# WPF中的下拉文本区域

C# WPF中的下拉文本区域,c#,wpf,wpf-controls,C#,Wpf,Wpf Controls,我在WPF中有一个项目,它有一个ListView。 我想向其中一列添加一个类似combobox的控件,但我希望它显示绑定到ListViewItem的对象属性中的一些文本,而不是项目列表。 类似于VisualStudio中“异常详细信息”窗口中的stacktrace字段 我一直在寻找这个,但我只能找到一个控件,它是付费控件包的一部分。 有人能解决这个问题吗 提前谢谢 这可以是一个简单的用户控件,包含三个元素:文本框、弹出窗口和切换按钮。文本框应放置在弹出窗口的内部和外部。弹出窗口中的一个应启用文

我在WPF中有一个项目,它有一个ListView。 我想向其中一列添加一个类似combobox的控件,但我希望它显示绑定到ListViewItem的对象属性中的一些文本,而不是项目列表。 类似于VisualStudio中“异常详细信息”窗口中的stacktrace字段

我一直在寻找这个,但我只能找到一个控件,它是付费控件包的一部分。 有人能解决这个问题吗


提前谢谢

这可以是一个简单的用户控件,包含三个元素:文本框、弹出窗口和切换按钮。文本框应放置在弹出窗口的内部和外部。弹出窗口中的一个应启用文本换行,而外部未启用。PopupIsOpen属性应绑定到选中的ToggleButton。UserControl的XAML如下所示

<UserControl x:Class="WpfApplication6.UserControl1"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         MinWidth="150"
         x:Name="root"
         VerticalAlignment="Center">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition />
    </Grid.RowDefinitions>
    <TextBox  Text="{Binding ElementName=root, Path=Text}"/>
    <ToggleButton Grid.Column="1" Width="20"
                  x:Name="toggle">
        <Path x:Name="Arrow"
              Grid.Column="1"
              HorizontalAlignment="Center"
              VerticalAlignment="Center"
              Data="M 0 0 L 4 4 L 8 0 Z"
              Fill="Black" />
    </ToggleButton>
    <Popup IsOpen="{Binding ElementName=toggle, Path=IsChecked}" StaysOpen="False"
           Grid.Row="1" Grid.ColumnSpan="2">
        <TextBox Text="{Binding ElementName=root, Path=Text}"
                 Width="{Binding ElementName=root, Path=ActualWidth}"
                 IsReadOnly="True"
                 AcceptsReturn="True"
                 TextWrapping="Wrap"/>
    </Popup>
</Grid>


请记住,在用户控件中需要名为Text的DependecProperty

我相信这只是一个多行文本框。。。你看过它的选项了吗?我觉得它可能更像一行
textbox
,它向用户显示第一行文本,并带有一个下拉列表,显示一个多行文本框,用户可以在其中滚动浏览所有文本。它很有效,我只需稍微更改一下样式,因为它在应用程序中有点混乱。非常感谢。