Oxard XControls (for Xamarin controls) is available on nuget.org (https://www.nuget.org/packages/Oxard.XControls)
To use components in your project with http://oxard.com/XControls shemas add this code to your App constructor (or somewhere in your assembly where you use oxard controls):
public App()
{
Oxard.XControls.Initializer.Init();
this.InitializeComponent();
}
You can also use Preserve attribute too anywhere like this :
using Oxard.XControls;
[assembly:Preserve]
-DynamicResource
Oxard dynamic resource can be applied to XF Setter and Oxard Setter. Oxard dynamic resource system can be improved with implementing ExtendedDynamicResourceImplementation and register implementation in the markup extension (ExtendedDynamicResourceExtension.RegisterExtension)
-DrawableBrushes
Drawable brushes take care about Fill and Stroke property change to redraw native drawable. In inherited class, call OnSubPropertyChanged method to force redraw for property.
Bug fix : some properties were not cloned or not affected when using AttachedBrush (StrokeMiterLimit, StrokeDashOffset, ...).
- DynamicResource
Xamarin.Forms DynamicResource does not work on object that not implement internal XF interface IResource. By example, if you want to set a dynamic resource for SolidColorBrush Color property, this code does not work :
<ResourceDictionary>
<Color
x:Key="BackgroundLabel">Blue</Color>
<SolidColorBrush
x:Key="BackgroundLabelBrush"
Color="{DynamicResource BackgroundLabel}" />
</ResourceDictionary>
If you set BackgroundLabelBrush to a label background, its background will be not set. Use this equivalent with Oxard offers a workaround :
<ResourceDictionary>
<Color
x:Key="BackgroundLabel">Blue</Color>
<SolidColorBrush
x:Key="OxardBackgroundLabelBrush"
Color="{oxard:ExtendedDynamicResource BackgroundLabel, UseReflection=True}" />
</ResourceDictionary>
The background of label change and if you override the BackgroundLabel resource it takes effect.
You should set UseReflection to true to associate your dynamic resource to first visual parent element of the brush or you can set the Container property to indicate where resources will be found. If UseReflection is set to false and Container is not set (this is the default values), Oxard takes Application.Current instance to find resources.
- Keyboard management
You can use KeyboardManager to have access to keyboard events. If you want to get keys on a specific control, attach a KeyboardHelper on each platform. Don't forget to call KeyboardHelper.Initialize method in mainActivity for android and App.xaml.cs for UWP to get events from the whole application. For android, you need to implement IKeyboardListener on a renderer or on your MainActivity. Copy and paste this code :
// Renderer or mainactiviry class
public override bool DispatchKeyEvent(KeyEvent e)
{
var androidKeyboardEventArgs = new AndroidKeyboardEventArgs(e);
PreviewKeyEvent?.Invoke(this, androidKeyboardEventArgs);
return androidKeyboardEventArgs.Handled == true ? true : base.DispatchKeyEvent(e);
}
public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
var androidKeyboardEventArgs = new AndroidKeyboardEventArgs(e);
KeyEvent?.Invoke(this, androidKeyboardEventArgs);
return androidKeyboardEventArgs.Handled == true ? true : base.OnKeyDown(keyCode, e);
}
public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
var androidKeyboardEventArgs = new AndroidKeyboardEventArgs(e);
KeyEvent?.Invoke(this, androidKeyboardEventArgs);
return androidKeyboardEventArgs.Handled == true ? true : base.OnKeyUp(keyCode, e);
}
- Interactivity
Setters overrides original property value when applied but if the orginal value is from a binding, the binding was lost. In this version, you can set a OriginalValueBinding on setters to specify which binding setter must be used to set the original binding when it is unapplied.
- Virtualization
Add a ScrollToAsync(object item) method on VirtualizingItemsControl to scroll to an element of the ItemsSource even if the view for item is not generated yet.
- Virtualization
Fix a bug with Oxard Triggers which ignored changement on original value of a bindable property. If you affect a property to a value "A" via Oxard Setter and then you change this property to "B" in your code, the "B" value is stored as original value and setter is reapplied and property value is "A" until setter be deactivated.
- Virtualization
First version of UI virtualization with VirtualizingItemsControl and VirtualizingStackLayout. For now, VirtualizingItemsControl is a fork of ItemsControl.
- TriggerCollection
Fix a bug if attach to non visible object that causes thread memory leak.
- OrientedLine
Adding OrientedLine to draw lines horizontally or vertically.
- ListBox
Adding new ListBox component.
- ContentControl
If ContentData is null at beginning, ContentTemplate or ContentTemplateSelector was not applied.
- ContentControl
ContentData property added and ContentData is used to template content via ContentTemplate or ContentTemplateSelector properties
- WrapLayout
Fix a bug with some layout measurement.
- WrapLayout
A new ChildAlignment property is added on WrapLayout and WrapAlgorithm. It align child in rows or columns in WrapLayouts.
Example :
ChildAlignment : LeftOrTop
ChildAlignment : Center
ChildAlignment : Justify
- Minimal Xamarin Forms version supported set to 4.8.0.1821
- Android ContentControlRenderer
When renderer is disposed, the background was not disposed too. This version fixed it.
- Android DrawingBrush
DrawingBrush are not disposed correctly on android
-
Android DrawingBrush
- On android, drawing brush was not react to GeometryChanged event.
- If StrokeThickness is 0 then stroke is not rendered.
- RectangleBrush
Same bug fix than 4.5.16.32 for RectangleBrush
- RoundedRectangle
Calculate it's size when stroke thickness changed
- RoundedRectangle
Fix a bug on android to calculate mesure not from Data property but from WhidthRequest and HeightRequest.
- Interactivity
Wait control to be loaded before applying setter and fix bugs when multiple trigger change the same property on same target
- Setter
Fix a bug when unapply a setter to an object when Target property is set.
- Triggers
Oxard triggers can have setters that have a different target than the object that declare the trigger.
In the following example, a trigger is declared on a Button but change Labels TextColor.
<Grid
RowDefinitions="Auto, Auto, *">
<Label
Grid.Row="0"
x:Name="Label1"
Text="Foreground white when button pressed"
TextColor="Red" />
<Label
Grid.Row="1"
x:Name="Label2"
Text="Foreground blue when button pressed"
TextColor="Green" />
<oxard:Button
Grid.Row="2">
<oxard:Interactivity.Triggers>
<oxard:TriggerCollection>
<oxard:Trigger
Property="{x:Static oxard:Button.IsPressedProperty}"
Value="True">
<oxard:Setter
Target="{x:Reference Label1}"
Property="{x:Static Label.TextColorProperty}"
Value="White" />
<oxard:Setter
Target="{x:Reference Label2}"
Property="{x:Static Label.TextColorProperty}"
Value="Blue" />
</oxard:Trigger>
</oxard:TriggerCollection>
</oxard:Interactivity.Triggers>
<Label
Text="Click me!"
TextColor="White" />
</oxard:Button>
</Grid>
- Update to Xamarin.Forms 5
All oxard brushes are removed except DrawingBrush. Use XF brushes instead. BackgoundEffect has been deleted because Background property is supported by XF. Renderers for ContentControl (and all inherits controls) support DrawingBrush.
Oxard shapes has been deleted except Rectangle that is renamed to RoundedRectangle
- UWP
Adding output files in nuget package to build on UWP.
- MultiFormatLayout
Fix : if algorithm was set durring measurment or layout, MultiFormatLayout made infinity loop.
- GridAlgoritm
Fix a bug when measure a grid in width or height inifinite with Column or Row with a GridLength.Star (yes again!)
- MultiFormatLayout
Prevent measurement and layout when algotihm change during measurement or layout.
OnMeasure and LayoutChildren are sealed. Use BeforeMeasure or BeforeLayoutChildren instead.
- XF update
Xamarin forms update to 4.3.0.991250
- GridAlgoritm
Fix a bug when measure a grid in width or height inifinite with Column or Row with a GridLength.Star
- Oxard.Interactivity
Fix on activation on already active trigger.
- Oxard.Interactivity
Add a new Triggers attached property to manage some bugs with Xamarin.Forms native Triggers
<Style x:Key="InteractivityStyle" TargetType="oxard:RadioButton">
<Setter Property="oxard:Interactivity.Triggers">
<Setter.Value>
<oxard:TriggerCollection>
<oxard:Trigger
Property="{x:Static oxard:RadioButton.IsCheckedProperty}"
Value="True">
<oxard:Setter
Property="{x:Static oxard:RadioButton.BackgroundProperty}"
Value="{StaticResource ButtonPressedBackgroundBrush}" />
</oxard:Trigger>
<oxard:Trigger
Property="{x:Static oxard:RadioButton.IsEnabledProperty}"
Value="False">
<oxard:Setter
Property="{x:Static oxard:RadioButton.BackgroundProperty}"
Value="{StaticResource ButtonDisableBackgroundBrush}" />
</oxard:Trigger>
</oxard:TriggerCollection>
</Setter.Value>
</Setter>
</Style>
- CheckBox and RadioButton
Fix a bug when set IsChecked property by code
- ItemsControl
You can now use AlternationCount property to specify item container behavior depending on their value of AlternationIndex attached property.
- LayoutAlgorithm
All Oxard LayoutAlgorithm inherited classes use BindableProperty instead of classical CLR properties and are now bindable. Method OnMeasureLayoutRequested added to LayoutAlgorithm base class to simplify bindable properties declaration in inherited classes.
- ItemsControl
Loaded method added
- ItemsControl
Bug fix : GetContainerForItemOverride is overridable and have no parameter. If ItemTemplate or DataTemplateSelector is used, the generated item content is filled with template (if item generated is a content view)
- Xamarin.Forms update
Now the library is based on Xamarin.Forms 4.1.0.555618.
- XmlnsDefinition
Initializer class has been created to initialize the library and use xmlns namespace. Call the Init method if the namespace is not recognize by your project. Furthermore namespace has been renamed to http://oxard.com/XControls
- UWP and TouchHelper
Bug fix : if you use a mouse, mouse over was considered as TouchEnter
- StackAlgorithm
Bu fix : problem on calculation of measurement that return the size of the last child instead of the whole size of children
- ItemsControl
Add GetViewForDataItem method to get generated item for a specific item in ItemsSource
- WrapLayout & WrapAlgorithm
WrapLayout and WrapAlgorithm have been added to controls.
- ZStackAlgorithm
Bug fix : this layout did not take care about not visible children.
- Algorithm (layouts)
Add of Grid and UniformGrid algorithms for MultiFormatLayout.
- Layouts
You can create a layout that is based on one of LayoutAlgorithm by inherited from BaseLayout class. ZStackLayout and UniformGrid are implemented and use BaseLayout.
- TouchManager
Bug fix : TouchCancel cancel long press.
- BackgroundEffect
Bug fix : Background is applied on effect control if exists otherwise on effect container.
- DrawingBrush
Check null reference on AttachedBrush property changed
- TouchManager
Clicked event was called before TouchUp. Now it is reversed.
- Brushes
All brushes are implemented IClonable. This is usefull to create styles with brushes and change there properties for one element and not for all elements. Particulary if you want a drawing brush and change there properties with attached properties in a Trigger. The AttachedFill attached property allow you to attached a clone of brush describe in on each element that use your style.
- Spelling
Rename algorythm into algorithm
- CheckBox
Add Checked and Unchecked event.
- TouchManager
There was a bug causes a clicked when touch up but touch left.
- DrawingBrush bug
There was a null reference exception if a drawing brush attached property was set on element that has no BackgroundEffect or ContentControl that has no DrawingBrush for its Background
- MultiFormatLayout and LayoutAlgorythms
Adding a new Layout that can take an external algorythm for measurement and layout opertion. So you can use it to change dynamically disposition of element. Its needed often when you change from portrait to landscape view when you just want to change layout but not children.
ZStackAlgorythm allowed you to stack children on top of each other.
StackAlgorythm stack children horizontally or vertically.
- Bug fixed
Null reference not checked on ContentControl bindable properties changed.
- DrawingBrush
Adding attached properties to specified changes on a DrawingBrush without create a new DrawingBrush
- ShapeRenderer
Fixed a bug on FastRenderer for shapes that doesn't override Dispose correctly and add GeometryChanged event subscritpion.
- Shape and there renderer
Shapes are treated by fast renderer for Android. The ShapeRenderer already exists but all oxard shapes are managed by FastShapeRenderer.
- TouchManager
There was a bug on long press when tapping many times before long press time that causes simple tap considered as long press tap.
- Xamarin.Forms
The package and solution now reference Xamarin.Forms 4.0.0.425677
- XmlnsDefinition
Oxard controls are now under a XmlnsDefinition : https://github.com/RenaudAvenas/Oxard.XControls
- Shapes
Measurement of shapes are updated to match with new measurement of Xamarin 4. StrokeThickness now update the geometry.
Property IsClosed was added to Geometry class to specify if your shape is closed or not.
- Android ContentControlRenderer
Fix a bug when OnElementChanged called but renderer already disposed.
Fix a bug with background changement which didn't take care about Xamarin Forms Element size.
- MeasureExtensions
Adding a class of extensions on Xamarin Forms View to help standard measurement of components.
- Shape
Take care about measures from base shape. Override OnMeasure if you want to come back to Xamarin Forms basic measures or reimplement it tu customize your shape size.
- Geometry
Again a bug on pixel delay when StrokeThickness is greater than 1.
- ContentControl
There is a new Renderer for ContentControl which allows to manage Background property without defining a ControlTemplate with a Shape. UWP support DrawingBrush in ContentControl inherited classes. Use IsBackgroundManagedByStyle property to enable or disable this feature (default value is False).
- Geometry
Better fix for the bug due to precision loss which causes stroke to be clipped.
- Button
Fix bug : IsPressed is not set to True when Button is disable.
- Geometry
Constants are created in geometry ratio to fix a bug with strokeThickness inferior than 1 which causes stroke to be clipped
- RadioButton
Property GroupeName is replaced by GroupName.
- Button
Command property was not called when we click on the button. That is fixed.
On UWP, Pointer are captured by clickable controls when touching down and release when touching up.
- ObjectDisposedException bug
Some access to native control caused ObjectDisposedException in ShapeRenderer.
- Background effect
You can now use Brush to set background on native Xamarin controls with the BackgroundEffect.
- DrawingBrush
This is a new Brush that can be defined like a shape. Very helpful to draw a cornered rectangle as background! Unfortunately, this type of brush can be used only on Android now because UWP does not support other brush than LinearGradient or SolidColor brushes. So you have to register an IBrushInterpretor in InterpretorManager to translate DrawingBrush into one of brushes above or use ControlTemplate with Shape.
- LongPressButton
New control which allowed you to manage a simple button or a long press on button with two commands and events.
- ItemsControl
This new component allow you to use an items source on a specific panel. All items can be templated by ItemTemplate or ItemTemplateSelector. ItemsControl is designed to be extended with possibilities to inherited from IsItemItsOwnContainerOverride and GetContainerForItemOverride.
- Events - TouchManager
This is a way to control touches on a control without gesture but directly via touches points (multitouch is not managed yet).
- Buttons
You can now have customizable buttons which inherits from ContentControl. Button is a good example of how to use TouchManager. CheckBox and RadioButton have been added and inherit from Button class.
- Shapes
Ellipse is added.
- Extensions
Extensions to navigate in Xamarin "VisualTree".
- Basics
Basics for future controls creation. You can use Shapes to draw what you want with a Geometry. Recangle is already created if you want an exemple.
- Colors
You can use Brushes instead of Colors (ex : Linear gradient, radial gradient). Brushes can be setted in Shape.Fill property
- ContentControl
This control can be templated by data with ContentTemplate and ContentTemplateSelector. It bring some basics properties like Background (use Brush and not Color like BackgroundColor), Foreground, ...