Autocorrect Symbol In Markup Expression

When a .NET symbol referenced inside a XAML markup extension does not exist but a closely named symbol can be found within the current solution, this code fix will replace the bad symbol reference with a reference the closely named symbol.

When the class derives from Xamarin.Forms.View, this code action can be used to generate a bindable property implementation.

The code action will attempt to resolve the new properties type by inspecting the value of the source attribute. If the value is an expression, MFractor will evaluate the expression and use the return type as the new properties type.

If the attributes value isn't an expression, MFractor will attempt to infer type based on the literal input. For example, an attribute value of true would trigger MFractor to output a boolean typed property. This behaviour can be disabled by configuring the TryInferUnknownTypes to false.

Configurable Properties

Name

Type

Defaults To

Description

TryInferUnknownTypes

Boolean

True

Should MFractor attempt to guess the type for the new property based on it's value? EG: A value of true would cause the output type to be bool instead of System.Object.

DefaultColorType

System.String

Xamarin.Forms.Color

When attempting to infer the property type based on its value and MFractor decides it's a color, what is the color type MFractor should use?

DefaultPropertyType

System.String

System.Object

What is the default type for the new property if MFractor can't figure it out based on the attribute value?

DefaultImageType

System.String

Xamarin.Forms.ImageSource

When attempting to infer the property type based on its value and MFractor decides it's an image, what is the CLR type MFractor should use?

Therefore the Import Namespace And Assembly For Unresolved XAML Node code fix is very useful because it resolves these for you!

The code action will search all assemblies that the project references for classes that match the name of the XAML node. It will then suggest the creation of an xmlns=... import statement to resovle that missing class:

Import Value Converter For Binding Type Flow

Inspects for IValueConverter implementations within the project and it's references that match the value conversion flow for this binding type mismatch. IValueConverter implementations must be annotated with the ValueConversionAttribute to be detected by this fix.

Rename Duplicate Namespace References

When multiple namespaces reference the same .NET namespace and assembly, this code fix will remove duplicates by replace all occurances of a particular namespace another namespace name to make sure only one XML namespace references an assembly and namespace.

Replace Style Setter Property With Autocorrection

When a style setter tries to use a property that doesn't exist on the styles TargetType but the name closely matches an existing member on that type, this code fix will replace the incorrect value with a suggested correction.