Skip to content

Commit eafafd5

Browse files
committed
Remove Segmented control due to crash
1 parent 6710300 commit eafafd5

File tree

4 files changed

+76
-58
lines changed

4 files changed

+76
-58
lines changed

src/Lively/Lively.UI.WinUI/Lively.UI.WinUI.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.0.240109" />
127127
<PackageReference Include="CommunityToolkit.WinUI.Collections" Version="8.0.240109" />
128128
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.240109" />
129-
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.240109" />
129+
<!--<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.240109" />-->
130130
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
131131
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.0.240109" />
132132
<PackageReference Include="CommunityToolkit.WinUI.Helpers" Version="8.0.240109" />

src/Lively/Lively.UI.WinUI/Views/Pages/ControlPanel/ScreensaverLayoutView.xaml

+21-14
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,24 @@
5151
<Button IsEnabled="{Binding IsScreensaverLayout, Mode=OneWay}">
5252
<Button.Flyout>
5353
<Flyout>
54-
<controls:Segmented SelectedIndex="{Binding SelectedScreensaverArrangementIndex, Mode=TwoWay}">
55-
<controls:SegmentedItem>
54+
<Grid CornerRadius="5">
55+
<ListBox
56+
Padding="-2.5"
57+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
58+
SelectedIndex="{Binding SelectedScreensaverArrangementIndex, Mode=TwoWay}">
5659
<TextBlock>
5760
<Run x:Uid="WallpaperLayoutPerScreen" />
5861
<Run Foreground="{ThemeResource SystemAccentColorLight2}" Text="{Binding SelectedItem.Screen.Index, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter='({0})'}" />
5962
</TextBlock>
60-
</controls:SegmentedItem>
61-
<controls:SegmentedItem>
6263
<TextBlock x:Uid="WallpaperLayoutSpan" />
63-
</controls:SegmentedItem>
64-
<controls:SegmentedItem>
6564
<TextBlock x:Uid="WallpaperLayoutDuplicate" />
66-
</controls:SegmentedItem>
67-
</controls:Segmented>
65+
<ListBox.ItemsPanel>
66+
<ItemsPanelTemplate>
67+
<VirtualizingStackPanel Orientation="Horizontal" />
68+
</ItemsPanelTemplate>
69+
</ListBox.ItemsPanel>
70+
</ListBox>
71+
</Grid>
6872
</Flyout>
6973
</Button.Flyout>
7074
<FontIcon FontSize="16" Glyph="&#xE7F4;" />
@@ -141,14 +145,17 @@
141145
</controls:SettingsExpander.HeaderIcon>
142146
<controls:SettingsExpander.Items>
143147
<controls:SettingsCard ContentAlignment="Left">
144-
<controls:Segmented SelectedIndex="{Binding SelectedScreensaverTypeIndex, Mode=TwoWay}">
145-
<controls:SegmentedItem>
148+
<Grid CornerRadius="5">
149+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedScreensaverTypeIndex, Mode=TwoWay}">
146150
<TextBlock x:Uid="ScreensaverModeSameWallpaper" />
147-
</controls:SegmentedItem>
148-
<controls:SegmentedItem>
149151
<TextBlock x:Uid="ScreensaverModeDifferentWallpaper" />
150-
</controls:SegmentedItem>
151-
</controls:Segmented>
152+
<ListBox.ItemsPanel>
153+
<ItemsPanelTemplate>
154+
<VirtualizingStackPanel Orientation="Horizontal" />
155+
</ItemsPanelTemplate>
156+
</ListBox.ItemsPanel>
157+
</ListBox>
158+
</Grid>
152159
</controls:SettingsCard>
153160
<controls:SettingsCard ContentAlignment="Left">
154161
<CheckBox x:Uid="ScreensaverLockOnResume" IsChecked="{Binding IsScreensaverLockOnResume, Mode=TwoWay}" />

src/Lively/Lively.UI.WinUI/Views/Pages/ControlPanel/WallpaperLayoutView.xaml

+9-8
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,21 @@
6464
</controls:SettingsExpander.HeaderIcon>
6565
<controls:SettingsExpander.Items>
6666
<controls:SettingsCard ContentAlignment="Left">
67-
<controls:Segmented SelectedIndex="{Binding SelectedWallpaperLayoutIndex, Mode=TwoWay}">
68-
<controls:SegmentedItem>
67+
<Grid CornerRadius="5">
68+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedWallpaperLayoutIndex, Mode=TwoWay}">
6969
<TextBlock>
7070
<Run x:Uid="WallpaperLayoutPerScreen" />
7171
<Run Foreground="{ThemeResource SystemAccentColorLight2}" Text="{Binding SelectedItem.Screen.Index, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter='({0})'}" />
7272
</TextBlock>
73-
</controls:SegmentedItem>
74-
<controls:SegmentedItem>
7573
<TextBlock x:Uid="WallpaperLayoutSpan" />
76-
</controls:SegmentedItem>
77-
<controls:SegmentedItem>
7874
<TextBlock x:Uid="WallpaperLayoutDuplicate" />
79-
</controls:SegmentedItem>
80-
</controls:Segmented>
75+
<ListBox.ItemsPanel>
76+
<ItemsPanelTemplate>
77+
<VirtualizingStackPanel Orientation="Horizontal" />
78+
</ItemsPanelTemplate>
79+
</ListBox.ItemsPanel>
80+
</ListBox>
81+
</Grid>
8182
</controls:SettingsCard>
8283
<controls:SettingsCard ContentAlignment="Left">
8384
<CheckBox x:Uid="WallpaperLayoutScreenPicker" IsChecked="{Binding IsRememberSelectedScreen, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" />

src/Lively/Lively.UI.WinUI/Views/Pages/Settings/SettingsPerformanceView.xaml

+45-35
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,34 @@
2222
<controls:SettingsCard.HeaderIcon>
2323
<FontIcon Glyph="&#xE90E;" />
2424
</controls:SettingsCard.HeaderIcon>
25-
<controls:Segmented SelectedIndex="{Binding SelectedAppFullScreenIndex, Mode=TwoWay}">
26-
<controls:SegmentedItem Width="120">
25+
<Grid CornerRadius="5">
26+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedAppFullScreenIndex, Mode=TwoWay}">
2727
<FontIcon FontSize="16" Glyph="&#xE769;" />
28-
</controls:SegmentedItem>
29-
<controls:SegmentedItem Width="120">
3028
<FontIcon FontSize="16" Glyph="&#xE768;" />
31-
</controls:SegmentedItem>
32-
<controls:SegmentedItem x:Uid="TextPerformanceKill" Visibility="Collapsed" />
33-
</controls:Segmented>
29+
<ListBox.ItemsPanel>
30+
<ItemsPanelTemplate>
31+
<VirtualizingStackPanel Orientation="Horizontal" />
32+
</ItemsPanelTemplate>
33+
</ListBox.ItemsPanel>
34+
</ListBox>
35+
</Grid>
3436
</controls:SettingsCard>
3537

3638
<controls:SettingsCard x:Uid="AppFocus">
3739
<controls:SettingsCard.HeaderIcon>
3840
<FontIcon Glyph="&#xE90C;" />
3941
</controls:SettingsCard.HeaderIcon>
40-
<controls:Segmented SelectedIndex="{Binding SelectedAppFocusIndex, Mode=TwoWay}">
41-
<controls:SegmentedItem Width="120">
42+
<Grid CornerRadius="5">
43+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedAppFocusIndex, Mode=TwoWay}">
4244
<FontIcon FontSize="16" Glyph="&#xE769;" />
43-
</controls:SegmentedItem>
44-
<controls:SegmentedItem Width="120">
4545
<FontIcon FontSize="16" Glyph="&#xE768;" />
46-
</controls:SegmentedItem>
47-
<controls:SegmentedItem x:Uid="TextPerformanceKill" Visibility="Collapsed" />
48-
</controls:Segmented>
46+
<ListBox.ItemsPanel>
47+
<ItemsPanelTemplate>
48+
<VirtualizingStackPanel Orientation="Horizontal" />
49+
</ItemsPanelTemplate>
50+
</ListBox.ItemsPanel>
51+
</ListBox>
52+
</Grid>
4953
</controls:SettingsCard>
5054
</StackPanel>
5155

@@ -59,30 +63,34 @@
5963
<controls:SettingsCard.HeaderIcon>
6064
<FontIcon Glyph="&#xE856;" />
6165
</controls:SettingsCard.HeaderIcon>
62-
<controls:Segmented SelectedIndex="{Binding SelectedBatteryPowerIndex, Mode=TwoWay}">
63-
<controls:SegmentedItem Width="120">
66+
<Grid CornerRadius="5">
67+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedBatteryPowerIndex, Mode=TwoWay}">
6468
<FontIcon FontSize="16" Glyph="&#xE769;" />
65-
</controls:SegmentedItem>
66-
<controls:SegmentedItem Width="120">
6769
<FontIcon FontSize="16" Glyph="&#xE768;" />
68-
</controls:SegmentedItem>
69-
<controls:SegmentedItem x:Uid="TextPerformanceKill" Visibility="Collapsed" />
70-
</controls:Segmented>
70+
<ListBox.ItemsPanel>
71+
<ItemsPanelTemplate>
72+
<VirtualizingStackPanel Orientation="Horizontal" />
73+
</ItemsPanelTemplate>
74+
</ListBox.ItemsPanel>
75+
</ListBox>
76+
</Grid>
7177
</controls:SettingsCard>
7278

7379
<controls:SettingsCard x:Uid="PowerSavingModePower">
7480
<controls:SettingsCard.HeaderIcon>
7581
<FontIcon Glyph="&#xE863;" />
7682
</controls:SettingsCard.HeaderIcon>
77-
<controls:Segmented SelectedIndex="{Binding SelectedPowerSaveModeIndex, Mode=TwoWay}">
78-
<controls:SegmentedItem Width="120">
83+
<Grid CornerRadius="5">
84+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedPowerSaveModeIndex, Mode=TwoWay}">
7985
<FontIcon FontSize="16" Glyph="&#xE769;" />
80-
</controls:SegmentedItem>
81-
<controls:SegmentedItem Width="120">
8286
<FontIcon FontSize="16" Glyph="&#xE768;" />
83-
</controls:SegmentedItem>
84-
<controls:SegmentedItem x:Uid="TextPerformanceKill" Visibility="Collapsed" />
85-
</controls:Segmented>
87+
<ListBox.ItemsPanel>
88+
<ItemsPanelTemplate>
89+
<VirtualizingStackPanel Orientation="Horizontal" />
90+
</ItemsPanelTemplate>
91+
</ListBox.ItemsPanel>
92+
</ListBox>
93+
</Grid>
8694
</controls:SettingsCard>
8795
</StackPanel>
8896

@@ -96,15 +104,17 @@
96104
<controls:SettingsCard.HeaderIcon>
97105
<FontIcon Glyph="&#xE703;" />
98106
</controls:SettingsCard.HeaderIcon>
99-
<controls:Segmented SelectedIndex="{Binding SelectedRemoteDestopPowerIndex, Mode=TwoWay}">
100-
<controls:SegmentedItem Width="120">
107+
<Grid CornerRadius="5">
108+
<ListBox Padding="-2.5" SelectedIndex="{Binding SelectedRemoteDestopPowerIndex, Mode=TwoWay}">
101109
<FontIcon FontSize="16" Glyph="&#xE769;" />
102-
</controls:SegmentedItem>
103-
<controls:SegmentedItem Width="120">
104110
<FontIcon FontSize="16" Glyph="&#xE768;" />
105-
</controls:SegmentedItem>
106-
<controls:SegmentedItem x:Uid="TextPerformanceKill" Visibility="Collapsed" />
107-
</controls:Segmented>
111+
<ListBox.ItemsPanel>
112+
<ItemsPanelTemplate>
113+
<VirtualizingStackPanel Orientation="Horizontal" />
114+
</ItemsPanelTemplate>
115+
</ListBox.ItemsPanel>
116+
</ListBox>
117+
</Grid>
108118
</controls:SettingsCard>
109119

110120
<controls:SettingsCard x:Uid="DisplayPauseRule">

0 commit comments

Comments
 (0)