This commit is contained in:
ltx 2025-09-23 16:05:56 +08:00
parent 47e10d2323
commit d7cdcbe411
7 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl" xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl"
Title="Home" Height="400" Width="800"> Title="Home" Height="400" Width="800">
<Grid> <Grid>
<local:CoverFlowControl x:Name="coverFlow" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<local:CoverFlowControl x:Name="coverFlow" HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="881" Loaded="coverFlow_Loaded"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -27,13 +27,13 @@ namespace Wpf_AiSportsMicrospace
string albumPath = Path.Combine(projectRoot, "Resources", "Img", "Album"); string albumPath = Path.Combine(projectRoot, "Resources", "Img", "Album");
// 转换为 Uri // 转换为 Uri
coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "1.jpg"))); coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "home_play.png")));
coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "2.jpg"))); coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "home_test.png")));
coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "3.jpg"))); coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "home_history.png")));
coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "4.jpg"))); //coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "4.jpg")));
coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "5.jpg"))); //coverFlow.Images.Add(new Uri(Path.Combine(albumPath, "5.jpg")));
// 默认选中第3 // 默认选中第2
coverFlow.SelectedIndex = 2; coverFlow.SelectedIndex = 2;
} }
} }

View File

@ -48,6 +48,8 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
public CoverFlowControl() public CoverFlowControl()
{ {
Console.WriteLine($"SelectedIndex: {SelectedIndex}");
InitializeComponent(); InitializeComponent();
DataContext = this; DataContext = this;
Loaded += (s, e) => UpdateLayoutWithAnimation(true); Loaded += (s, e) => UpdateLayoutWithAnimation(true);

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 KiB