Skip to content

Commit

Permalink
Add basic Fluent.Ribbon interop sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Nov 7, 2019
1 parent 8e09156 commit cafc2ff
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 1 deletion.
17 changes: 17 additions & 0 deletions FluentRibbonInteropSample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Application
x:Class="FluentRibbonInteropSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:local="clr-namespace:FluentRibbonInteropSample"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources RequestedTheme="Light" />
<ui:XamlControlsResources />
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions FluentRibbonInteropSample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace FluentRibbonInteropSample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
26 changes: 26 additions & 0 deletions FluentRibbonInteropSample/FluentRibbonInteropSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<None Remove="Images\**" />
</ItemGroup>

<ItemGroup>
<Resource Include="Images\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Fluent.Ribbon" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ModernWpf.Controls\ModernWpf.Controls.csproj" />
<ProjectReference Include="..\ModernWpf\ModernWpf.csproj" />
</ItemGroup>

</Project>
Binary file added FluentRibbonInteropSample/Images/Gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FluentRibbonInteropSample/Images/GrayLarge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FluentRibbonInteropSample/Images/Green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FluentRibbonInteropSample/Images/GreenLarge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions FluentRibbonInteropSample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Fluent:RibbonWindow
x:Class="FluentRibbonInteropSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:Fluent="urn:fluent-ribbon"
Title="My first RibbonWindow"
Width="800"
Height="600"
ui:WindowHelper.IsEnabled="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<Fluent:Ribbon Grid.Row="0">
<!-- Backstage -->
<Fluent:Ribbon.Menu>
<Fluent:Backstage />
</Fluent:Ribbon.Menu>

<!-- Tabs -->
<Fluent:RibbonTabItem Header="Home">
<Fluent:RibbonGroupBox Header="Group">
<Fluent:Button
Header="Green"
Icon="Images/Green.png"
LargeIcon="Images/GreenLarge.png" />
<Fluent:Button
Header="Gray"
Icon="Images/Gray.png"
LargeIcon="Images/GrayLarge.png" />
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
</Fluent:Ribbon>

<ui:SimpleStackPanel
Grid.Row="1"
Spacing="12"
Margin="12">
<Button
Content="Invert theme"
Click="InvertTheme" />
<Button Content="Show content dialog" Click="ShowContentDialog" />
<Calendar />
</ui:SimpleStackPanel>
</Grid>
</Fluent:RibbonWindow>
46 changes: 46 additions & 0 deletions FluentRibbonInteropSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using ModernWpf;
using ModernWpf.Controls;
using System.Windows;

namespace FluentRibbonInteropSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}

private void InvertTheme(object sender, RoutedEventArgs e)
{
if (ThemeManager.Current.ApplicationTheme == ApplicationTheme.Dark)
{
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
Fluent.ThemeManager.ChangeThemeBaseColor(Application.Current, "Light");
}
else
{
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
Fluent.ThemeManager.ChangeThemeBaseColor(Application.Current, "Dark");
}
}

private async void ShowContentDialog(object sender, RoutedEventArgs e)
{
var dialog = new ContentDialog
{
Title = "Title",
Content = "Content",
PrimaryButtonText = "Yes",
SecondaryButtonText = "No",
CloseButtonText = "Cancel",
DefaultButton = ContentDialogButton.Primary,
IsShadowEnabled = true
};
await dialog.ShowAsync();
}
}
}
24 changes: 23 additions & 1 deletion ModernWpf.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0F1BC12B-7013-4238-8001-39C8F53E9363}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ItemsRepeaterTestApp", "ItemsRepeaterTestApp\ItemsRepeaterTestApp.csproj", "{AF1BD7FD-5513-4425-86AD-75CBF18E1D93}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ItemsRepeaterTestApp", "ItemsRepeaterTestApp\ItemsRepeaterTestApp.csproj", "{AF1BD7FD-5513-4425-86AD-75CBF18E1D93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentRibbonInteropSample", "FluentRibbonInteropSample\FluentRibbonInteropSample.csproj", "{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -113,6 +115,26 @@ Global
{AF1BD7FD-5513-4425-86AD-75CBF18E1D93}.Release|x64.Build.0 = Release|Any CPU
{AF1BD7FD-5513-4425-86AD-75CBF18E1D93}.Release|x86.ActiveCfg = Release|Any CPU
{AF1BD7FD-5513-4425-86AD-75CBF18E1D93}.Release|x86.Build.0 = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|ARM.Build.0 = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|ARM64.Build.0 = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|x64.ActiveCfg = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|x64.Build.0 = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|x86.ActiveCfg = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Debug|x86.Build.0 = Debug|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|Any CPU.Build.0 = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|ARM.ActiveCfg = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|ARM.Build.0 = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|ARM64.ActiveCfg = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|ARM64.Build.0 = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|x64.ActiveCfg = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|x64.Build.0 = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|x86.ActiveCfg = Release|Any CPU
{EE0EF4B6-3F56-4FD8-A4BA-5997D4B9440F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit cafc2ff

Please sign in to comment.