Main window Xaml
<StackPanel>
<TabControl x:Name="MainTabControl" SelectedIndex="{Binding selected}">
<TabItem Header="Entry Form" TabIndex="0">
<views:EntryForm />
</TabItem>
<TabItem Header="Result" TabIndex="1">
<views:DistanceResults />
</TabItem>
</TabControl>
</StackPanel>
Entry Form XAML
<Button
Command="{Binding MeasureDistanceCommand}"
Content="Measure Distances"
Style="{StaticResource BtnGreen}" />
private void MeasureDistance()
{
if (!Helper.TryParseLatitude(StartLatitude, out var latitude)) return;
if (!Helper.TryParseLongitude(StartLongitude, out var longitude)) return;
var Startlocation = new Location(latitude, longitude);
//todo iterate through he list of the end points and measure there distance
//todo pass the values to the result tab
//todo navigate to the result tab
}
I am using WPF C# MVVM - have a standard BaseViewModel I have a TabControl in the Main window and 2 Tab Items.
What I Trying to do is when the Measure Distance button on the EntryForm is clicked and the command in the EntryFormViewModel finishes preparing the data for the results view. I Want to programmatically make the DistanceResults TabItem active and pass it the data that it needs to display.
This is for a WPF Distance Measure app which is open-sourced and is being developed on my Twitch stream, but I have not been able to find a way to do what I mentioned above. the project is here
https://github.com/copperbeardy/GPSDistanceMeasure
any assistance and advice is appreciated