Skip to content

Commit

Permalink
feat(SamplePageLayout): Added Fluent option for sample pages layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-Antoine-Soucy committed Jun 15, 2023
1 parent 5b56af5 commit 5b5f620
Show file tree
Hide file tree
Showing 10 changed files with 472 additions and 365 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,20 @@ public DataTemplate M3MaterialTemplate
get => (DataTemplate)GetValue(M3MaterialTemplateProperty);
set => SetValue(M3MaterialTemplateProperty, value);
}
#endregion
#region Property: FluentTemplate

public static DependencyProperty FluentTemplateProperty { get; } = DependencyProperty.Register(
nameof(FluentTemplate),
typeof(DataTemplate),
typeof(SamplePageLayout),
new PropertyMetadata(default));

public DataTemplate FluentTemplate
{
get => (DataTemplate)GetValue(FluentTemplateProperty);
set => SetValue(FluentTemplateProperty, value);
}
#endregion
#region Property: DesignAgnosticTemplate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ public partial class SamplePageLayout : ContentControl
{
private const string VisualStateMaterial = nameof(Design.Material);
private const string VisualStateCupertino = nameof(Design.Cupertino);
private const string VisualStateFluent = nameof(Design.Fluent);
private const string VisualStateAgnostic = nameof(Design.Agnostic);

private const string MaterialRadioButtonPartName = "PART_MaterialRadioButton";
private const string CupertinoRadioButtonPartName = "PART_CupertinoRadioButton";
private const string FluentRadioButtonPartName = "PART_FluentRadioButton";
private const string StickyMaterialRadioButtonPartName = "PART_StickyMaterialRadioButton";
private const string StickyCupertinoRadioButtonPartName = "PART_StickyCupertinoRadioButton";
private const string StickyFluentRadioButtonPartName = "PART_StickyFluentRadioButton";
private const string ScrollingTabsPartName = "PART_ScrollingTabs";
private const string StickyTabsPartName = "PART_StickyTabs";
private const string ScrollViewerPartName = "PART_ScrollViewer";
Expand All @@ -41,13 +44,16 @@ public partial class SamplePageLayout : ContentControl
{
new LayoutModeMapping(Design.Material, () => !IsDesignAgnostic, _materialRadioButton, _stickyMaterialRadioButton, VisualStateMaterial, MaterialTemplate),
new LayoutModeMapping(Design.Cupertino, () => !IsDesignAgnostic, _cupertinoRadioButton, _stickyCupertinoRadioButton, VisualStateCupertino, CupertinoTemplate),
new LayoutModeMapping(Design.Fluent, () => !IsDesignAgnostic, _fluentRadioButton, _stickyFluentRadioButton, VisualStateFluent, FluentTemplate),
new LayoutModeMapping(Design.Agnostic, () => IsDesignAgnostic, null, null, VisualStateAgnostic, DesignAgnosticTemplate),
};

private RadioButton _materialRadioButton;
private RadioButton _cupertinoRadioButton;
private RadioButton _fluentRadioButton;
private RadioButton _stickyMaterialRadioButton;
private RadioButton _stickyCupertinoRadioButton;
private RadioButton _stickyFluentRadioButton;
private FrameworkElement _scrollingTabs;
private FrameworkElement _stickyTabs;
private FrameworkElement _top;
Expand Down Expand Up @@ -78,8 +84,10 @@ protected override void OnApplyTemplate()

_materialRadioButton = (RadioButton)GetTemplateChild(MaterialRadioButtonPartName);
_cupertinoRadioButton = (RadioButton)GetTemplateChild(CupertinoRadioButtonPartName);
_fluentRadioButton = (RadioButton)GetTemplateChild(FluentRadioButtonPartName);
_stickyMaterialRadioButton = (RadioButton)GetTemplateChild(StickyMaterialRadioButtonPartName);
_stickyCupertinoRadioButton = (RadioButton)GetTemplateChild(StickyCupertinoRadioButtonPartName);
_stickyFluentRadioButton = (RadioButton)GetTemplateChild(StickyFluentRadioButtonPartName);
_scrollingTabs = (FrameworkElement)GetTemplateChild(ScrollingTabsPartName);
_stickyTabs = (FrameworkElement)GetTemplateChild(StickyTabsPartName);
_scrollViewer = (ScrollViewer)GetTemplateChild(ScrollViewerPartName);
Expand All @@ -102,8 +110,10 @@ protected override void OnApplyTemplate()

BindOnClick(_materialRadioButton);
BindOnClick(_cupertinoRadioButton);
BindOnClick(_fluentRadioButton);
BindOnClick(_stickyMaterialRadioButton);
BindOnClick(_stickyCupertinoRadioButton);
BindOnClick(_stickyFluentRadioButton);

UpdateLayoutRadioButtons();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum Design
{
Material,
Cupertino,
Fluent,
Agnostic,
}
}
Loading

0 comments on commit 5b5f620

Please sign in to comment.