Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8597713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:58:30+00:00 2026-06-12T00:58:30+00:00

Usercontrol’s template is as below. <ControlTemplate x:Key=MarkerTemplate > <ToggleButton x:Name=btnMarkerPin Click=btnMarkerPin_Click > <ToggleButton.Template> <ControlTemplate

  • 0

Usercontrol’s template is as below.

 <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>   

Click should happen on btnLinkMarker in popup. If i raise event i get an exception object reference not set. Can anyone help. How do i raise this event?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:58:31+00:00Added an answer on June 12, 2026 at 12:58 am

    Assign a Command to a button and call Command and not raise an event on the control (UI artifact).

    In WPF always avoid acting directly on UI, as much as it possible. Here, at least in provided question context, it’s something that can be easilly achieved.

    What are Commands

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl which contains the following XAML: <GroupBox> <Grid> <Button x:Name=btn Content=Test/>
I have a UserControl that exists of only two TextBlocks: <UserControl [...] x:Name=root> <StackPanel
Some UserControl uses converters, which usually look like this: <UserControl.Resources> <Converters:CurrentDataConverter x:Key=CurrentDataConverter/> </UserControl.Resources> I
The UserControl below works well but I would like to make it easier to
The UserControl below works well but I would like to make it easier to
I have a UserControl named myControl and there is a 3 columns Grid within
I have a custom UserControl that contains a grid ...I wish to set the
I have a custom UserControl that is defined by the following XAML: <Grid HorizontalAlignment=Left
I have created a UserControl and I want when I click on some button
I crate one UserControl name as MYUC after then i want to remove that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.