Giter Site home page Giter Site logo

punker76 / code-samples Goto Github PK

View Code? Open in Web Editor NEW
263.0 27.0 161.0 35.59 MB

Just some code samples for MahApps and other experiments...

License: MIT License

C# 99.80% PowerShell 0.20%
c-sharp mahapps code-samples wpf wpf-mahapps xaml oss open-source ui ui-design

code-samples's Introduction

Stand With Ukraine

Just some code samples...

To build these samples you'll need at least Visual Studio 2019 16.x Community Edition.

You can use the cake build script to compile all projects via powershell commandline:

.\build.ps1

IconPacksValueConverterSample

Simple MahApps.Metro.IconPacks sample which shows how to produce a percantage view of a binded value together with an IValueConverter.

ListViewSwitchItemsPanel

Simple sample which shows how to switch the ItemsPanel of a ListView.

listview

An auto moving ToolTip

ToolTipAutoMoveSample is a sample which demonstrates my auto moving ToolTip, explained here.

This ToolTip is now also available in the ControlzEx library.

automove_tooltip2

MahApps.Metro HamburgerMenu

MahAppsMetroHamburgerMenu showcase for MahApps.Metro HamburgerMenu.

  • Simple straight forward sample
  • Sample with Binding to the SelectedItem / SelectedOptionsItem
  • Sample with a custom helper class HamburgerMenuIconItem which uses the MahApps.Metro.IconPacks
  • Sample with Caliburn.Micro (tba)
  • Sample with some code behind (tba)

MahApps.Metro blank application

MahAppsMetroSample is a simple blank app for MahApps.Metro, explained in this blog post.

MahApps.Metro custom WindowButtonCommands

MahAppsMetroWindowButtonCommands

A sample app to demonstrate the customization of the Min/Max/Close buttons (for the upcoming v1.3.0). It shows different background color and tooltips.



MahApps.Metro DataGrid

MahAppsMetroDataGridSample showcase for MahApps.Metro DataGrid styles.


MahApps.Metro Themes

MahAppsMetroThemesSample MahApps.Metro ThemeManager example explained in this blog post.

mahapps_more_colors

MahApps.Metro blank VB application

MahAppsMetroVBSample is a simple blank app for Visual Basic MahApps.Metro.

License

The MIT License (MIT)

Copyright (c) 2014-present Jan Karger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

code-samples's People

Contributors

forki avatar punker76 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-samples's Issues

Add ContentTemplate / DataTemplate in HamburgerMenu.V4

Hello,
this is more a questen then an issue. Would you mind explaining how to add a ContentTemplate to V4 of the Hamburger Menu?
I would like to have a kind of headline on all Views (like in HamburgerMenu.V2 and 3) but when adding a ContentTemplate the current View cannot be showed anymore.
Thank you for your help and thanks for the perfect examples listed here! :-)

MahAppsMetroHamburgerMenuNavigation crash System.InvalidOperationException: 'Page can have only Window or Frame as parent.'

on Windows 10
clone the latest repo. build with script build.ps1, successfully.
run MahAppsMetroHamburgerMenuNavigation.exe
Application UI is lauched.
click a menu item, e.g. Bugs, application will crash.

System.InvalidOperationException
HResult=0x80131509
Message=Page can have only Window or Frame as parent.
Source=PresentationFramework
StackTrace:
at System.Windows.Controls.Page.OnVisualParentChanged(DependencyObject oldParent)
at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
at System.Windows.Media.Visual.AddVisualChild(Visual child)
at System.Windows.FrameworkElement.set_TemplateChild(UIElement value)
at System.Windows.Controls.ContentPresenter.UseContentTemplate.BuildVisualTree(FrameworkElement container)
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate) at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField1 templateDataField, FrameworkElement container)
at System.Windows.FrameworkElement.ApplyTemplate()
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at MahAppsMetroHamburgerMenuNavigation.App.Main()

Build

Small issue. In order to build this code I needed to reference the relevant nuget packages (JetBrains, MahApps, IconPack). Then it built fine.

HamburgerMenuApp.V4 view from MenuItem will be constructed twice

After adding the following code to HomeView.Xaml.cs in HamburgerMenuApp.Core and make HamburgerMenuApp.V4 output debug message to console, then I found the "HomeView ctor..." message will pop up twice even I just click the Home menuItem once.
I can`t see this issue in other V1~V3 samples, seems like the menuItem views is singleton in these projects.

=================================================

public HomeView()
{
InitializeComponent();
Console.WriteLine($@"{GetType().Name} ctor...");
}

~HomeView() => Console.WriteLine($@"{GetType().Name} dtor...");

How to get it working

Hey @punker76

I'm a complete noob in WPF and XAML and i am in the process of teaching myself. I have seen your example on your website, but i dint get at all where to add the controls etc.

Can you please briefly explain to me how to make this thing work?
It already starts with missing knowledge where to put in the snippet below ;-)

<controls:HamburgerMenu x:Name="HamburgerMenuControl"
Foreground="White"
PaneBackground="#FF444444"
IsPaneOpen="False"
DisplayMode="CompactInline">
</controls:HamburgerMenu>

Thanks a lot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.