Click here to Skip to main content
15,881,172 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to accelebrate chart when have many series? Pin
John Torjo26-Nov-15 3:35
professionalJohn Torjo26-Nov-15 3:35 
GeneralRe: how to accelebrate chart when have many series? Pin
Richard Deeming26-Nov-15 3:40
mveRichard Deeming26-Nov-15 3:40 
GeneralRe: how to accelebrate chart when have many series? Pin
John Torjo26-Nov-15 3:41
professionalJohn Torjo26-Nov-15 3:41 
GeneralRe: how to accelebrate chart when have many series? Pin
Pete O'Hanlon26-Nov-15 5:16
mvePete O'Hanlon26-Nov-15 5:16 
QuestionHttpWebRequest in WCF Pin
Giorgi Martiashvili24-Nov-15 20:00
Giorgi Martiashvili24-Nov-15 20:00 
SuggestionRe: HttpWebRequest in WCF Pin
Kornfeld Eliyahu Peter24-Nov-15 22:49
professionalKornfeld Eliyahu Peter24-Nov-15 22:49 
AnswerRe: HttpWebRequest in WCF Pin
Rob Philpott25-Nov-15 1:10
Rob Philpott25-Nov-15 1:10 
Question(WPF) How to pass events from child to parent Pin
Foothill24-Nov-15 10:51
professionalFoothill24-Nov-15 10:51 
I've been struggling with this one for half-a-day and I'm still not figuring out how to do this correctly.

What I am trying to do is set up a popup control that will reactive the owning window in the event that the window looses focus but the user then clicks the popup. The trouble is that, normally, the popup looses focus with the window and the user cannot interact with it until the window is reactivated. Since the popup is always 'On Top', it is always shown even if the parent window gets covered up. This makes it the natural choice for users to return to the application.


This code works only half way.

C#
// Updates to the App class
public partial class App : Application
{
  private bool _active;

  public bool Active { get { return _active; } }
  private void Application_Activated(object sender, EventArgs e)
  {
    _active = true;
  }
  private void Application_Deactivated(object sender, EventArgs e)
  {
    _active = false;
  }
}

// Popup event handler
public void PopupBase_MouseDown(object sender, EventArgs e)
{
  App currentApp = Application.Current as App;
  if (currentApp != null)
  {
    if (!currentApp.Active)
    {
      _owner.Activate();
    }
  }
}


This only works when the parent object is clicked but I'm having trouble wiring the child controls to trigger the event. If the user clicks anywhere in the popup except directly on a child element it works.
I tried this but it didn't work. The Popup's Child in all cases is a Border class.

C#
// This was set to trigger on the Popup.Child's Loaded event
public void PopupChild_Loaded(object sender, EventArgs e)
{
  AddActivationHandler(this.Child.Child);  // Child is Border and the border's child is a Grid
}
private void AddActivationHandler(UIElement element)
{
  if (element is Panel)
  {
    Panel pElement = element as Panel;
    foreach (UIElement child in pElement.Children) // Recursively iterate through all children and children of children
    {
      AddActivationHandler(child);
    }
  }

  element.MouseDown += PopupBase_MouseDown;
{


I stepped through and the event handlers do get added but they were never called. Is there another way to have all of a parent's children pass their events back up to a specific control?

After some further reading, is this something that could be handled with Routed Events?

modified 24-Nov-15 17:17pm.

Generalcoding problem progress bar Pin
Kris Saelen24-Nov-15 5:56
Kris Saelen24-Nov-15 5:56 
AnswerRe: coding problem progress bar Pin
Duncan Edwards Jones24-Nov-15 5:57
professionalDuncan Edwards Jones24-Nov-15 5:57 
GeneralRe: coding problem progress bar Pin
Eddy Vluggen24-Nov-15 6:00
professionalEddy Vluggen24-Nov-15 6:00 
GeneralRe: coding problem progress bar Pin
R. Giskard Reventlov24-Nov-15 6:51
R. Giskard Reventlov24-Nov-15 6:51 
GeneralRe: coding problem progress bar Pin
Ian Shlasko24-Nov-15 7:14
Ian Shlasko24-Nov-15 7:14 
AnswerRe: coding problem progress bar Pin
John Torjo24-Nov-15 11:33
professionalJohn Torjo24-Nov-15 11:33 
GeneralRe: coding problem progress bar Pin
Kris Saelen28-Nov-15 10:50
Kris Saelen28-Nov-15 10:50 
QuestionRead, write and processing each row of a gridview ? Pin
Member 245846723-Nov-15 15:59
Member 245846723-Nov-15 15:59 
AnswerRe: Read, write and processing each row of a gridview ? Pin
F-ES Sitecore23-Nov-15 22:44
professionalF-ES Sitecore23-Nov-15 22:44 
AnswerRe: Read, write and processing each row of a gridview ? Pin
John Torjo24-Nov-15 0:20
professionalJohn Torjo24-Nov-15 0:20 
AnswerRe: Read, write and processing each row of a gridview ? Pin
Simon_Whale24-Nov-15 5:02
Simon_Whale24-Nov-15 5:02 
GeneralRe: Read, write and processing each row of a gridview ? Pin
Member 245846724-Nov-15 18:58
Member 245846724-Nov-15 18:58 
GeneralRe: Read, write and processing each row of a gridview ? Pin
Simon_Whale24-Nov-15 22:00
Simon_Whale24-Nov-15 22:00 
GeneralRe: Read, write and processing each row of a gridview ? Pin
Member 245846724-Nov-15 22:49
Member 245846724-Nov-15 22:49 
GeneralRe: Read, write and processing each row of a gridview ? Pin
Simon_Whale24-Nov-15 22:55
Simon_Whale24-Nov-15 22:55 
GeneralRe: Read, write and processing each row of a gridview ? Pin
Member 245846725-Nov-15 15:00
Member 245846725-Nov-15 15:00 
QuestionC# app as proxy Pin
Member 1206160023-Nov-15 0:12
Member 1206160023-Nov-15 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.