Skip to content

Commit

Permalink
chore: Adjust swapview for xaml reader
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Oct 27, 2023
1 parent f0ec731 commit 3817c61
Showing 1 changed file with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,11 @@ bool IsSameBaseUri(FrameworkElement i)
|| uri.OriginalString == i.BaseUri?.OriginalString;
}

foreach (var instance in EnumerateInstances(Window.Current.Content, IsSameBaseUri))
foreach (var instance in EnumerateInstances(Window.Current.Content, IsSameBaseUri).OfType<FrameworkElement>())
{
switch (instance)
if (XamlReader.LoadUsingXClass(fileContent, uri.ToString()) is FrameworkElement newContent)
{
#if __IOS__
case UserControl userControl:
if (XamlReader.LoadUsingXClass(fileContent, uri.OriginalString) is UIKit.UIView newInstance)
{
SwapViews(userControl, newInstance);
}
break;
#endif
case ContentControl content:
if (XamlReader.LoadUsingXClass(fileContent, uri.ToString()) is ContentControl newContent)
{
SwapViews(content, newContent);
}
break;
SwapViews(instance, newContent);
}
}

Expand Down

0 comments on commit 3817c61

Please sign in to comment.