From 9f26fd36008d2cf4fe96b8dce7ec935b38b0b4c7 Mon Sep 17 00:00:00 2001
From: Emmanuel Hansen <emmausssss@gmail.com>
Date: Mon, 18 Sep 2023 20:09:22 +0000
Subject: remove some usages of reflection binding (#5686)

---
 src/Ryujinx.Ava/UI/Applet/ErrorAppletWindow.axaml         |  6 ++++--
 src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml         |  8 +++++---
 src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml     | 14 +++++++-------
 src/Ryujinx.Ava/UI/Controls/ApplicationListView.axaml     | 12 ++++++------
 src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml              | 15 ++++++++-------
 .../UI/Windows/DownloadableContentManagerWindow.axaml     | 10 +++++-----
 6 files changed, 35 insertions(+), 30 deletions(-)

(limited to 'src')

diff --git a/src/Ryujinx.Ava/UI/Applet/ErrorAppletWindow.axaml b/src/Ryujinx.Ava/UI/Applet/ErrorAppletWindow.axaml
index a70fc8d4..6186b7d9 100644
--- a/src/Ryujinx.Ava/UI/Applet/ErrorAppletWindow.axaml
+++ b/src/Ryujinx.Ava/UI/Applet/ErrorAppletWindow.axaml
@@ -6,9 +6,11 @@
     xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     Title="{locale:Locale ErrorWindowTitle}"
+    xmlns:views="using:Ryujinx.Ava.UI.Applet"
     Width="450"
     Height="340"
     CanResize="False"
+    x:DataType="views:ErrorAppletWindow"
     SizeToContent="Height"
     mc:Ignorable="d"
     Focusable="True">
@@ -38,7 +40,7 @@
             Grid.Column="1"
             Margin="10"
             VerticalAlignment="Stretch"
-            Text="{ReflectionBinding Message}"
+            Text="{Binding Message}"
             TextWrapping="Wrap" />
         <StackPanel
             Name="ButtonStack"
@@ -49,4 +51,4 @@
             Orientation="Horizontal"
             Spacing="10" />
     </Grid>
-</Window>
\ No newline at end of file
+</Window>
diff --git a/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml b/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml
index 64b23f98..7e083606 100644
--- a/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml
+++ b/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml
@@ -4,7 +4,9 @@
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:views="using:Ryujinx.Ava.UI.Controls"
     Width="400"
+    x:DataType="views:SwkbdAppletDialog"
     mc:Ignorable="d"
     Focusable="True">
     <Grid
@@ -34,13 +36,13 @@
             Grid.Row="1"
             Grid.Column="1"
             Margin="5"
-            Text="{ReflectionBinding MainText}"
+            Text="{Binding MainText}"
             TextWrapping="Wrap" />
         <TextBlock
             Grid.Row="2"
             Grid.Column="1"
             Margin="5"
-            Text="{ReflectionBinding SecondaryText}"
+            Text="{Binding SecondaryText}"
             TextWrapping="Wrap" />
         <TextBox
             Name="Input"
@@ -50,7 +52,7 @@
             VerticalAlignment="Center"
             Focusable="True"
             KeyUp="Message_KeyUp"
-            Text="{ReflectionBinding Message}"
+            Text="{Binding Message}"
             TextInput="Message_TextInput"
             TextWrapping="Wrap"
             UseFloatingWatermark="True" />
diff --git a/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml b/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml
index 214fc075..bbdb4c4a 100644
--- a/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml
+++ b/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml
@@ -46,7 +46,7 @@
                     <Setter Property="CornerRadius" Value="4" />
                 </Style>
                 <Style Selector="ListBoxItem:selected /template/ Rectangle#SelectionIndicator">
-                    <Setter Property="MinHeight" Value="{ReflectionBinding $parent[UserControl].DataContext.GridItemSelectorSize}" />
+                    <Setter Property="MinHeight" Value="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).GridItemSelectorSize}" />
                 </Style>
             </ListBox.Styles>
             <ListBox.ItemTemplate>
@@ -56,10 +56,10 @@
                             Margin="10"
                             HorizontalAlignment="Stretch"
                             VerticalAlignment="Stretch"
-                            Classes.huge="{ReflectionBinding $parent[UserControl].DataContext.IsGridHuge}"
-                            Classes.large="{ReflectionBinding $parent[UserControl].DataContext.IsGridLarge}"
-                            Classes.normal="{ReflectionBinding $parent[UserControl].DataContext.IsGridMedium}"
-                            Classes.small="{ReflectionBinding $parent[UserControl].DataContext.IsGridSmall}"
+                            Classes.huge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridHuge}"
+                            Classes.large="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}"
+                            Classes.normal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}"
+                            Classes.small="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}"
                             ClipToBounds="True"
                             CornerRadius="4">
                             <Grid>
@@ -78,7 +78,7 @@
                                     Margin="0,10,0,0"
                                     HorizontalAlignment="Stretch"
                                     VerticalAlignment="Stretch"
-                                    IsVisible="{ReflectionBinding $parent[UserControl].DataContext.ShowNames}">
+                                    IsVisible="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).ShowNames}">
                                     <TextBlock
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
@@ -101,4 +101,4 @@
             </ListBox.ItemTemplate>
         </ListBox>
     </Grid>
-</UserControl>
\ No newline at end of file
+</UserControl>
diff --git a/src/Ryujinx.Ava/UI/Controls/ApplicationListView.axaml b/src/Ryujinx.Ava/UI/Controls/ApplicationListView.axaml
index 75bbf9d0..09011005 100644
--- a/src/Ryujinx.Ava/UI/Controls/ApplicationListView.axaml
+++ b/src/Ryujinx.Ava/UI/Controls/ApplicationListView.axaml
@@ -42,7 +42,7 @@
             </ListBox.ItemsPanel>
             <ListBox.Styles>
                 <Style Selector="ListBoxItem:selected /template/ Rectangle#SelectionIndicator">
-                    <Setter Property="MinHeight" Value="{ReflectionBinding $parent[UserControl].DataContext.ListItemSelectorSize}" />
+                    <Setter Property="MinHeight" Value="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).ListItemSelectorSize}" />
                 </Style>
             </ListBox.Styles>
             <ListBox.ItemTemplate>
@@ -67,10 +67,10 @@
                                     Grid.RowSpan="3"
                                     Grid.Column="0"
                                     Margin="0"
-                                    Classes.huge="{ReflectionBinding $parent[UserControl].DataContext.IsGridHuge}"
-                                    Classes.large="{ReflectionBinding $parent[UserControl].DataContext.IsGridLarge}"
-                                    Classes.normal="{ReflectionBinding $parent[UserControl].DataContext.IsGridMedium}"
-                                    Classes.small="{ReflectionBinding $parent[UserControl].DataContext.IsGridSmall}"
+                                    Classes.huge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridHuge}"
+                                    Classes.large="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}"
+                                    Classes.normal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}"
+                                    Classes.small="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}"
                                     Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
                                 <Border
                                     Grid.Column="2"
@@ -157,4 +157,4 @@
             </ListBox.ItemTemplate>
         </ListBox>
     </Grid>
-</UserControl>
\ No newline at end of file
+</UserControl>
diff --git a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml
index b9cbcb9c..8a5da5cc 100644
--- a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml
+++ b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml
@@ -11,6 +11,7 @@
     Height="500"
     MinWidth="500"
     MinHeight="500"
+    x:DataType="window:CheatWindow"
     WindowStartupLocation="CenterOwner"
     mc:Ignorable="d"
     Focusable="True">
@@ -40,7 +41,7 @@
             HorizontalAlignment="Center"
             VerticalAlignment="Center"
             LineHeight="18"
-            Text="{ReflectionBinding Heading}"
+            Text="{Binding Heading}"
             TextAlignment="Center"
             TextWrapping="Wrap" />
         <TextBlock
@@ -61,7 +62,7 @@
             MinWidth="160"
             HorizontalAlignment="Center"
             VerticalAlignment="Center"
-            Text="{ReflectionBinding BuildId}"
+            Text="{Binding BuildId}"
             IsReadOnly="True" />
         <Border
             Grid.Row="3"
@@ -77,7 +78,7 @@
                 MinHeight="300"
                 HorizontalAlignment="Stretch"
                 VerticalAlignment="Stretch"
-                ItemsSource="{ReflectionBinding LoadedCheats}">
+                ItemsSource="{Binding LoadedCheats}">
                 <TreeView.Styles>
                     <Styles>
                         <Style Selector="TreeViewItem:empty /template/ ItemsPresenter">
@@ -120,18 +121,18 @@
                     Name="SaveButton"
                     MinWidth="90"
                     Margin="5"
-                    Command="{ReflectionBinding Save}"
-                    IsVisible="{ReflectionBinding !NoCheatsFound}">
+                    Command="{Binding Save}"
+                    IsVisible="{Binding !NoCheatsFound}">
                     <TextBlock Text="{locale:Locale SettingsButtonSave}" />
                 </Button>
                 <Button
                     Name="CancelButton"
                     MinWidth="90"
                     Margin="5"
-                    Command="{ReflectionBinding Close}">
+                    Command="{Binding Close}">
                     <TextBlock Text="{locale:Locale InputDialogCancel}" />
                 </Button>
             </DockPanel>
         </DockPanel>
     </Grid>
-</window:StyleableWindow>
\ No newline at end of file
+</window:StyleableWindow>
diff --git a/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml
index 1f57f34c..99cf28e7 100644
--- a/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml
+++ b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml
@@ -39,14 +39,14 @@
                         Name="EnableAllButton"
                         MinWidth="90"
                         Margin="5"
-                        Command="{ReflectionBinding EnableAll}">
+                        Command="{Binding EnableAll}">
                         <TextBlock Text="{locale:Locale DlcManagerEnableAllButton}" />
                     </Button>
                     <Button
                         Name="DisableAllButton"
                         MinWidth="90"
                         Margin="5"
-                        Command="{ReflectionBinding DisableAll}">
+                        Command="{Binding DisableAll}">
                         <TextBlock Text="{locale:Locale DlcManagerDisableAllButton}" />
                     </Button>
                 </StackPanel>
@@ -157,14 +157,14 @@
                     Name="AddButton"
                     MinWidth="90"
                     Margin="5"
-                    Command="{ReflectionBinding Add}">
+                    Command="{Binding Add}">
                     <TextBlock Text="{locale:Locale SettingsTabGeneralAdd}" />
                 </Button>
                 <Button
                     Name="RemoveAllButton"
                     MinWidth="90"
                     Margin="5"
-                    Command="{ReflectionBinding RemoveAll}">
+                    Command="{Binding RemoveAll}">
                     <TextBlock Text="{locale:Locale DlcManagerRemoveAllButton}" />
                 </Button>
             </StackPanel>
@@ -189,4 +189,4 @@
             </StackPanel>
         </Panel>
     </Grid>
-</UserControl>
\ No newline at end of file
+</UserControl>
-- 
cgit v1.2.3-70-g09d2