-
-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #574 from xmine64/expander_animation
Expander animation
- Loading branch information
Showing
12 changed files
with
284 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/Wpf.Ui.Gallery/ViewModels/Pages/Layout/ExpanderViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This Source Code Form is subject to the terms of the MIT License. | ||
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. | ||
// Copyright (C) Leszek Pomianowski and WPF UI Contributors. | ||
// All Rights Reserved. | ||
|
||
namespace Wpf.Ui.Gallery.ViewModels.Pages.Layout; | ||
|
||
public partial class ExpanderViewModel : ObservableObject | ||
{ | ||
public ExpanderViewModel() | ||
{ | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Wpf.Ui.Gallery/ViewModels/Pages/Layout/LayoutViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// This Source Code Form is subject to the terms of the MIT License. | ||
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. | ||
// Copyright (C) Leszek Pomianowski and WPF UI Contributors. | ||
// All Rights Reserved. | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using Wpf.Ui.Common; | ||
using Wpf.Ui.Gallery.Models; | ||
|
||
namespace Wpf.Ui.Gallery.ViewModels.Pages.Layout; | ||
|
||
public partial class LayoutViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] | ||
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard> | ||
{ | ||
new() | ||
{ | ||
Name = "Expander", | ||
Icon = SymbolRegular.Code24, | ||
Description = "Expander control.", | ||
Link = "Expander" | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<Page | ||
x:Class="Wpf.Ui.Gallery.Views.Pages.Layout.ExpanderPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:basicInput="clr-namespace:Wpf.Ui.Gallery.Views.Pages.BasicInput" | ||
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Wpf.Ui.Gallery.Views.Pages.Layout" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:system="clr-namespace:System;assembly=System.Runtime" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" | ||
Title="ExpanderPage" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}" | ||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}" | ||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" | ||
mc:Ignorable="d"> | ||
<Page.Resources> | ||
<system:String x:Key="PageXamlUrl">https://github.com/lepoco/wpfui/blob/development/src/Wpf.Ui/Styles/Controls/Expander.xaml</system:String> | ||
<system:String x:Key="PageCsharpUrl">https://github.com/lepoco/wpfui/blob/development/src/Wpf.Ui/Controls/Expander.cs</system:String> | ||
</Page.Resources> | ||
<Grid> | ||
<ui:DynamicScrollViewer | ||
x:Name="PageScrollViewer" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="280" /> | ||
</Grid.ColumnDefinitions> | ||
<Grid Grid.Column="0" Margin="42"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<controls:GalleryControlPresenter | ||
Grid.Row="0" | ||
Margin="0" | ||
CodeText="<Expander Header="This text is in the header" Content="This is in the content" />" | ||
HeaderText="An Expander with text in the header and content areas"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<Expander | ||
Grid.Column="0" | ||
Content="This is in the content" | ||
Header="This text is in the header" /> | ||
|
||
<!-- TODO: ExpandDirection --> | ||
</Grid> | ||
</controls:GalleryControlPresenter> | ||
</Grid> | ||
</Grid> | ||
</ui:DynamicScrollViewer> | ||
<controls:ControlDocumentationSummary CsharpUrl="{StaticResource PageCsharpUrl}" XamlUrl="{StaticResource PageXamlUrl}" /> | ||
</Grid> | ||
</Page> |
19 changes: 19 additions & 0 deletions
19
src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Wpf.Ui.Controls.Navigation; | ||
using Wpf.Ui.Gallery.ViewModels.Pages.Layout; | ||
|
||
namespace Wpf.Ui.Gallery.Views.Pages.Layout | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Expander.xaml | ||
/// </summary> | ||
public partial class ExpanderPage : INavigableView<ExpanderViewModel> | ||
{ | ||
public ExpanderPage(ExpanderViewModel viewModel) | ||
{ | ||
InitializeComponent(); | ||
ViewModel = viewModel; | ||
} | ||
|
||
public ExpanderViewModel ViewModel { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Page | ||
x:Class="Wpf.Ui.Gallery.Views.Pages.Layout.LayoutPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Wpf.Ui.Gallery.Views.Pages.Layout" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:models="clr-namespace:Wpf.Ui.Gallery.Models" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" | ||
Title="DialogsAndFlyoutsPage" | ||
d:DataContext="{d:DesignInstance local:LayoutPage, | ||
IsDesignTimeCreatable=False}" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}" | ||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}" | ||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" | ||
mc:Ignorable="d"> | ||
|
||
<Grid Margin="38"> | ||
<controls:GalleryNavigationPresenter | ||
Margin="0" | ||
Padding="0" | ||
ItemsSource="{Binding ViewModel.NavigationCards, Mode=OneWay}" /> | ||
</Grid> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This Source Code Form is subject to the terms of the MIT License. | ||
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. | ||
// Copyright (C) Leszek Pomianowski and WPF UI Contributors. | ||
// All Rights Reserved. | ||
|
||
|
||
using Wpf.Ui.Controls.Navigation; | ||
using Wpf.Ui.Gallery.ViewModels.Pages.Layout; | ||
|
||
namespace Wpf.Ui.Gallery.Views.Pages.Layout; | ||
|
||
public partial class LayoutPage : INavigableView<LayoutViewModel> | ||
{ | ||
public LayoutViewModel ViewModel { get; } | ||
|
||
public LayoutPage(LayoutViewModel viewModel) | ||
{ | ||
ViewModel = viewModel; | ||
DataContext = this; | ||
|
||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace Wpf.Ui.Converters; | ||
|
||
public class AnimationFactorToValueConverter : IMultiValueConverter | ||
{ | ||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (values[0] is not double completeValue) return 0.0; | ||
if (values[1] is not double factor) return 0.0; | ||
if (parameter is "negative") factor = -factor; | ||
|
||
return factor * completeValue; | ||
} | ||
|
||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.