Skip to content

Commit ca5f72e

Browse files
committed
Use compile-time bindings in Avalonia
1 parent d92a1e9 commit ca5f72e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

YoutubeExplode.Demo.Gui/Views/MainWindow.axaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Title="YoutubeExplode Demo"
1111
Width="720"
1212
Height="620"
13+
x:DataType="viewModels:MainViewModel"
1314
Icon="/favicon.ico"
1415
Loaded="Window_OnLoaded"
1516
WindowStartupLocation="CenterScreen">
@@ -251,7 +252,7 @@
251252
<Button
252253
Padding="4"
253254
VerticalAlignment="Center"
254-
Command="{Binding $parent[Window].DataContext.DownloadStreamCommand}"
255+
Command="{Binding $parent[Window].((viewModels:MainViewModel)DataContext).DownloadStreamCommand}"
255256
CommandParameter="{Binding}"
256257
Theme="{DynamicResource MaterialFlatButton}">
257258
<materialIcons:MaterialIcon
@@ -292,7 +293,7 @@
292293
<Button
293294
Padding="4"
294295
VerticalAlignment="Center"
295-
Command="{Binding $parent[Window].DataContext.DownloadStreamCommand}"
296+
Command="{Binding $parent[Window].((viewModels:MainViewModel)DataContext).DownloadStreamCommand}"
296297
CommandParameter="{Binding}"
297298
Theme="{DynamicResource MaterialFlatButton}">
298299
<materialIcons:MaterialIcon
@@ -333,7 +334,7 @@
333334
<Button
334335
Padding="4"
335336
VerticalAlignment="Center"
336-
Command="{Binding $parent[Window].DataContext.DownloadStreamCommand}"
337+
Command="{Binding $parent[Window].((viewModels:MainViewModel)DataContext).DownloadStreamCommand}"
337338
CommandParameter="{Binding}"
338339
Theme="{DynamicResource MaterialFlatButton}">
339340
<materialIcons:MaterialIcon
@@ -384,7 +385,7 @@
384385
<Button
385386
Padding="4"
386387
VerticalAlignment="Center"
387-
Command="{Binding $parent[Window].DataContext.DownloadClosedCaptionTrackCommand}"
388+
Command="{Binding $parent[Window].((viewModels:MainViewModel)DataContext).DownloadClosedCaptionTrackCommand}"
388389
CommandParameter="{Binding}"
389390
Theme="{DynamicResource MaterialFlatButton}">
390391
<materialIcons:MaterialIcon

YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<ApplicationIcon>..\favicon.ico</ApplicationIcon>
88
</PropertyGroup>
99

10+
<!-- Avalonia-related settings -->
11+
<PropertyGroup>
12+
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
13+
</PropertyGroup>
14+
1015
<ItemGroup>
1116
<AvaloniaResource Include="..\favicon.ico" Link="favicon.ico" />
1217
</ItemGroup>

0 commit comments

Comments
 (0)