Skip to content

Commit 1257234

Browse files
committed
fix: binding errors in xaml
1 parent b74bd99 commit 1257234

10 files changed

+38
-39
lines changed

src/Resources/Styles.axaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362
HorizontalAlignment="Center"
363363
VerticalAlignment="Center"
364364
Width="12"
365-
Fill="{Binding $parent.Foreground}"/>
365+
Fill="{DynamicResource Brush.FG1}"/>
366366
</ToggleButton>
367367
<ToggleButton Theme="{StaticResource SearchPanelTextBoxButton}"
368368
IsChecked="{Binding $parent[aes:SearchPanel].WholeWords, Mode=TwoWay}"
@@ -374,7 +374,7 @@
374374
HorizontalAlignment="Center"
375375
VerticalAlignment="Center"
376376
Width="14"
377-
Fill="{Binding $parent.Foreground}"/>
377+
Fill="{DynamicResource Brush.FG1}"/>
378378
</ToggleButton>
379379
<ToggleButton Theme="{StaticResource SearchPanelTextBoxButton}"
380380
IsChecked="{Binding $parent[aes:SearchPanel].UseRegex, Mode=TwoWay}"
@@ -386,7 +386,7 @@
386386
HorizontalAlignment="Center"
387387
VerticalAlignment="Center"
388388
Width="12"
389-
Fill="{Binding $parent.Foreground}"/>
389+
Fill="{DynamicResource Brush.FG1}"/>
390390
</ToggleButton>
391391
</StackPanel>
392392
</TextBox.InnerRightContent>

src/Views/ChangeCollectionView.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace SourceGit.Views
1111
public partial class ChangeCollectionView : UserControl
1212
{
1313
public static readonly StyledProperty<bool> IsWorkingCopyChangeProperty =
14-
AvaloniaProperty.Register<ChangeCollectionView, bool>(nameof(IsWorkingCopy), false);
14+
AvaloniaProperty.Register<ChangeCollectionView, bool>(nameof(IsWorkingCopyChange), false);
1515

16-
public bool IsWorkingCopy
16+
public bool IsWorkingCopyChange
1717
{
1818
get => GetValue(IsWorkingCopyChangeProperty);
1919
set => SetValue(IsWorkingCopyChangeProperty, value);

src/Views/Clone.axaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:m="using:SourceGit.Models"
65
xmlns:vm="using:SourceGit.ViewModels"
76
xmlns:v="using:SourceGit.Views"
87
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@@ -11,14 +10,14 @@
1110
<StackPanel Orientation="Vertical" Margin="8,0,0,0">
1211
<TextBlock Classes="bold" FontSize="18" Text="{DynamicResource Text.Clone}"/>
1312

14-
<Grid Margin="8,16,0,0" Height="28" ColumnDefinitions="120,*">
13+
<Grid Margin="8,16,0,0" Height="28" ColumnDefinitions="140,*">
1514
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.RemoteURL}"/>
1615
<TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Remote, Mode=TwoWay}" v:AutoFocusBehaviour.IsEnabled="True"/>
1716
</Grid>
18-
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="120,*" IsVisible="{Binding UseSSH}">
17+
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*" IsVisible="{Binding UseSSH}">
1918
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.SSHKey}"/>
2019
<TextBox Grid.Column="1"
21-
x:Name="txtSSHKey"
20+
x:Name="TxtSshKey"
2221
Height="28"
2322
CornerRadius="3"
2423
Watermark="{DynamicResource Text.SSHKey.Placeholder}"
@@ -30,10 +29,10 @@
3029
</TextBox.InnerRightContent>
3130
</TextBox>
3231
</Grid>
33-
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="120,*">
32+
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*">
3433
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.ParentFolder}"/>
3534
<TextBox Grid.Column="1"
36-
x:Name="txtParentFolder"
35+
x:Name="TxtParentFolder"
3736
Height="28"
3837
CornerRadius="3"
3938
Text="{Binding ParentFolder, Mode=TwoWay}">
@@ -44,11 +43,11 @@
4443
</TextBox.InnerRightContent>
4544
</TextBox>
4645
</Grid>
47-
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="120,*">
46+
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*">
4847
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.LocalName}"/>
4948
<TextBox Grid.Column="1" CornerRadius="3" Watermark="{DynamicResource Text.Clone.LocalName.Placeholder}" Text="{Binding Local, Mode=TwoWay}"/>
5049
</Grid>
51-
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="120,*">
50+
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*">
5251
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.AdditionalParam}"/>
5352
<TextBox Grid.Column="1" CornerRadius="3" Watermark="{DynamicResource Text.Clone.AdditionalParam.Placeholder}" Text="{Binding ExtraArgs, Mode=TwoWay}"/>
5453
</Grid>

src/Views/Clone.axaml.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ private async void SelectParentFolder(object sender, RoutedEventArgs e)
1515
{
1616
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
1717
var toplevel = TopLevel.GetTopLevel(this);
18+
if (toplevel == null)
19+
return;
20+
1821
var selected = await toplevel.StorageProvider.OpenFolderPickerAsync(options);
1922
if (selected.Count == 1)
20-
{
21-
txtParentFolder.Text = selected[0].Path.LocalPath;
22-
}
23+
TxtParentFolder.Text = selected[0].Path.LocalPath;
2324

2425
e.Handled = true;
2526
}
@@ -28,11 +29,12 @@ private async void SelectSSHKey(object sender, RoutedEventArgs e)
2829
{
2930
var options = new FilePickerOpenOptions() { AllowMultiple = false, FileTypeFilter = [new FilePickerFileType("SSHKey") { Patterns = ["*.*"] }] };
3031
var toplevel = TopLevel.GetTopLevel(this);
32+
if (toplevel == null)
33+
return;
34+
3135
var selected = await toplevel.StorageProvider.OpenFilePickerAsync(options);
3236
if (selected.Count == 1)
33-
{
34-
txtSSHKey.Text = selected[0].Path.LocalPath;
35-
}
37+
TxtSshKey.Text = selected[0].Path.LocalPath;
3638

3739
e.Handled = true;
3840
}

src/Views/CommitChanges.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<!-- Changes -->
4848
<Border Grid.Row="1" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}">
49-
<v:ChangeCollectionView IsWorkingCopy="False"
49+
<v:ChangeCollectionView IsWorkingCopyChange="False"
5050
ViewMode="{Binding Source={x:Static vm:Preference.Instance}, Path=CommitChangeViewMode}"
5151
Changes="{Binding VisibleChanges}"
5252
SelectedChanges="{Binding SelectedChanges, Mode=TwoWay}"

src/Views/CommitDetail.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
Text="{DynamicResource Text.CommitDetail.Changes}"/>
3535

3636
<v:ChangeCollectionView Grid.Column="1"
37-
IsWorkingCopy="False"
37+
IsWorkingCopyChange="False"
3838
Margin="8,0,0,0"
3939
ViewMode="List"
4040
Changes="{Binding Changes}"

src/Views/Launcher.axaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@
121121
<Border.ContextMenu>
122122
<ContextMenu>
123123
<MenuItem Header="{DynamicResource Text.PageTabBar.Tab.Close}"
124-
Command="{Binding #me.DataContext.(vm:Launcher).CloseTab}"
124+
Command="{Binding #me.((vm:Launcher)DataContext).CloseTab}"
125125
CommandParameter="{Binding}"
126126
InputGesture="{OnPlatform Ctrl+W, macOS=⌘+W}"/>
127127
<MenuItem Header="{DynamicResource Text.PageTabBar.Tab.CloseOther}"
128-
Command="{Binding #me.DataContext.(vm:Launcher).CloseOtherTabs}"
128+
Command="{Binding #me.((vm:Launcher)DataContext).CloseOtherTabs}"
129129
CommandParameter="{Binding}"/>
130130
<MenuItem Header="{DynamicResource Text.PageTabBar.Tab.CloseRight}"
131-
Command="{Binding #me.DataContext.(vm:Launcher).CloseRightTabs}"
131+
Command="{Binding #me.((vm:Launcher)DataContext).CloseRightTabs}"
132132
CommandParameter="{Binding}"/>
133133
<MenuItem Header="-" IsVisible="{Binding Node.IsRepository}"/>
134134
<MenuItem IsVisible="{Binding Node.IsRepository}">
@@ -200,7 +200,7 @@
200200
<Button Grid.Column="2"
201201
Classes="icon_button"
202202
Width="16" Height="16" Margin="12,0"
203-
Command="{Binding #me.DataContext.(vm:Launcher).CloseTab}"
203+
Command="{Binding #me.((vm:Launcher)DataContext).CloseTab}"
204204
CommandParameter="{Binding}">
205205
<ToolTip.Tip>
206206
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
@@ -215,7 +215,7 @@
215215
<MultiBinding Converter="{x:Static c:LauncherPageConverters.ToTabSeperatorVisible}">
216216
<Binding/>
217217
<Binding Path="$parent[ListBox].SelectedItem"/>
218-
<Binding Path="#me.DataContext.(vm:Launcher).Pages"/>
218+
<Binding Path="#me.((vm:Launcher)DataContext).Pages"/>
219219
</MultiBinding>
220220
</Rectangle.IsVisible>
221221
</Rectangle>
@@ -285,8 +285,8 @@
285285
</Border.BorderThickness>
286286

287287
<Border.Effect>
288-
<OnPlatform>
289-
<On Options="Windows, macOS">
288+
<OnPlatform Default="{x:Null}">
289+
<On Options="macOS, Windows">
290290
<DropShadowEffect BlurRadius="8" OffsetX="0" OffsetY="0" Color="Black" Opacity=".5"/>
291291
</On>
292292
</OnPlatform>
@@ -356,11 +356,11 @@
356356
Margin="8" Padding="0"
357357
VerticalContentAlignment="Top"
358358
Text="{Binding Message}"/>
359-
<Button Grid.Row="3"
359+
<Button Grid.Row="2"
360360
Classes="flat primary"
361361
Height="30"
362362
Margin="4,0"
363-
Command="{Binding #me.DataContext.(vm:Launcher).ActivePage.DismissNotification}"
363+
Command="{Binding #me.((vm:Launcher)DataContext).ActivePage.DismissNotification}"
364364
CommandParameter="{Binding}"
365365
Content="{DynamicResource Text.Close}"
366366
HorizontalAlignment="Right"

src/Views/RevisionCompare.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103

104104
<!-- Changes -->
105105
<Border Grid.Row="1" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}">
106-
<v:ChangeCollectionView IsWorkingCopy="False"
106+
<v:ChangeCollectionView IsWorkingCopyChange="False"
107107
ViewMode="{Binding Source={x:Static vm:Preference.Instance}, Path=CommitChangeViewMode}"
108108
Changes="{Binding VisibleChanges}"
109109
SelectedChanges="{Binding SelectedChanges, Mode=TwoWay}"

src/Views/TextDiffView.axaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
xmlns:m="using:SourceGit.Models"
66
xmlns:vm="using:SourceGit.ViewModels"
77
xmlns:v="using:SourceGit.Views"
8-
xmlns:c="using:SourceGit.Converters"
98
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
109
x:Class="SourceGit.Views.TextDiffView"
1110
Background="{DynamicResource Brush.Contents}">
@@ -19,14 +18,14 @@
1918
SecondaryFG="{DynamicResource Brush.FG2}"
2019
FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}"
2120
DiffData="{Binding}"
22-
SyncScrollOffset="{Binding $parent[v:DiffView].DataContext.(vm:DiffContext).SyncScrollOffset, Mode=TwoWay}"
21+
SyncScrollOffset="{Binding $parent[v:DiffView].((vm:DiffContext)DataContext).SyncScrollOffset, Mode=TwoWay}"
2322
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting, Mode=TwoWay}"/>
2423
</DataTemplate>
2524

2625
<DataTemplate DataType="vm:TwoSideTextDiff">
2726
<Grid ColumnDefinitions="*,1,*">
2827
<v:SingleSideTextDiffPresenter Grid.Column="0"
29-
SyncScrollOffset="{Binding $parent[v:DiffView].DataContext.(vm:DiffContext).SyncScrollOffset, Mode=TwoWay}"
28+
SyncScrollOffset="{Binding $parent[v:DiffView].((vm:DiffContext)DataContext).SyncScrollOffset, Mode=TwoWay}"
3029
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting, Mode=TwoWay}"
3130
IsOld="True"
3231
HorizontalScrollBarVisibility="Auto"
@@ -41,7 +40,7 @@
4140
<Rectangle Grid.Column="1" Fill="{DynamicResource Brush.Border2}" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
4241

4342
<v:SingleSideTextDiffPresenter Grid.Column="2"
44-
SyncScrollOffset="{Binding $parent[v:DiffView].DataContext.(vm:DiffContext).SyncScrollOffset, Mode=TwoWay}"
43+
SyncScrollOffset="{Binding $parent[v:DiffView].((vm:DiffContext)DataContext).SyncScrollOffset, Mode=TwoWay}"
4544
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting, Mode=TwoWay}"
4645
IsOld="False"
4746
HorizontalScrollBarVisibility="Auto"

src/Views/WorkingCopy.axaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:m="using:SourceGit.Models"
65
xmlns:vm="using:SourceGit.ViewModels"
76
xmlns:v="using:SourceGit.Views"
87
xmlns:c="using:SourceGit.Converters"
@@ -38,7 +37,7 @@
3837
Classes="toggle_untracked"
3938
Width="26" Height="14"
4039
ToolTip.Tip="{DynamicResource Text.WorkingCopy.IncludeUntracked}"
41-
IsChecked="{Binding $parent[v:Repository].DataContext.(vm:Repository).IncludeUntracked, Mode=TwoWay}"/>
40+
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"/>
4241
<Button Grid.Column="7"
4342
Classes="icon_button"
4443
Width="26" Height="14"
@@ -65,7 +64,7 @@
6564

6665
<!-- Unstaged Changes -->
6766
<v:ChangeCollectionView Grid.Row="1"
68-
IsWorkingCopy="True"
67+
IsWorkingCopyChange="True"
6968
SingleSelect="False"
7069
Background="{DynamicResource Brush.Contents}"
7170
ViewMode="{Binding Source={x:Static vm:Preference.Instance}, Path=UnstagedChangeViewMode}"
@@ -99,7 +98,7 @@
9998

10099
<!-- Staged Changes -->
101100
<v:ChangeCollectionView Grid.Row="3"
102-
IsWorkingCopy="False"
101+
IsWorkingCopyChange="False"
103102
SingleSelect="False"
104103
Background="{DynamicResource Brush.Contents}"
105104
ViewMode="{Binding Source={x:Static vm:Preference.Instance}, Path=StagedChangeViewMode}"

0 commit comments

Comments
 (0)