我在另一个上有两个堆栈面板,内部一个具有可见性“折叠”,它的名称为“verborgen”。当鼠标悬停时,内部堆栈面板需要更改为可见性“可见”。所以我使用 TargetName="verborgen"
但是,它总是返回给我“无法识别名称“verborgen”
<DataTemplate x:Key="WastebinTemplate">
<ContentControl map:MapLayer.Position="{Binding GeoLocation}">
<ContentControl.Content>
<StackPanel>
<TextBlock Background="{StaticResource Blue}" Text="{Binding Barcode}"/>
<StackPanel x:Name="verborgen" Visibility="Collapsed" Background="{StaticResource Orange}">
<Button Name="btnRemove" Content="Remove wastebin" Click="btnRemove_Click">
</Button>
<Label>Adres</Label>
<TextBox Name="txbAdres" Text="{Binding Address}"/>
<Label>Location type</Label>
<ComboBox ItemsSource="{Binding Source={StaticResource LocationTypeInstance}, Path=LocationTypes}"
DisplayMemberPath="Description" SelectedItem="{Binding LocationType}" SelectedValuePath="ID" SelectedValue="{Binding LocationType.ID}" />
<Label>Capaciteit</Label>
<Slider Minimum="0" Maximum="100" TickFrequency="10" Value="{Binding Capacity}"></Slider>
</StackPanel>
</StackPanel>
</ContentControl.Content>
</ContentControl>
<DataTemplate.Resources>
<Style TargetType="StackPanel">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="verborgen" />
<Setter Property="Panel.ZIndex" Value="9999"/>
</Trigger>
</Style.Triggers>
</Style>
</DataTemplate.Resources>
</DataTemplate>