Skip to content

Commit 2647b2d

Browse files
committed
ux: use Border instead of ContentControl
Signed-off-by: leo <longshuang@msn.cn>
1 parent 5706b70 commit 2647b2d

2 files changed

Lines changed: 20 additions & 31 deletions

File tree

‎src/Views/Repository.axaml‎

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -906,38 +906,27 @@
906906
</Border>
907907

908908
<Grid Grid.Row="3">
909-
<ContentControl Content="{Binding Histories, Mode=OneWay}" IsVisible="{Binding IsHistoriesVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
910-
<ContentControl.DataTemplates>
911-
<DataTemplate DataType="vm:Histories">
912-
<v:Histories CurrentBranch="{Binding CurrentBranch, Mode=OneWay}"
913-
Bisect="{Binding Bisect, Mode=OneWay}"
914-
IssueTrackers="{Binding IssueTrackers, Mode=OneWay}">
915-
<v:Histories.IsDetailsPanelExpanded>
916-
<MultiBinding Converter="{x:Static BoolConverters.Or}">
917-
<Binding Source="{x:Static vm:Preferences.Instance}" Path="UseTwoColumnsLayoutInHistories" Mode="OneWay"/>
918-
<Binding Path="IsCollapseDetails" Converter="{x:Static BoolConverters.Not}" Mode="OneWay"/>
919-
</MultiBinding>
920-
</v:Histories.IsDetailsPanelExpanded>
921-
</v:Histories>
922-
</DataTemplate>
923-
</ContentControl.DataTemplates>
924-
</ContentControl>
909+
<Border IsVisible="{Binding IsHistoriesVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
910+
<v:Histories DataContext="{Binding Histories, Mode=OneWay}"
911+
CurrentBranch="{Binding CurrentBranch, Mode=OneWay}"
912+
Bisect="{Binding Bisect, Mode=OneWay}"
913+
IssueTrackers="{Binding IssueTrackers, Mode=OneWay}">
914+
<v:Histories.IsDetailsPanelExpanded>
915+
<MultiBinding Converter="{x:Static BoolConverters.Or}">
916+
<Binding Source="{x:Static vm:Preferences.Instance}" Path="UseTwoColumnsLayoutInHistories" Mode="OneWay"/>
917+
<Binding Path="IsCollapseDetails" Converter="{x:Static BoolConverters.Not}" Mode="OneWay"/>
918+
</MultiBinding>
919+
</v:Histories.IsDetailsPanelExpanded>
920+
</v:Histories>
921+
</Border>
925922

926-
<ContentControl Content="{Binding WorkingCopy, Mode=OneWay}" IsVisible="{Binding IsWorkingCopyVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
927-
<ContentControl.DataTemplates>
928-
<DataTemplate DataType="vm:WorkingCopy">
929-
<v:WorkingCopy/>
930-
</DataTemplate>
931-
</ContentControl.DataTemplates>
932-
</ContentControl>
923+
<Border IsVisible="{Binding IsWorkingCopyVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
924+
<v:WorkingCopy DataContext="{Binding WorkingCopy, Mode=OneWay}"/>
925+
</Border>
933926

934-
<ContentControl Content="{Binding StashesPage, Mode=OneWay}" IsVisible="{Binding IsStashesVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
935-
<ContentControl.DataTemplates>
936-
<DataTemplate DataType="vm:StashesPage">
937-
<v:StashesPage/>
938-
</DataTemplate>
939-
</ContentControl.DataTemplates>
940-
</ContentControl>
927+
<Border IsVisible="{Binding IsStashesVisible, Mode=OneWay}" PropertyChanged="OnRightPagePropertyChanged">
928+
<v:StashesPage DataContext="{Binding StashesPage, Mode=OneWay}"/>
929+
</Border>
941930
</Grid>
942931
</Grid>
943932

‎src/Views/Repository.axaml.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ private async void OnBisectCommand(object sender, RoutedEventArgs e)
668668

669669
private void OnRightPagePropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
670670
{
671-
if (e.Property == ContentControl.IsVisibleProperty && sender is ContentControl page)
671+
if (e.Property == Border.IsVisibleProperty && sender is Border page)
672672
{
673673
var diffViewer = page.FindDescendantOfType<DiffView>();
674674
diffViewer?.ToggleHotkeyBindings(page.IsVisible);

0 commit comments

Comments
 (0)