I certainly hope that this question is easy to answer but it's been days and I haven't figured out how to share data between UserControls.
The page below has two tabs and their sources are referenced. It also has a button labeled Start that accesses a command within the ViewModel.
The problem I'm having is the data is actually within the tabs. I set them to use the same ViewModel and they each create their own instance of the ViewModel so the data is never present to the Start button. I hope that makes since.
It's a rather simple program and I don't really see the need to have 3 separate ViewModels that only contain single elements but perhaps that's what I need to do. All in all, I still need to gather all of the data from everything and submit it to an outside entity when I hit that start button.
I apologize if this is a question that's been asked before but I'm relatively new to C# so I'm not entirely certain what I'm asking for. Thanks in advance!
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
x:Class="DeployWiz.Pages.Config"
mc:Ignorable="d"
xmlns:local="clr-namespace:DeployWiz.ViewModel"
d:DesignHeight="356.978" d:DesignWidth="333.582">
<Grid Style="{StaticResource ContentRoot}" Margin="16,28,16,5" >
<Grid.DataContext>
<local:ComputerViewModel/>
</Grid.DataContext>
<mui:ModernTab x:Name="tabList" Layout="List" SelectedSource="/Views/ComputerView.xaml" Margin="0,0,0,40">
<mui:ModernTab.Links>
<mui:Link DisplayName="Settings" Source="/Views/ComputerView.xaml" />
<mui:Link DisplayName="Applications" Source="/Views/ApplicationView.xaml" />
</mui:ModernTab.Links>
</mui:ModernTab>
<Button Content="Start" HorizontalAlignment="Center" Margin="0,0,0,5" VerticalAlignment="Bottom" Width="75" Command="{Binding Path=StartTask}"/>
</Grid>
</UserControl>