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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:20:50+00:00 2026-05-31T13:20:50+00:00

There is a MenuItem click event MainMenu_Define_Material which opens a window called Material .

  • 0

There is a MenuItem click event MainMenu_Define_Material which opens a window called Material. I get info from a textbox called txt_density and I save that info in density and return to main window via OK-button having click event Material_btn_OK_Click.

My question is, how I can avoid passing the last session values every time I open the window Material?

I want, once density is set, every time I open Material window I want to see the values of previous session.

private void MainMenu_Define_Material(object sender, RoutedEventArgs e)
{
    newWin_material = new Material();            

    newWin_material.btn_OK.Click += new RoutedEventHandler(Material_btn_OK_Click);            

    if (density != -1)
    {
        newWin_material.txt_density.Text = density.ToString();            
    }

    newWin_material.ShowDialog();
}

private void Material_btn_OK_Click(object sender, RoutedEventArgs e)
{
    density = System.Convert.ToSingle(newWin_material.txt_density.Text);    
    newWin_material.Close();            
}
  • 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-05-31T13:20:51+00:00Added an answer on May 31, 2026 at 1:20 pm

    Not very clear where that density comes from, but you can insert that field in uour data class what you can hold on data layer or may be like ObjectDataProvider for modelview.

    There are a lor of different solutioms our there. The basic idea is:

    Define common, shared data storage and keep there alll values you want to share between different windows.

    Define a data class. I used here a static class with a static member Desnity.

    public static class DataClass 
    {
         public static double Desnsity;
    }
    

    After in any window you’re able to access that field (read/write), like

    DataClass.Density
    

    Hope this is clear.

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

Sidebar

Related Questions

Is there a way for a parent MenuItem to be notified when a child
I have a XAML MenuItem DataBound ItemsSource that is working fine however there is
There seem to be very different opinions about using transactions for reading from a
There are many conflicting statements around. What is the best way to get the
Is there any way to know the parent/component which initiates context menu? I have
How do I pass a string with QueryString from a MenuItem? I tried /UserDisplay.aspx?UserName=<%(String)Session[sessUserName]%>
There are 6 activities in my application . I start new activity when click
Is there a class that overwrites the .MainMenu_MenuItem class for the Main Menu? I
Is there a way to automatically generate a menu item when creating a K2
Is there a simple way to increase the spacing between the menu item text

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.