0
Usercontrol的模板如下。如何提高彈出窗口中按鈕的點擊事件?
<ControlTemplate x:Key="MarkerTemplate" >
<ToggleButton x:Name="btnMarkerPin" Click="btnMarkerPin_Click" >
<ToggleButton.Template>
<ControlTemplate >
<Grid>
<Grid>
<Ellipse Fill="Green" Width="25" Height="25" VerticalAlignment="Center" HorizontalAlignment="Center" ToolTip="{Binding}" />
</Grid>
<Popup x:Name="pop" PlacementTarget="{Binding ElementName=pin}" StaysOpen="True" Placement="Top" VerticalOffset="-4" HorizontalOffset="-4" IsOpen="False" Margin="30,-50,0,0" AllowsTransparency="True" >
<Border Opacity=".7" CornerRadius="5" BorderBrush="Red" BorderThickness="2" Background="Yellow">
<Grid Margin="10">
<Button x:Name="btnLinkMarker" Style="{StaticResource LinkButton}" FontWeight="Bold" Content="{Binding}" />
</Grid>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="pop" Property="IsOpen" Value="true"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
</ControlTemplate>
點擊應該發生在popup中的btnLinkMarker上。如果我提出事件我得到一個異常對象引用未設置。任何人都可以幫忙我如何舉辦這個活動?
非常感謝。我會試着將其標記爲答案。 – Ershad
@Ershad:如果您確信這是** you **的正確解決方案,請將其標記爲正確答案。我個人認爲,是的。 – Tigran