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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:55:03+00:00 2026-05-29T03:55:03+00:00

Here’s the Problem: private void editTaskButton_Click(object sender, RoutedEventArgs e) { // Cast the parameter

  • 0

Here’s the Problem:

    private void editTaskButton_Click(object sender, RoutedEventArgs e)
    {
        // Cast the parameter as a button.
        var button = sender as Button;

        if (button != null)
        {

            // Get a handle for the to-do item bound to the button.
            ToDoItem toDoEdit = button.DataContext as ToDoItem;

           // I need to get toDoEdit handle to the EditTaskPage so that I can work on it
            NavigationService.Navigate(new Uri("/EditTaskPage.xaml",          UriKind.Relative));

        }

    }

I need to use the toDoEdit handle (from a list box) on the EditTaskPage(windows phone page)
What would be the easyest and or most efficient way of doing this. Please be specific. I am working with the windows phone local database for the first time.

Here is what my ToDoItem looks like:

   public class ToDoDataContext : DataContext
  {
    // Pass the connection string to the base class.
    public ToDoDataContext(string connectionString)
        : base(connectionString)
    { }

    // Specify a table for the to-do items.
    public Table<ToDoItem> Items;

    // Specify a table for the categories.
    public Table<ToDoCategory> Categories;
}

ToDoDataContext.cs :

   using System;
   using System.ComponentModel;
   using System.Data.Linq;
   using System.Data.Linq.Mapping;

   namespace project
   {


public class ToDoDataContext : DataContext
{
    // Pass the connection string to the base class.
    public ToDoDataContext(string connectionString)
        : base(connectionString)
    { }

    // Specify a table for the to-do items.
    public Table<ToDoItem> Items;

    // Specify a table for the categories.
    public Table<ToDoCategory> Categories;
}

[Table]
public class ToDoItem : INotifyPropertyChanged, INotifyPropertyChanging
{



    // Define ID: private field, public property, and database column.
    private int _toDoItemId;

    [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]


    public int ToDoItemId
    {
        get { return _toDoItemId; }
        set
        {
            if (_toDoItemId != value)
            {
                NotifyPropertyChanging("ToDoItemId");
                _toDoItemId = value;
                NotifyPropertyChanged("ToDoItemId");
            }
        }
    }

    // Define item name: private field, public property, and database column.
    private string _itemName;

    [Column]
    public string ItemName
    {
        get { return _itemName; }
        set
        {
            if (_itemName != value)
            {
                NotifyPropertyChanging("ItemName");
                _itemName = value;
                NotifyPropertyChanged("ItemName");
            }
        }
    }

    // Define completion value: private field, public property, and database column.
    private bool _isComplete;

    [Column]
    public bool IsComplete
    {
        get { return _isComplete; }
        set
        {
            if (_isComplete != value)
            {
                NotifyPropertyChanging("IsComplete");
                _isComplete = value;
                NotifyPropertyChanged("IsComplete");
            }
        }
    }

    // Version column aids update performance.
    [Column(IsVersion = true)]
    private Binary _version;


    // Internal column for the associated ToDoCategory ID value
    [Column]
    internal int _categoryId;

    // Entity reference, to identify the ToDoCategory "storage" table
    private EntityRef<ToDoCategory> _category;

    // Association, to describe the relationship between this key and that "storage" table
    [Association(Storage = "_category", ThisKey = "_categoryId", OtherKey = "Id", IsForeignKey = true)]
    public ToDoCategory Category
    {
        get { return _category.Entity; }
        set
        {
            NotifyPropertyChanging("Category");
            _category.Entity = value;

            if (value != null)
            {
                _categoryId = value.Id;
            }

            NotifyPropertyChanging("Category");
        }
    }


    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    // Used to notify that a property changed
    private void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    #endregion

    #region INotifyPropertyChanging Members

    public event PropertyChangingEventHandler PropertyChanging;

    // Used to notify that a property is about to change
    private void NotifyPropertyChanging(string propertyName)
    {
        if (PropertyChanging != null)
        {
            PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
        }
    }

    #endregion
}


[Table]
public class ToDoCategory : INotifyPropertyChanged, INotifyPropertyChanging
{

    // Define ID: private field, public property, and database column.
    private int _id;

    [Column(DbType = "INT NOT NULL IDENTITY", IsDbGenerated = true, IsPrimaryKey = true)]
    public int Id
    {
        get { return _id; }
        set
        {
            NotifyPropertyChanging("Id");
            _id = value;
            NotifyPropertyChanged("Id");
        }
    }

    // Define category name: private field, public property, and database column.
    private string _name;

    [Column]
    public string Name
    {
        get { return _name; }
        set
        {
            NotifyPropertyChanging("Name");
            _name = value;
            NotifyPropertyChanged("Name");
        }
    }

    // Version column aids update performance.
    [Column(IsVersion = true)]
    private Binary _version;

    // Define the entity set for the collection side of the relationship.
    private EntitySet<ToDoItem> _todos;

    [Association(Storage = "_todos", OtherKey = "_categoryId", ThisKey = "Id")]
    public EntitySet<ToDoItem> ToDos
    {
        get { return this._todos; }
        set { this._todos.Assign(value); }
    }


    // Assign handlers for the add and remove operations, respectively.
    public ToDoCategory()
    {
        _todos = new EntitySet<ToDoItem>(
            new Action<ToDoItem>(this.attach_ToDo),
            new Action<ToDoItem>(this.detach_ToDo)
            );
    }

    // Called during an add operation
    private void attach_ToDo(ToDoItem toDo)
    {
        NotifyPropertyChanging("ToDoItem");
        toDo.Category = this;
    }

    // Called during a remove operation
    private void detach_ToDo(ToDoItem toDo)
    {
        NotifyPropertyChanging("ToDoItem");
        toDo.Category = null;
    }

    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    // Used to notify that a property changed
    private void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    #endregion

    #region INotifyPropertyChanging Members

    public event PropertyChangingEventHandler PropertyChanging;

    // Used to notify that a property is about to change
    private void NotifyPropertyChanging(string propertyName)
    {
        if (PropertyChanging != null)
        {
            PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
        }
    }

    #endregion
  }


 }
  • 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-29T03:55:04+00:00Added an answer on May 29, 2026 at 3:55 am

    There is more than one way to do this, here are two:

    1. (Quick ‘n’ dirty): put the ToDoItem in a well-known object such as the App object.
    2. Put the Id of the ToDoItem in the Uri: NavigationService.Navigate(new Uri("/EditTaskPage.xaml?id=" + toDoEdit.Id , UriKind.Relative)); and retrieve the item in the EditTaskPage.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a problem I ran into recently. I have attributes strings of the form
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
Here is my problem : I have a post controller with the action create.
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here is my code (Say we have a single button on the page that
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is another spoj problem that asks how to find the number of distinct

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.