-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainView.axaml
More file actions
106 lines (96 loc) · 5.33 KB
/
Copy pathMainView.axaml
File metadata and controls
106 lines (96 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:OpenIPC.Viewer.App.ViewModels"
xmlns:views="using:OpenIPC.Viewer.App.Views"
xmlns:svc="using:OpenIPC.Viewer.App.Services"
x:Class="OpenIPC.Viewer.App.Views.MainView"
x:Name="Root"
x:DataType="vm:MainWindowViewModel"
Background="{StaticResource Bg1Brush}"
FontFamily="{StaticResource FontSans}"
FontSize="{StaticResource FontSizeBase}"
Foreground="{StaticResource TextPrimaryBrush}">
<!--
Responsive layout. The split happens at 700px:
wide → desktop sidebar on the left, content fills the rest
narrow → bottom-nav under the content (mobile / pinned-narrow window)
IsWideLayout is updated by code-behind on every SizeChanged.
CurrentPage is hosted in a SINGLE ContentControl shared by both layouts.
Hosting it twice (one ContentControl per layout) made the same page VM bind
to two views at once — both fired Loaded and double-activated the live
session (double Acquire + "Already started"). Only the chrome toggles on the
breakpoint now: the sidebar collapses to zero width and the bottom nav hides.
-->
<Grid ColumnDefinitions="Auto,*">
<!-- Desktop sidebar — fixed 200px wide; collapses to nothing when narrow. -->
<Border Grid.Column="0"
Width="200"
IsVisible="{Binding #Root.IsWideLayout}"
Background="{StaticResource Bg2Brush}"
BorderBrush="{StaticResource BorderWeakBrush}"
BorderThickness="0,0,1,0">
<DockPanel LastChildFill="True" Margin="12">
<TextBlock DockPanel.Dock="Top"
Text="OpenIPC Viewer"
FontSize="{StaticResource FontSizeMd}"
FontWeight="SemiBold"
Foreground="{StaticResource TextPrimaryBrush}"
Margin="8,8,8,20" />
<StackPanel Spacing="2" VerticalAlignment="Top">
<RadioButton Classes="sidebar" GroupName="DesktopNav"
IsChecked="{Binding IsLiveSelected, Mode=OneWay}"
Command="{Binding NavigateCommand}"
CommandParameter="live">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Data="{StaticResource IconLive}" Width="16" Height="16" />
<TextBlock Text="{Binding [Nav.Live], Source={x:Static svc:Localizer.Instance}}" VerticalAlignment="Center" />
</StackPanel>
</RadioButton>
<RadioButton Classes="sidebar" GroupName="DesktopNav"
IsChecked="{Binding IsLibrarySelected, Mode=OneWay}"
Command="{Binding NavigateCommand}"
CommandParameter="library">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Data="{StaticResource IconLibrary}" Width="16" Height="16" />
<TextBlock Text="{Binding [Nav.Library], Source={x:Static svc:Localizer.Instance}}" VerticalAlignment="Center" />
</StackPanel>
</RadioButton>
<RadioButton Classes="sidebar" GroupName="DesktopNav"
IsChecked="{Binding IsRecordingsSelected, Mode=OneWay}"
Command="{Binding NavigateCommand}"
CommandParameter="recordings">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Data="{StaticResource IconRecordings}" Width="16" Height="16" />
<TextBlock Text="{Binding [Nav.Recordings], Source={x:Static svc:Localizer.Instance}}" VerticalAlignment="Center" />
</StackPanel>
</RadioButton>
<RadioButton Classes="sidebar" GroupName="DesktopNav"
IsChecked="{Binding IsEventsSelected, Mode=OneWay}"
Command="{Binding NavigateCommand}"
CommandParameter="events">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Data="{StaticResource IconEvents}" Width="16" Height="16" />
<TextBlock Text="{Binding [Nav.Events], Source={x:Static svc:Localizer.Instance}}" VerticalAlignment="Center" />
</StackPanel>
</RadioButton>
<RadioButton Classes="sidebar" GroupName="DesktopNav"
IsChecked="{Binding IsSettingsSelected, Mode=OneWay}"
Command="{Binding NavigateCommand}"
CommandParameter="settings">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Data="{StaticResource IconSettings}" Width="16" Height="16" />
<TextBlock Text="{Binding [Nav.Settings], Source={x:Static svc:Localizer.Instance}}" VerticalAlignment="Center" />
</StackPanel>
</RadioButton>
</StackPanel>
</DockPanel>
</Border>
<!-- Content host + bottom nav (narrow only). One ContentControl, period. -->
<DockPanel Grid.Column="1" LastChildFill="True">
<views:BottomNavBar DockPanel.Dock="Bottom"
IsVisible="{Binding #Root.IsNarrowLayout}" />
<ContentControl Content="{Binding CurrentPage}"
Padding="{Binding #Root.ContentPadding}" />
</DockPanel>
</Grid>
</UserControl>