もう一方には 2 つのスタックパネルがあります。したがって、最初のスタックパネルは常に表示され、バーコードがあります。2 番目のスタックパネル x:Name="Verborgen" の Visiblity が "Collapsed" の場合、mouseOver 時に Visibility を "Visible" にする必要があります。現在表示されているスタックパネルには z-Index 9999 が必要です。
これは、プロジェクトへのドロップボックス リンクです: https://www.dropbox.com/s/8w8horclhfwy4ub/Oefening2.zip
このコードを Window.Resources に追加しても機能しませんが、これは私が望むものです:
<ControlTemplate x:Key="panelControl" TargetType="StackPanel">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Verborgen" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
This is the xaml
<Window.Resources>
<model:LocationType x:Key="LocationTypeInstance"/>
<DataTemplate x:Key="WastebinTemplate">
<ContentControl map:MapLayer.Position="{Binding GeoLocation}">
<ContentControl.Content>
<StackPanel Name="form">
<TextBlock Background="{StaticResource Blue}" Text="{Binding Barcode}"/>
<StackPanel Visibility="Collapsed" x:Name="Verborgen" 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>
</Window.Resources>