Just some code examples.
This sample demonstrates a few advanced possibilities of the cool MahApps HamburgerMenu.
- Uses
CompositeCollection
to show normalHamburgerMenuItem
together with a dynamicOservableCollection
- Uses a custom
DataTemplateSelector
to provide different apperance for the items - Uses different
DataTemplates
- Uses
Binding
to show/hide some items
Attention: This sample should only show that it is possible to do it with a custom ControlTemplate
. It may be a bad UX / UI. Please think about it before you implement this in your App.
HamburgerMenu
opens when the user moves the cursor over the items.
- A
Button
shows up when theDataGridCell
becomes the focus - For now the cell will start editing mode when you click the button
- Set time when the dialog should be shown in seconds
- Set time to wait in seconds
ProgressDialog
will appear after the given time, if needed.
- Filter a list by different filter options
- match persons first name
- and or match persons last name
- and or match persons age
- Filter updates automatically
Shows all persons with first name or last name contain >su< and age between 20 and 80
Opens a detail view only for the selected item.
- Change the current theme via custom accent and base theme
- Apply additionaly
DynamicResources
to provide your own appereance
- In your App.xaml or any other
Resoruces
section add:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- your Brush goes here -->
<SolidColorBrush Color="Red" x:Key="My.Brushes.Complementary" />
</ResourceDictionary>
</Application.Resources>
- when you change the
Theme
change also theBrush
:
public static void SetAppTheme(string baseTheme, Color accent)
{
var theme = new Theme("MyTheme",
"MyTheme",
baseTheme ?? ThemeManager.BaseColorLightConst,
accent.ToString(),
accent,
new SolidColorBrush(accent),
true,
false);
var HsvAccent = new HSVColor(accent);
// Change the Bursh here. You may also want to Freeze it.
var newBrush = new SolidColorBrush(new HSVColor(HsvAccent.Hue + 180,
HsvAccent.Saturation,
HsvAccent.Value).ToColor());
newBrush.Freeze();
App.Current.Resources["My.Brushes.Complementary"] = newBrush;
ThemeManager.Current.ChangeTheme(App.Current, theme);
}
- Use the new Resource anywhere:
<Border Background="{DynamicResource My.Brushes.Complementary}" />
- Open Window in different Thread
- Moving or resizing the MainWindow will also affect the child
- Using a ViewModel to store the position and react on changes
- Use the
Dispatcher.InvokeAsync
in order to update child window from other thread
- Loads 5,000 items or more in a very short time < 1s
- Filter the long list during typing
- Test different methods
- Using DynamicData: https://www.reactiveui.net/docs/handbook/collections/