New startup window.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<UserControl
|
||||
x:Class="Wino.Mail.WinUI.Controls.UpdateNotesFlipViewControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="using:Wino.Core.Domain.Models.Updates"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid RowSpacing="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<FlipView
|
||||
x:Name="UpdateFlipView"
|
||||
ItemsSource="{x:Bind Sections, Mode=OneWay}"
|
||||
SelectionChanged="OnFlipViewSelectionChanged">
|
||||
<FlipView.ItemTemplate>
|
||||
<DataTemplate x:DataType="models:UpdateNoteSection">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Padding="8" Spacing="12">
|
||||
<controls:MarkdownTextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Text="{x:Bind Title, Mode=OneTime}" />
|
||||
<Image
|
||||
Width="{x:Bind ActualImageWidth, Mode=OneTime}"
|
||||
Height="{x:Bind ActualImageHeight, Mode=OneTime}"
|
||||
HorizontalAlignment="Center"
|
||||
Source="{x:Bind ImageUrl, Mode=OneTime}"
|
||||
Stretch="Uniform" />
|
||||
<controls:MarkdownTextBlock
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{x:Bind Description, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</DataTemplate>
|
||||
</FlipView.ItemTemplate>
|
||||
</FlipView>
|
||||
|
||||
<PipsPager
|
||||
x:Name="FlipViewPager"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
SelectedPageIndex="0"
|
||||
SelectedIndexChanged="OnPipsPagerSelectedIndexChanged" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Mail.WinUI.Controls;
|
||||
|
||||
public sealed partial class UpdateNotesFlipViewControl : UserControl
|
||||
{
|
||||
public event EventHandler<int>? SelectedIndexChanged;
|
||||
|
||||
public int SelectedIndex => UpdateFlipView.SelectedIndex;
|
||||
|
||||
public IList<UpdateNoteSection>? Sections
|
||||
{
|
||||
get { return (IList<UpdateNoteSection>?)GetValue(SectionsProperty); }
|
||||
set { SetValue(SectionsProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SectionsProperty =
|
||||
DependencyProperty.Register(nameof(Sections),
|
||||
typeof(IList<UpdateNoteSection>),
|
||||
typeof(UpdateNotesFlipViewControl),
|
||||
new PropertyMetadata(null, OnSectionsChanged));
|
||||
|
||||
public UpdateNotesFlipViewControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private static void OnSectionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is UpdateNotesFlipViewControl control)
|
||||
control.UpdatePager();
|
||||
}
|
||||
|
||||
private void OnFlipViewSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
FlipViewPager.SelectedPageIndex = UpdateFlipView.SelectedIndex;
|
||||
SelectedIndexChanged?.Invoke(this, UpdateFlipView.SelectedIndex);
|
||||
UpdatePager();
|
||||
}
|
||||
|
||||
private void OnPipsPagerSelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args)
|
||||
{
|
||||
UpdateFlipView.SelectedIndex = sender.SelectedPageIndex;
|
||||
}
|
||||
|
||||
private void UpdatePager()
|
||||
{
|
||||
FlipViewPager.NumberOfPages = Sections?.Count ?? 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user