-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
literally no documentation #1
Comments
Quick Setup Steps
Add the Quick Converter namespace to your xaml files so you can reference it.
More Details However, before these classes can be used, a small amount of setup is required. Since QuickConverter does static type look ups, the namespaces in which to search need to be specified. For instance, to be able to use 'Visibility.Collapsed' in a converter, you must first register the 'System.Windows' namespace. This only needs to be done once at initialization time. Adding the 'System' namespace from mscorlib can be done using the following call:
In this call you are specifying the namespace and the assembly. This can also be done as follows:
In this call, the namespace and the assembly are inferred from the type. Additionally, for full type names (like "System.Int32"), the assembly it is contained within must be specified. The following shows how to do this:
In addition to adding namespaces, extension methods must also be manually registered. To add all the typical LINQ IEnumerable extensions, call the following:
Single Bindings (see QuickConverter Markup section for recommended syntax) QuickConverter.Binding allows you to write a binding with a custom two-way converters in one line of xaml code. Here is a binding with a Boolean to System.Visibility converter written with QuickConverter:
Following are two more examples of valid converter code:
Constructors and object initializers are also valid:
* Note that generic arguments are enclosed in square brackets instead of angle brackets. Xml doesn't play well with angle brackets. The following shows how to write a two-way binding:
Multi-Bindings Multibinding work in a very similar way. The following demonstrates an inline multibinding:
QuickConverter Markup Converters can also be created independently of the QuickConverter binding extensions. This allows an extra level of flexibility. The following is an example of this:
Local Variables Local variables can be used through a lambda expression like syntax. Local variables have precedence over binding variables and are only valid with the scope of the lambda expression in which they are declared. The following shows this:
* Note that the "&&" operator must be written as "&&" in XML. ** Due to a bug with the designer, using "&" in a markup extension breaks Intellisense. Instead of two ampersands, use the alternate syntax "##". "#" also works for bitwise and operations. Lambda Expressions Support for lambda expressions is limited, but its support is sufficient to allow LINQ to be used. They look quite similar to conventional C# lambda expressions, but there are a few important differences. First off, block expressions are not supported. Only single, inline statements are allowed. Also, the expression must return a value. Additionally, the function will default to object for all generic parameters (eg. Func<object, object>). This can be overridden with typecast operators. The following shows this:
*Note: The parameters must always be enclosed by parenthesis. Null Propagation Operator The null propagation operator allows safe property/field, method, and indexer access on objects. When used, if the target object is null, instead of throwing an exception null is returned. The operator is implemented by "?". Instead of this:
You can write this:
This can be combined with the null coalescing operator to change this:
Into this:
This operator is particularly useful in long statements where there are multiple accessors that could throw null exceptions. In this example, we assume Data can never be null when Value is not null.
QuickEvent This markup extension allows you to create event handlers inline. Aside from allowing void functions, the code is identical to QuickConverters. However, QuickEvent exposes a number of variables by default.
An example:
The P0-P4 values are useful for crossing name scope boundaries like DataTemplates. Typically, when set outside a DataTemplate they will be inherited by the contents inside the DataTemplate. This allows you to easily make external controls and values accessible from inside DataTemplates. QuickValue This markup extension evaluates exactly like a QuickConverter except there are no P0-P9 variables, and it is evaluated at load. The markup extension returns the result of the expression. Last edited Apr 9, 2016 at 2:43 AM by DiegoMustache, version 35 |
string literally not work.
|
seriously ... NOTHING AT ALL??
If you dont want people using your library ... simply take it offline.
The text was updated successfully, but these errors were encountered: