Repository: microsoft/PowerToys
File: src/modules/peek/Peek.FilePreviewer/FilePreview.xaml.cs (C#)

Code before:
        [NotifyPropertyChangedFor(nameof(BitmapPreviewer))]
        [NotifyPropertyChangedFor(nameof(IsImageVisible))]
        [NotifyPropertyChangedFor(nameof(BrowserPreviewer))]
        [NotifyPropertyChangedFor(nameof(IsBrowserVisible))]
        private IPreviewer? previewer;

        public FilePreview()
        {
            InitializeComponent();
        }

        public IBitmapPreviewer? BitmapPreviewer => Previewer as IBitmapPreviewer;

        public IBrowserPreview? BrowserPreviewer => Previewer as IBrowserPreview;

        public bool IsImageVisible => BitmapPreviewer != null;

        /* TODO: need a better way to switch visibility according to the Preview.
         * Could use Enum + Converter to switch according to the current preview. */
        public bool IsBrowserVisible
        {
            get
            {
                if (BrowserPreviewer != null)
                {
                    return BrowserPreviewer.IsPreviewLoaded;
                }

                return false;
            }
        }

        public File File
        {
            get => (File)GetValue(FilesProperty);
            set => SetValue(FilesProperty, value);
        }

        private async Task OnFilePropertyChanged()
        {
            if (File == null)
            {
                return;
            }

            Previewer = previewerFactory.Create(File);
            if (Previewer != null)
            {
                var size = await Previewer.GetPreviewSizeAsync();
                PreviewSizeChanged?.Invoke(this, new PreviewSizeChangedArgs(size));
                await Previewer.LoadPreviewAsync();

Review comment (suggestion):
I think this could be reduced to `public bool IsBrowserVisible => BrowserPreviewer?.IsPreviewLoaded ?? false;`

Code after:
        [NotifyPropertyChangedFor(nameof(BitmapPreviewer))]
        [NotifyPropertyChangedFor(nameof(IsImageVisible))]
        [NotifyPropertyChangedFor(nameof(UnsupportedFilePreviewer))]
        [NotifyPropertyChangedFor(nameof(IsUnsupportedPreviewVisible))]
        [NotifyPropertyChangedFor(nameof(BrowserPreviewer))]
        [NotifyPropertyChangedFor(nameof(IsBrowserVisible))]
        private IPreviewer? previewer;

        public FilePreview()
        {
            InitializeComponent();
        }

        public IBitmapPreviewer? BitmapPreviewer => Previewer as IBitmapPreviewer;

        public IBrowserPreview? BrowserPreviewer => Previewer as IBrowserPreview;

        public bool IsImageVisible => BitmapPreviewer != null;

        public IUnsupportedFilePreviewer? UnsupportedFilePreviewer => Previewer as IUnsupportedFilePreviewer;

        public bool IsUnsupportedPreviewVisible => UnsupportedFilePreviewer != null;

        /* TODO: need a better way to switch visibility according to the Preview.
         * Could use Enum + Converter to switch according to the current preview. */
        public bool IsBrowserVisible
        {
            get
            {
                if (BrowserPreviewer != null)
                {
                    return BrowserPreviewer.IsPreviewLoaded;
                }

                return false;
            }
        }

        public File File
        {
            get => (File)GetValue(FilesProperty);
            set => SetValue(FilesProperty, value);
        }

        private async Task OnFilePropertyChanged()
        {
            if (File == null)
            {
                return;
            }