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 9102489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:23:51+00:00 2026-06-17T01:23:51+00:00

Here’s the problem: I have a ‘home button’ with a listener private void Item_Tap(object

  • 0

Here’s the problem:

I have a ‘home button’ with a listener

    private void Item_Tap(object sender, TappedRoutedEventArgs e)
    {
        if (this.Frame != null)
        {
            this.Frame.Navigate(typeof(Home));
        }
    }

If I built a User Control, using the ‘home button’ inside it, how can I accomplish the same navigation?

** I’m near to the solution**.
This is the user control:

public sealed partial class TopBarControl : UserControl
    {
        public Frame Frame { get; set; }
        public object Parameter { get; set; }
        public TopBarControl(Frame frame)
        {
            this.InitializeComponent();
            this.Frame = frame;
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var dateAndTime = DateTime.Now;
            Date.Text = dateAndTime.Date.ToString("MM/dd/yyyy");
            User.Text = localSettings.Values["userName"].ToString();
            //SectionTitle.Text = Parameter.ToString();
        }

        private void GoHome_Tap(object sender, TappedRoutedEventArgs e)
        {
            if (this.Frame != null)
            {
                this.Frame.Navigate(typeof(Main_Menu));
            }
        }
    }

on the xaml user control I have:

<Button Grid.Column="0" HorizontalAlignment="Right" BorderThickness="0">
    <Image Source="/Assets/home_icon.png" Tapped="GoHome_Tap"/>
</Button>

Page associated to the user control

public WantedVehicles()
        {
            this.InitializeComponent();
        }

        private TopBarControl topBarControl;
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Tit.Text = e.Parameter.ToString();
            topBarControl.Frame = this.Frame;
            topBarControl.Parameter = e.Parameter;
        }

 protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
        }
protected override void SaveState(Dictionary<String, Object> pageState)
        {
        }

But the button doesn’t work yet.

  • 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-17T01:23:53+00:00Added an answer on June 17, 2026 at 1:23 am

    I understand your problem. Here’s a simple way to create a home button that you can add anywhere in your application and it will navigate home. No need to cascade events or anything like that. Just create a custom control. This is different than a user control. This is just sub-classing the button control. Far more clean an approach.

    Three easy steps.

    Note: My custom control is going to be called HomeButton and my home page class is going to be called HomePage. Other than that, this should all be out-of-the-box for you.

    First, define how your button will look:

    <!-- custom home button -->
    <Style TargetType="local:HomeButton" BasedOn="{StaticResource BackButtonStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Height="48" Width="48">
                        <Ellipse Stroke="White" StrokeThickness="2" />
                        <TextBlock Text="&#xE10F;" FontSize="20" 
                                   VerticalAlignment="Center" HorizontalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    Second, define your custom control like this:

    public sealed class HomeButton : Button
    {
        public HomeButton()
        {
            this.DefaultStyleKey = this.GetType();
            this.Click += HomeButton_Click;
        }
    
        void HomeButton_Click(object sender, RoutedEventArgs e)
        {
            var _Frame = Window.Current.Content as Frame;
            var _Type = typeof(HomePage);
            _Frame.Navigate(_Type);
        }
    }
    

    Third, and finally, add your home button to your app!

    <local:HomeButton HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40" />
    

    Here’s how it looks:

    enter image description here

    It even works! 🙂 If you want to style the button more, it will be easy to steal the styling of the BackButtonStyle in your /Common/StandardStyles.xaml file. Then you can have the same View States and all. Anyway, this will get you where you want.

    So, this is home button that solves the problem you described in your question. It even solves it in a way that is less problematic than the solution you assumed you would get – since manually bubbling events across contexts can cause nightmares.

    I hope this helps.

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

Sidebar

Related Questions

Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here is my problem: I have a chatapplication and the messages are displayed in
Here is what I want to do. Use this HTML line and have the
Here is my problem.. I have the option to create(add) two new input fields,
Here's the code I have. It works. The only problem is that the first
Here's the problem....I have three components...A Page that contains a User Control and a
Here is what I am trying to achieve in PHP: I have this string:
Here is the code in a function I'm trying to revise. This example works
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is the code in which i am having the problem- <!DOCTYPE html> <html>

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.