Marc Armstrong

Marc Armstrong

  • NA
  • 16
  • 1.9k

Sharing data between usercontrols

Jun 9 2013 5:28 PM
Hi,

I'm fairly new to WPF and would like split up a large XAML file for my main UI into multiple files with a user control to represent each tab. I understand that this is a common way to reduce a XAML file. The problem I have is that I want to share data between the tabs.

The main window will create myDeviceObject and will have user controls to represent each tab. I'd like to pass myDevice object to each tabUserControl. Can I do this in the main XAML file. An easy solution would be to make myDeviceObject static but this is not desirable.

If the main UI owns each user control, how does it pass myDeviceObject to it?

Thanks in advance.