Skip to content

Set of XAML markup utilities for WPF applications.

License

Notifications You must be signed in to change notification settings

IbexPeak/SmartMvvm.Xaml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartMvvm.Xaml / SmartMvvm.Avalonia.Xaml

NuGet NuGet

Build status (master) Build status (develop)

Introduction

SmartMvvm.Xaml contains a set of useful markup extensions and other objects to simplify writing WPF and Avalonia XAML code without the need of code behind or unnecessary UI behavior logic in view model code.

  • Supported are projects using at least .NET Framework 4.5 or at least .NET Core 3.1 for WPF and at least .NET Standard 2.0 for Avalonia.

Getting Started

To use these XAML utilities in your project, simply install the SmartMvvm.Xaml (WPF) or SmartMvvm.Avalonia.Xaml (Avalonia) NuGet package to your project.

Check out the sample application (WPF) or sample application (Avalonia) to see how you can use these utilities in your project.

Samples

<!-- combine multiple Bindings and automatically convert the result -->
<ProgressBar Visibility="{And {Binding IsLoading}, {Binding IsConnected}}" />

<!-- evaluate mathematical expressions and format the result -->
<TextBlock Text="{Format 'Results in {0} cells', 
                         {Calc 'x * y', 
                               {Binding NumberOfColumns}, 
                               {Binding NumberOfRows}}}" />

<!-- Conditionally style an element by reusing a stored value -->
<Window.Resources>
  <Var x:Key="TooManyItems" Value="{Greater {Binding ElementName=CountTextBox, Path=Text},
                                            {Int 10000}}" />
</Window.Resources>

<TextBox x:Name="CountTextBox" Text="100" />
<TextBlock Text="{If {Use TooManyItems}, 
                     Then='Too many items!'},
                     Else='Enter the number of items to generate.'}"
           Foreground="{If {Use TooManyItems},
                           Then={x:Static Brushes.Red},
                           Else={x:Static Brushes.Black}}" />

About

Set of XAML markup utilities for WPF applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.3%
  • PowerShell 0.7%