我无法理解我做错了什么.我想在listView中对项目进行分组.结果我希望看到类似的东西:

它使用的是MVVM模式.这是我的XAML代码.
<CollectionViewSource x:Key="EmploeeGroup"
Source="{Binding Path=AllEmploees}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="FirstName" />
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
<ListView AlternationCount="2"
DataContext="{StaticResource EmploeeGroup}"
ItemsSource="{Binding IsAsync=True}" Padding="0,0,0,10">
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" BorderBrush="#FFA4B97F"
BorderThickness="0,0,0,1">
<Expander.Header>
<DockPanel>
<TextBlock FontWeight="Bold"
Text="Name: "/>
<TextBlock FontWeight="Bold"
Text="{Binding Path=FirstName}"/>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
<ListView.View>
<GridView>
<GridViewColumn Width="150"
Header="FirstName"
DisplayMemberBinding="{Binding Path=FirstName}"/>
<GridViewColumn Width="150"
Header="LastName"
DisplayMemberBinding="{Binding Path=LastName}"/>
</GridView>
</ListView.View>
</ListView>
Run Code Online (Sandbox Code Playgroud)
这是我的EmploeeListViewModel.cs
public …Run Code Online (Sandbox Code Playgroud) 是否有可能控制HwndHost控件?(我不想使用弹出窗口)
此HwndHost控件覆盖任何WPF控件.据我所知,它不依赖于ZIndex.(因为HwndHost控件是由COM绘制的)
如果您想使用此控件,您可以获得有关它的更多信息并在此处下载示例.

我无法理解如何制作正则表达式例如我有掩码:xxxx-xxxx-xxxx其中"x"可以是az或AZ或0-9
并有代码:
string[] numbers =
{
"1a3F-5t5C-FIG0-InFo",
"444-234-2245",
"444.-2344-2245",
};
string sPattern = "^[a-z0-9A-z]{4}-[a-z0-9A-z]{4}-[a-z0-9A-z]{4}$-[a-z0-9A-z]{4}$";
var validList = new List<string>();
foreach (string s in numbers)
{
if (Regex.IsMatch(s, sPattern))
{
validList.Add(s);
}
}
Assert.IsTrue(validList.Count==1);
Run Code Online (Sandbox Code Playgroud)
但它不起作用......我在表达方面有一些错误.你能解释一下为什么是错的吗?