Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions XamlStudio/Views/DataSources.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace XamlStudio.Views;
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class DataSources : Page,
IRecipient<ActiveDocumentViewModelChangedMessage>
public sealed partial class DataSources : Page,
IRecipient<ActiveDocumentViewModelChangedMessage>,
IRecipient<DataSourceSetInFileMessage>
Expand Down Expand Up @@ -79,21 +81,25 @@ private void DataSources_Loaded(object sender, RoutedEventArgs e)
WeakReferenceMessenger.Default.UnregisterAll(this);
WeakReferenceMessenger.Default.RegisterAll(this);

Receive(new ActiveDocumentViewModelChangedMessage(null, MainViewModel.ActiveDocumentViewModel));
//Receive(new ActiveDocumentViewModelChangedMessage(null, MainViewModel.ActiveDocumentViewModel));
// TODO: How to detect/get info on if d:DesignData was used to display here if opened after render...
}

public void Receive(ActiveDocumentViewModelChangedMessage message)
{
// Update are shadow-copy based on MainViewModel
_activeDocument = message.NewDocVM.Document;
ActiveDataContext = _activeDocument.DataContext;

// Toggle showing the panel if we have a remote source, though not explicitly bound as we initially open it with no url.
RemoteDataSourceButton.IsChecked = ActiveDataContext.IsRemote;
IsRenderedDataContext = false;
DataContext = message.Value;
}

// public void Receive(ActiveDocumentViewModelChangedMessage message)
// {
// // Update are shadow-copy based on MainViewModel
// _activeDocument = message.NewDocVM.Document;
// ActiveDataContext = _activeDocument.DataContext;

// // Toggle showing the panel if we have a remote source, though not explicitly bound as we initially open it with no url.
// RemoteDataSourceButton.IsChecked = ActiveDataContext.IsRemote;
// IsRenderedDataContext = false;
// }

public async void Receive(DataSourceSetInFileMessage message)
{
if (message?.FileName == null)
Expand Down