我想在用户悬停鼠标时增加控件的大小.
大小增加不应该重新调整其他控件,而是当前控件应该与相邻控件重叠,如下面所示的谷歌搜索(图像选项卡):

带有红色边框的图像与其他图像重叠.
我在我的ViewModel中实现了IDataErrorInfo,如果文本框有错误,则返回一个字符串.
public string this[string columnName]
{
get { return "Error-- This is a long error message - sd"; }
}
Run Code Online (Sandbox Code Playgroud)
但是此错误消息会在UI上的其他控件后面显示,如下所示.

下面是xaml:
<Window x:Class="Test.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="600" Width="600">
<Window.Resources>
<ControlTemplate x:Key="validationTemplateNew">
<DockPanel LastChildFill="True">
<TextBlock Name="ErrorText" DockPanel.Dock="Bottom" Foreground="White" Background="Red"
FontSize="12" Padding="2" FontFamily="Trebuchet MS"
Margin="5,5,0,0"
TextWrapping="Wrap"
Text="{Binding [0].ErrorContent}" ></TextBlock>
<AdornedElementPlaceholder Name="ErrorTextBox" />
</DockPanel>
</ControlTemplate>
<Style x:Key="ValidationStyle" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BitmapEffect">
<Setter.Value>
<BitmapEffectGroup>
<OuterGlowBitmapEffect GlowColor="Red" GlowSize="3" Noise="0.6"></OuterGlowBitmapEffect>
</BitmapEffectGroup>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources> …Run Code Online (Sandbox Code Playgroud) 如何将任何控件设置到屏幕的最顶部.例如,我在datatemplate或tierichal数据模板中有一个文本块..等等...现在我想在mouseover上将此文本块设置为最顶层.在IsMouseOver的触发器中将Grid.ZIndex值设置为1不会多次运行.为此,我在窗口中将所有控件的ZIndex值设置为-1.它在一个场景中起作用,但在其他时候不起作用.
如果有人能够获得ZIndex的详细信息以及如何将控件设置到最顶层而不必担心其他控件,那将会有很大的帮助.
注意:将ZIndex的值设置为更高的值,例如99999也不起作用.
<!-- GroupHeaderStyle -->
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="False" Margin="15,0,0,0">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ????????????}"/>
<TextBlock Text="-->"/>
<TextBlock Text="{Binding Name}"/>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我希望显示它被分组的属性名称.性别 - >男孩; 性别 - >女孩.
public class Test
{
string gender;
public string Gender
{
get { return gender; }
set { gender = value; }
}
}
Run Code Online (Sandbox Code Playgroud)
我应该提供什么????????????? 在上面的xaml?
另外,如果有任何好的书或链接解释分组的内部细节,请告诉我ListCollectionView.