-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic Fluent.Ribbon interop sample
- Loading branch information
Showing
10 changed files
with
178 additions
and
1 deletion.
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
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> |
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,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
26
FluentRibbonInteropSample/FluentRibbonInteropSample.csproj
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,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> |
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.
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,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> |
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,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(); | ||
} | ||
} | ||
} |
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