├── .gitignore ├── .gitmodules ├── Appercode.UIFramework.Abstract.csproj ├── Appercode.UIFramework.Droid.csproj ├── Appercode.UIFramework.iOS.csproj ├── Appercode.UIFramework.sln ├── ControlTemplate.cs ├── Controls ├── AppBarButton.cs ├── AppBarButton.iOS.cs ├── AppercodePage.Droid.cs ├── AppercodePage.cs ├── AppercodePage.iOS.cs ├── AppercodeVisualRoot.cs ├── Base │ └── GridSizeCollectionBase.cs ├── BitmapIcon.cs ├── BitmapIcon.iOS.cs ├── Border.Abstract.cs ├── Border.Droid.cs ├── Border.cs ├── Border.iOS.cs ├── Button.Abstract.cs ├── Button.Droid.cs ├── Button.cs ├── Button.iOS.cs ├── Canvas.Abstract.cs ├── Canvas.Droid.cs ├── Canvas.cs ├── Canvas.iOS.cs ├── CheckBox.Droid.cs ├── CheckBox.cs ├── CheckBox.iOS.cs ├── ClickMode.cs ├── ColumnDefinition.cs ├── ColumnDefinitionCollection.cs ├── CommandBar.Abstract.cs ├── CommandBar.cs ├── CommandBar.iOS.cs ├── CommandBarElementCollection.cs ├── ContentControl.Abstract.cs ├── ContentControl.Droid.cs ├── ContentControl.cs ├── ContentControl.iOS.cs ├── ContentPresenter.Abstract.cs ├── ContentPresenter.Droid.cs ├── ContentPresenter.cs ├── ContentPresenter.iOS.cs ├── Control.Abstract.cs ├── Control.Droid.cs ├── Control.cs ├── Control.iOS.cs ├── DataTemplateSelector.cs ├── DatePicker.cs ├── DatePicker.iOS.cs ├── DefinitionBase.cs ├── FontFamily.cs ├── FontStyle.cs ├── FontStyleType.cs ├── FontStyles.cs ├── FontWeight.cs ├── FontWeightType.cs ├── FontWeights.cs ├── Grid.Abstract.cs ├── Grid.Droid.cs ├── Grid.cs ├── Grid.iOS.cs ├── HyperlinkButton.Abstract.cs ├── HyperlinkButton.Droid.cs ├── HyperlinkButton.cs ├── HyperlinkButton.iOS.cs ├── ICommandBarElement.cs ├── IPivotItemProvider.cs ├── Image.Abstract.cs ├── Image.Droid.cs ├── Image.cs ├── Image.iOS.cs ├── Input │ └── InputScope.cs ├── ItemCollection.cs ├── ItemsControl.Abstract.cs ├── ItemsControl.Droid.cs ├── ItemsControl.cs ├── ItemsControl.iOS.cs ├── ItemsPanelTemplate.cs ├── ListBox.Droid.cs ├── ListBox.cs ├── ListBox.iOS.cs ├── ListBoxItem.Abstract.cs ├── ListBoxItem.Droid.cs ├── ListBoxItem.cs ├── ListBoxItem.iOS.cs ├── ListPicker.Abstract.cs ├── ListPicker.Droid.cs ├── ListPicker.cs ├── ListPicker.iOS.cs ├── ManipulationMode.cs ├── Media │ ├── AppercodeColors.cs │ ├── ImageSource.Droid.cs │ ├── ImageSource.cs │ ├── ImageSource.iOS.cs │ ├── Imaging │ │ ├── BitmapCreateOptions.cs │ │ ├── BitmapImage.Abstract.cs │ │ ├── BitmapImage.Droid.cs │ │ ├── BitmapImage.cs │ │ ├── BitmapImage.iOS.cs │ │ ├── BitmapSource.cs │ │ └── DownloadProgressEventArgs.cs │ └── TokenizerHelper.cs ├── MediaElement.Abstract.cs ├── MediaElement.Droid.cs ├── MediaElement.cs ├── MediaElement.iOS.cs ├── NativeAppercodeFragment.cs ├── NativeControl │ ├── ActivityEventArgs.cs │ ├── BundleEventArgs.cs │ ├── CheckBoxDrawableHelper.cs │ ├── ContentViewGroup.cs │ ├── IndeterminateUIProgressView.cs │ ├── NativeContentControl.cs │ ├── NativeScrollViewer.cs │ ├── NativeToggleButton.cs │ ├── RadioButtonDrawableHelper.cs │ └── Wrapers │ │ ├── ClickDetector.cs │ │ ├── IClickableView.cs │ │ ├── IJavaFinalizable.cs │ │ ├── ISelectableView.cs │ │ ├── ITapableView.cs │ │ ├── NativeMediaPlayer.cs │ │ ├── TapDetector.cs │ │ ├── WrapedEditText.cs │ │ ├── WrapedImageView.cs │ │ ├── WrapedProgressBar.cs │ │ ├── WrapedTextView.cs │ │ ├── WrapedVideoView.cs │ │ ├── WrapedViewGroup.cs │ │ └── WrappedSeekBar.cs ├── Navigation │ ├── IFrame.cs │ ├── IFrameStyler.cs │ ├── NavigatedEventHandler.cs │ ├── NavigatingCancelEventArgs.cs │ ├── NavigatingCancelEventHandler.cs │ ├── NavigatingEventArgs.cs │ ├── NavigationEventArgs.cs │ ├── NavigationFailedEventArgs.cs │ ├── NavigationFailedEventHandler.cs │ ├── NavigationMode.cs │ ├── NavigationService.cs │ ├── NavigationStoppedEventHandler.cs │ ├── NavigationType.cs │ ├── Primitives │ │ ├── TabBarTab.cs │ │ ├── TabBarTabsCollection.cs │ │ └── ViewPagerPage.cs │ ├── StackNavigationFrame.Driod.cs │ ├── StackNavigationFrame.cs │ ├── StackNavigationFrame.iOS.cs │ ├── TabsNavigationFrame.Droid.cs │ ├── TabsNavigationFrame.cs │ └── TabsNavigationFrame.iOS.cs ├── NotifyEventArgs.cs ├── Orientation.cs ├── OrientationChangedEventArgs.cs ├── Page.cs ├── PageOrientation.cs ├── Panel.Abstract.cs ├── Panel.Droid.cs ├── Panel.cs ├── Panel.iOS.cs ├── PasswordBox.Abstract.cs ├── PasswordBox.Droid.cs ├── PasswordBox.cs ├── PasswordBox.iOS.cs ├── Pivot.Abstract.cs ├── Pivot.Droid.cs ├── Pivot.cs ├── Pivot.iOS.cs ├── PivotHeaderItem.cs ├── PivotHeaderMode.cs ├── PivotHeadersControl.Abstract.cs ├── PivotHeadersControl.Droid.cs ├── PivotHeadersControl.cs ├── PivotHeadersControl.iOS.cs ├── PivotItem.cs ├── PivotItemContainerGenerator.cs ├── PivotVirtualizingPanel.Abstract.cs ├── PivotVirtualizingPanel.Droid.cs ├── PivotVirtualizingPanel.cs ├── PivotVirtualizingPanel.iOS.cs ├── Popups │ ├── MessageDialog.Droid.cs │ ├── MessageDialog.cs │ ├── MessageDialog.iOS.cs │ └── UICommand.cs ├── PresentationFrameworkCollection.cs ├── Primitives │ ├── ButtonBase.Abstract.cs │ ├── ButtonBase.Droid.cs │ ├── ButtonBase.cs │ ├── ButtonBase.iOS.cs │ ├── GeneratorDirection.cs │ ├── GeneratorPosition.cs │ ├── IItemContainerGenerator.cs │ ├── IVirtualizingPanel.cs │ ├── IconElement.cs │ ├── IconElement.iOS.cs │ ├── ItemContainerGenerator.cs │ ├── PickerBase.Abstract.cs │ ├── PickerBase.Droid.cs │ ├── PickerBase.cs │ ├── PickerBase.iOS.cs │ ├── RangeBase.Abstract.cs │ ├── RangeBase.Droid.cs │ ├── RangeBase.cs │ ├── RangeBase.iOS.cs │ ├── Selector.cs │ ├── ToggleButton.Abstract.cs │ ├── ToggleButton.Droid.cs │ ├── ToggleButton.cs │ └── ToggleButton.iOS.cs ├── ProgressBar.Abstract.cs ├── ProgressBar.Droid.cs ├── ProgressBar.cs ├── ProgressBar.iOS.cs ├── ProgressRing.cs ├── ProgressRing.iOS.cs ├── RadioButton.Droid.cs ├── RadioButton.cs ├── RadioButton.iOS.cs ├── RangePicker.Abstract.cs ├── RangePicker.Droid.cs ├── RangePicker.cs ├── RangePicker.iOS.cs ├── RowDefinition.cs ├── RowDefinitionCollection.cs ├── ScrollBarVisibility.cs ├── ScrollViewer.Abstract.cs ├── ScrollViewer.Droid.cs ├── ScrollViewer.cs ├── ScrollViewer.iOS.cs ├── SelectionChangedEventHandler.cs ├── SelectionMode.cs ├── Slider.Abstract.cs ├── Slider.Droid.cs ├── Slider.cs ├── Slider.iOS.cs ├── StackPanel.Abstract.cs ├── StackPanel.Droid.cs ├── StackPanel.cs ├── StackPanel.iOS.cs ├── SupportedPageOrientation.cs ├── TextAlignment.cs ├── TextBlock.Abstract.cs ├── TextBlock.Droid.cs ├── TextBlock.cs ├── TextBlock.iOS.cs ├── TextBox.Abstract.cs ├── TextBox.Droid.cs ├── TextBox.cs ├── TextBox.iOS.cs ├── TextChangedEventHandler.cs ├── TextTrimming.cs ├── TextWrapping.cs ├── TypeConverters.cs ├── UIElement.Abstract.cs ├── UIElement.Droid.cs ├── UIElement.cs ├── UIElement.iOS.cs ├── UIElementCollection.cs ├── UserControl.Abstract.cs ├── UserControl.Droid.cs ├── UserControl.cs ├── UserControl.iOS.cs ├── Validation.cs ├── ValidationError.cs ├── ValidationErrorEventAction.cs ├── ValidationErrorEventArgs.cs ├── VirtualizingPanel.cs ├── VirtualizingStackPanel.Abstract.cs ├── VirtualizingStackPanel.Droid.cs ├── VirtualizingStackPanel.cs ├── VirtualizingStackPanel.iOS.cs ├── Visibility.cs ├── WebBrowser.Abstract.cs ├── WebBrowser.Droid.cs ├── WebBrowser.cs ├── WebBrowser.iOS.cs └── WebBrowserBase.cs ├── Data ├── Binding.cs ├── BindingBase.cs ├── BindingExpression.cs ├── BindingExpressionBase.cs ├── BindingMode.cs ├── BindingOperations.cs ├── CollectionView.cs ├── CollectionViewGroup.cs ├── CollectionViewSource.cs ├── FilterEventArgs.cs ├── FilterEventHandler.cs ├── IValueConverter.cs ├── RelativeSource.cs ├── RelativeSourceMode.cs └── UpdateSourceTrigger.cs ├── DataTemplate.cs ├── Device ├── GeoCoordinate.cs ├── ScreenProperties.Droid.cs ├── ScreenProperties.cs └── ScreenProperties.iOS.cs ├── FrameworkElementFactory.cs ├── FrameworkTemplate.Abstract.cs ├── FrameworkTemplate.cs ├── GridLength.cs ├── GridLengthConverter.cs ├── GridUnitType.cs ├── Helpers ├── EnumerableHelper.cs ├── ResourceDictionaryManager.cs ├── UIImageExtension.cs └── WeakEventHandler.cs ├── Input └── GestureEventArgs.cs ├── Internals ├── BaseValueSourceInternal.cs ├── BindingValueCache.cs ├── BindingValueChangedEventArgs.cs ├── Boxes │ └── BooleanBoxes.cs ├── CollectionView │ ├── CollectionViewGroupInternal.cs │ ├── CollectionViewGroupRoot.cs │ ├── CollectionViewProxy.cs │ ├── EnumerableCollectionView.cs │ ├── IViewLifetime.cs │ ├── ListCollectionView.cs │ ├── SortFieldComparer.cs │ ├── ViewManager.cs │ ├── ViewRecord.cs │ └── ViewTable.cs ├── DataContextChangedEventArgs.cs ├── DataContextChangedEventHandler.cs ├── DataContextChangedReason.cs ├── DefaultValueConverter.cs ├── DeferredReference.cs ├── DeferredResourceReference.cs ├── DependencyPropertyChangedWeakListener.cs ├── DependencySource.cs ├── DynamicValueConverter.cs ├── ExpressionMode.cs ├── Helpers │ ├── MathF.cs │ └── ThicknessExtensions.cs ├── ICollectionChangedListener.cs ├── IDataContextChangedListener.cs ├── IErrorsChangedListener.cs ├── IMarkupExtension.cs ├── ISealable.cs ├── InterfaceConverter.cs ├── LogicalOp.cs ├── ObjectSourceConverter.cs ├── ObjectTargetConverter.cs ├── PathParser │ ├── CLRPropertyListener.cs │ ├── DependencyPropertyAccessStepDescriptor.cs │ ├── DependencyPropertyListener.cs │ ├── IRaisePropertyPathStepChanged.cs │ ├── ISourcePropertyChanged.cs │ ├── IndexerListener.cs │ ├── IndexerPathStep.cs │ ├── IndexerPathStepDescriptor.cs │ ├── PropertyAccessPathStep.cs │ ├── PropertyAccessPathStepDescriptor.cs │ ├── PropertyListener.cs │ ├── PropertyPathChangedEventArgs.cs │ ├── PropertyPathListener.cs │ ├── PropertyPathStep.cs │ ├── PropertyPathStepChangedHandler.cs │ ├── PropertyPathStepDescriptor.cs │ ├── SourcePathStepDescriptor.cs │ ├── SourcePropertyPathStep.cs │ ├── WeakDependencyPropertyChangedListener.cs │ └── WeakPropertyChangedListener.cs ├── PropertyPathParser.cs ├── PropertyValue.cs ├── PropertyValueType.cs ├── ResourceDictionaryCollection.cs ├── ResourceReferenceExpression.cs ├── ResourcesChangeInfo.cs ├── ResourcesChangedEventArgs.cs ├── SourceDefaultValueConverter.cs ├── StyleHelper.cs ├── SystemConvertConverter.cs ├── TargetDefaultValueConverter.cs ├── TriggerCondition.cs ├── WeakCollectionChangedListener.cs ├── WeakDataContextChangedListener.cs ├── WeakErrorsChangedListener.cs └── WeakRefKey.cs ├── Key.snk ├── LICENSE.md ├── LogicalTreeHelper.cs ├── Markup ├── StaticResource.cs └── TemplateBindingExtension.cs ├── PerfomanceLogger.cs ├── Properties └── AssemblyInfo.cs ├── PropertyPath.cs ├── README.md ├── Resources ├── anim │ ├── fadein.xml │ └── fadeout.xml └── iOS_Resources │ ├── CheckBoxChecked.png │ ├── CheckBoxChecked@2x.png │ ├── CheckBoxCheckediOS6.png │ ├── CheckBoxCheckediOS6@2x.png │ ├── CheckBoxUnchecked.png │ ├── CheckBoxUnchecked@2x.png │ ├── CheckBoxUncheckediOS6.png │ ├── CheckBoxUncheckediOS6@2x.png │ ├── ProgressIndicatorBar.png │ ├── ProgressIndicatorBar@2x.png │ ├── ProgressIndicatorDefault.png │ ├── ProgressIndicatorDefault@2x.png │ ├── RadioButtonChecked.png │ ├── RadioButtonChecked@2x.png │ ├── RadioButtonCheckediOS6.png │ ├── RadioButtonCheckediOS6@2x.png │ ├── RadioButtonUnchecked.png │ ├── RadioButtonUnchecked@2x.png │ ├── RadioButtonUncheckediOS6.png │ └── RadioButtonUncheckediOS6@2x.png ├── RoutedEvent.cs ├── RoutedEventArgs.cs ├── RoutingStrategy.cs ├── StylesAndResources ├── ApplicationResourcesAttribute.cs ├── ResourceDictionary.cs ├── Setter.Abstract.cs ├── Setter.cs ├── SetterBase.cs ├── SetterBaseCollection.cs ├── Style.Abstract.cs └── Style.cs ├── System.Windows ├── CornerRadius.cs ├── Duration.cs ├── ExceptionRoutedEventArgs.cs ├── Expression.cs ├── GetReadOnlyValueCallback.cs ├── HorizontalAlignment.cs ├── Input │ └── FocusManager.cs ├── Markup │ └── IAddChild.cs ├── Media │ ├── Brush.Droid.cs │ ├── Brush.cs │ ├── Brush.iOS.cs │ ├── BrushMappingMode.cs │ ├── Color.Droid.cs │ ├── Color.cs │ ├── Color.iOS.cs │ ├── ColorInterpolationMode.cs │ ├── GradientBrush.cs │ ├── GradientSpreadMethod.cs │ ├── GradientStop.cs │ ├── GradientStopCollection.cs │ ├── ImageBrush.Droid.cs │ ├── ImageBrush.cs │ ├── MediaElementState.cs │ ├── SolidColorBrush.Droid.cs │ ├── SolidColorBrush.cs │ ├── SolidColorBrush.iOS.cs │ └── Stretch.cs ├── NullableBoolConverter.cs ├── ReadOnlyFrameworkPropertyMetadata.cs ├── RoutedPropertyChangedEventHandler.cs ├── Thickness.cs ├── Thickness.iOS.cs ├── Threading │ ├── Dispatcher.Abstract.cs │ ├── Dispatcher.Droid.cs │ ├── Dispatcher.cs │ ├── Dispatcher.iOS.cs │ ├── DispatcherObject.Abstract.cs │ ├── DispatcherObject.Droid.cs │ ├── DispatcherObject.cs │ └── DispatcherObject.iOS.cs └── VerticalAlignment.cs ├── TemplateBindingExpression.cs ├── TextChangedEventArgs.cs ├── ValueConverterFactory.cs ├── packages.Appercode.UIFramework.Droid.config └── packages └── repositories.config /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "mono"] 2 | path = mono 3 | url = https://github.com/Appercode/mono.git 4 | -------------------------------------------------------------------------------- /ControlTemplate.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System; 3 | using System.Windows; 4 | 5 | namespace Appercode.UI 6 | { 7 | /// 8 | /// Specifies the visual structure of a Control that can be shared across multiple instances of the control. 9 | /// 10 | public class ControlTemplate : FrameworkTemplate 11 | { 12 | public static readonly DependencyProperty TargetTypeProperty = 13 | DependencyProperty.Register("TargetType", typeof(Type), typeof(ControlTemplate), new PropertyMetadata(typeof(Type))); 14 | 15 | public Type TargetType 16 | { 17 | get { return (Type)this.GetValue(TargetTypeProperty); } 18 | set { this.SetValue(TargetTypeProperty, value); } 19 | } 20 | 21 | public override DependencyObject LoadContent() 22 | { 23 | var content = base.LoadContent(); 24 | var uiElement = content as UIElement; 25 | if (uiElement != null) 26 | { 27 | uiElement.ParentChanged += this.ContentParentChanged; 28 | } 29 | 30 | return content; 31 | } 32 | 33 | private void ContentParentChanged(object sender, EventArgs e) 34 | { 35 | var uiElement = sender as UIElement; 36 | if (uiElement != null && uiElement.Parent != null) 37 | { 38 | this.VisualTree.SetTemplateBindings(uiElement.Parent); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Controls/AppBarButton.iOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class AppBarButton 7 | { 8 | internal UIBarButtonItem GetNativeItem() 9 | { 10 | UIBarButtonItem nativeItem; 11 | var icon = this.Icon; 12 | if (icon != null) 13 | { 14 | nativeItem = icon.GetNativeItem(); 15 | } 16 | else 17 | { 18 | var label = this.Label; 19 | nativeItem = string.IsNullOrEmpty(label) ? 20 | new UIBarButtonItem(UIBarButtonSystemItem.Done) 21 | : new UIBarButtonItem { Title = label }; 22 | } 23 | 24 | nativeItem.Clicked += this.NativeItemClicked; 25 | return nativeItem; 26 | } 27 | 28 | protected internal override void NativeInit() 29 | { 30 | // Do nothing and do not call base method for AppBarButton 31 | } 32 | 33 | private void NativeItemClicked(object sender, EventArgs e) 34 | { 35 | this.OnClick(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Controls/AppercodePage.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class AppercodePage 10 | { 11 | public NativeAppercodeFragment NativeFragment 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | protected override void OnNavigatedTo(Navigation.NavigationEventArgs e) 18 | { 19 | base.OnNavigatedTo(e); 20 | } 21 | 22 | protected internal override void NativeInit() 23 | { 24 | base.NativeInit(); 25 | if (this.Context != null && this.Parent != null) 26 | { 27 | if (NativeFragment == null) 28 | { 29 | var nativeApperCodeFragment = new NativeAppercodeFragment(this.NativeUIElement); 30 | this.NativeFragment = nativeApperCodeFragment; 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Controls/BitmapIcon.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Primitives; 2 | using System; 3 | using System.Windows; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | public partial class BitmapIcon : IconElement 8 | { 9 | public static readonly DependencyProperty UriSourceProperty = 10 | DependencyProperty.Register("UriSource", typeof(Uri), typeof(BitmapIcon), new PropertyMetadata(UriSourceChanged)); 11 | 12 | public Uri UriSource 13 | { 14 | get { return (Uri)GetValue(UriSourceProperty); } 15 | set { this.SetValue(UriSourceProperty, value); } 16 | } 17 | 18 | private static void UriSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 19 | { 20 | var icon = d as BitmapIcon; 21 | if (icon != null) 22 | { 23 | icon.UriSourceChanged(e.NewValue as Uri); 24 | } 25 | } 26 | 27 | partial void UriSourceChanged(Uri newValue); 28 | } 29 | } -------------------------------------------------------------------------------- /Controls/Border.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Markup; 8 | using System.Windows.Media; 9 | 10 | namespace Appercode.UI.Controls 11 | { 12 | [ContentProperty("Child")] 13 | public partial class Border 14 | { 15 | 16 | private Thickness NativePadding { get; set; } 17 | private Thickness NativeBorderThickness { get; set; } 18 | private CornerRadius NativeCornerRadius { get; set; } 19 | private Brush NativeBackground { get; set; } 20 | private Brush NativeBorderBrush { get; set; } 21 | 22 | private void OnNativeContentChanged(UIElement oldValue, UIElement newValue) 23 | { 24 | } 25 | 26 | private void NativeArrangeContent(RectangleF finalRect) 27 | { 28 | } 29 | 30 | private SizeF NativeMeasureContent(SizeF availableSize) 31 | { 32 | return new SizeF(); 33 | } 34 | private void NativeOnBackgroundChanged() 35 | { 36 | } 37 | 38 | private void NativeOnBorderBrushChanged() 39 | { 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Controls/Button.Abstract.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls 2 | { 3 | public partial class Button 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Controls/Button.Droid.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Windows; 3 | using Appercode.UI.Controls.NativeControl; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | public partial class Button 8 | { 9 | protected internal override void NativeInit() 10 | { 11 | base.NativeInit(); 12 | 13 | if (this.NativeUIElement != null && this.controlTemplateInstance == null) 14 | { 15 | ((NativeContentControl)this.NativeUIElement).SetBackgroundDrawable(new Android.Widget.Button(this.Context).Background); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Controls/Button.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using Appercode.UI.Controls.Primitives; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | /// 8 | /// Represents a button control, which reacts to the event. 9 | /// 10 | public partial class Button : ButtonBase 11 | { 12 | /// 13 | /// Initializes a new instance of the Button class. 14 | /// 15 | public Button() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Controls/Canvas.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class Canvas 10 | { 11 | private void NativeReorderChildren() 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/Canvas.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class Canvas 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.Parent != null) 11 | { 12 | if (this.NativeUIElement == null) 13 | { 14 | this.NativeUIElement = new UIView(); 15 | } 16 | base.NativeInit(); 17 | } 18 | } 19 | 20 | protected override void ArrangeChilds(CGSize size) 21 | { 22 | this.UpdateLayout(); 23 | } 24 | 25 | private void NativeReorderChildren() 26 | { 27 | foreach (var child in this.Children) 28 | { 29 | this.NativeUIElement.BringSubviewToFront(child.NativeUIElement); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Controls/CheckBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Appercode.UI.Controls.Primitives; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class CheckBox : ToggleButton 10 | { 11 | public CheckBox() 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Controls/ClickMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public enum ClickMode 6 | { 7 | Release, 8 | Press, 9 | Hover 10 | } 11 | } -------------------------------------------------------------------------------- /Controls/ColumnDefinitionCollection.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Base; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | /// 6 | /// Provides access to an ordered, strongly typed collection of ColumnDefinition objects. 7 | /// 8 | public class ColumnDefinitionCollection : GridSizeCollectionBase 9 | { 10 | /// 11 | /// Initializes the column definition collection for specified grid 12 | /// 13 | internal ColumnDefinitionCollection(Grid owner) : base(owner) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Controls/CommandBar.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Markup; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | [ContentProperty("PrimaryCommands")] 7 | public partial class CommandBar : IAddChild 8 | { 9 | void IAddChild.AddChild(object value) 10 | { 11 | if (value == null) 12 | { 13 | throw new ArgumentNullException("value"); 14 | } 15 | 16 | var barElement = value as ICommandBarElement; 17 | if (barElement == null) 18 | { 19 | throw new ArgumentException(string.Format("Cannot add child of type {0}.", value.GetType())); 20 | } 21 | 22 | this.PrimaryCommands.Add(barElement); 23 | } 24 | 25 | void IAddChild.AddText(string text) 26 | { 27 | throw new NotSupportedException(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Controls/CommandBar.iOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class CommandBar : Control 6 | { 7 | protected internal override void NativeInit() 8 | { 9 | // Do nothing and do not call base method for CommandBar 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Controls/CommandBarElementCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public sealed class CommandBarElementCollection : PresentationFrameworkCollection 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /Controls/ContentControl.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Windows; 3 | using System.Windows.Markup; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | [ContentProperty("Content")] 8 | public partial class ContentControl : Control 9 | { 10 | public object NativeContent { get; set; } 11 | 12 | protected virtual void NativeArrangeContent(RectangleF contentFrame) 13 | { 14 | } 15 | 16 | private static double GetDefaultFontSize() 17 | { 18 | return 0d; 19 | } 20 | 21 | private void OnNativeContentChanged(object oldContent, object newContent) 22 | { 23 | } 24 | 25 | private SizeF NativeMeasureContent(SizeF availableSize) 26 | { 27 | return new SizeF(); 28 | } 29 | 30 | protected Thickness GetNativePadding() 31 | { 32 | return new Thickness(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Controls/ContentControl.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Controls/ContentControl.cs -------------------------------------------------------------------------------- /Controls/ContentPresenter.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class ContentPresenter 10 | { 11 | private void NativeTemplateUpdate(UIElement oldValue, UIElement value) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/Control.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | public partial class Control 8 | { 9 | protected bool NativeIsEnabled { get; set; } 10 | 11 | protected double NativeFontSize { get; set; } 12 | 13 | protected TextWrapping NativeTextWrapping { get; set; } 14 | 15 | protected TextTrimming NativeTextTrimming { get; set; } 16 | 17 | protected FontWeight NativeFontWeight { get; set; } 18 | 19 | protected FontStyle NativeFontStyle { get; set; } 20 | 21 | protected FontFamily NativeFontFamily { get; set; } 22 | 23 | protected Brush NativeForeground { get; set; } 24 | 25 | protected Thickness NativePadding { get; set; } 26 | 27 | protected virtual bool InternalFocus() 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | 32 | protected virtual void OnIsEnabledChanged() 33 | { 34 | } 35 | 36 | protected virtual void NativeOnbackgroundChange() 37 | { 38 | } 39 | 40 | private static double GetDefaultFontSize() 41 | { 42 | return 0.0; 43 | } 44 | 45 | private void RemoveControlTemplateInstance() 46 | { 47 | } 48 | 49 | private void AddControlTemplateInstance() 50 | { 51 | } 52 | 53 | private void ApplyNativePadding(Thickness padding) 54 | { 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Controls/DataTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | /// Provides a way to choose a based on the data object and the data-bound element. 6 | public class DataTemplateSelector 7 | { 8 | /// Initializes a new instance of the class. 9 | public DataTemplateSelector() 10 | { 11 | } 12 | 13 | /// When overridden in a derived class, returns a based on custom logic. 14 | /// Returns a or null. The default value is null. 15 | /// The data object for which to select the template. 16 | /// The data-bound object. 17 | public virtual DataTemplate SelectTemplate(object item, DependencyObject container) 18 | { 19 | return null; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Controls/FontStyleType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | internal enum FontStyleType 9 | { 10 | Normal, 11 | Oblique, 12 | Italic 13 | } 14 | } -------------------------------------------------------------------------------- /Controls/FontStyles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public static class FontStyles 9 | { 10 | public static FontStyle Italic 11 | { 12 | get 13 | { 14 | return FontStyles.EnsureFontStyle(FontStyleType.Italic); 15 | } 16 | } 17 | 18 | public static FontStyle Normal 19 | { 20 | get 21 | { 22 | return FontStyles.EnsureFontStyle(FontStyleType.Normal); 23 | } 24 | } 25 | 26 | internal static FontStyle EnsureFontStyle(FontStyleType style) 27 | { 28 | switch (style) 29 | { 30 | case FontStyleType.Normal: 31 | case FontStyleType.Italic: 32 | { 33 | return new FontStyle(style); 34 | } 35 | default: 36 | { 37 | throw new ArgumentOutOfRangeException("style"); 38 | } 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Controls/FontWeightType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum FontWeightType 9 | { 10 | Thin = 100, 11 | ExtraLight = 200, 12 | Light = 300, 13 | Normal = 400, 14 | Medium = 500, 15 | SemiBold = 600, 16 | Bold = 700, 17 | ExtraBold = 800, 18 | Black = 900, 19 | ExtraBlack = 950 20 | } 21 | } -------------------------------------------------------------------------------- /Controls/Grid.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class Grid 6 | { 7 | /// 8 | /// This definition is only for XAML XSD schema generation 9 | /// 10 | public static readonly DependencyProperty ColumnDefinitionsProperty = 11 | DependencyProperty.Register( 12 | "ColumnDefinitions", 13 | typeof(ColumnDefinitionCollection), 14 | typeof(Grid), 15 | new PropertyMetadata()); 16 | 17 | /// 18 | /// This definition is only for XAML XSD schema generation 19 | /// 20 | public static readonly DependencyProperty RowDefinitionsProperty = 21 | DependencyProperty.Register( 22 | "RowDefinitions", 23 | typeof(RowDefinitionCollection), 24 | typeof(Grid), 25 | new PropertyMetadata()); 26 | 27 | private void NativeChildrenCollectionChanged() 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Controls/Grid.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.Content; 2 | using Android.Views; 3 | using Appercode.UI.Controls.NativeControl.Wrapers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Controls 9 | { 10 | public class NativeGrid : WrapedViewGroup 11 | { 12 | public NativeGrid(Context context) 13 | : base(context) 14 | { 15 | } 16 | 17 | protected override void OnLayout(bool changed, int l, int t, int r, int b) 18 | { 19 | } 20 | } 21 | 22 | public partial class Grid 23 | { 24 | protected internal override void NativeInit() 25 | { 26 | if (this.Parent != null && this.Context != null) 27 | { 28 | if (this.NativeUIElement == null) 29 | { 30 | var nativeGrid = new NativeGrid(this.Context); 31 | var layoutParams = new ViewGroup.LayoutParams(0, 0); 32 | layoutParams.Width = double.IsNaN(this.NativeWidth) ? ViewGroup.LayoutParams.WrapContent : (int)this.NativeWidth; 33 | layoutParams.Height = double.IsNaN(this.NativeHeight) ? ViewGroup.LayoutParams.WrapContent : (int)this.NativeHeight; 34 | nativeGrid.LayoutParameters = layoutParams; 35 | 36 | this.NativeUIElement = nativeGrid; 37 | } 38 | } 39 | 40 | base.NativeInit(); 41 | } 42 | 43 | protected override void ArrangeChilds(System.Drawing.SizeF size) 44 | { 45 | this.ArrangeCells(size); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Controls/Grid.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class Grid 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.Parent != null) 11 | { 12 | if (this.NativeUIElement == null) 13 | { 14 | this.NativeUIElement = new UIView(); 15 | } 16 | base.NativeInit(); 17 | } 18 | } 19 | 20 | protected override void ArrangeChilds(CGSize size) 21 | { 22 | this.ArrangeCells(size); 23 | } 24 | 25 | private void NativeChildrenCollectionChanged() 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Controls/HyperlinkButton.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class HyperlinkButton 10 | { 11 | public Uri NativeNavigateUri { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Controls/HyperlinkButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using Appercode.UI.Controls.Primitives; 4 | using Appercode.UI.Controls.Media; 5 | using System.Windows.Media; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class HyperlinkButton : ButtonBase 10 | { 11 | public static readonly DependencyProperty NavigateUriProperty = 12 | DependencyProperty.Register("NavigateUri", typeof(Uri), typeof(HyperlinkButton), 13 | new PropertyMetadata(null, (d, e) => 14 | { 15 | ((HyperlinkButton)d).NativeNavigateUri = (Uri)e.NewValue; 16 | })); 17 | 18 | static HyperlinkButton() 19 | { 20 | ForegroundProperty.AddOwner(typeof(HyperlinkButton), new PropertyMetadata(new SolidColorBrush(AppercodeColors.Blue))); 21 | } 22 | 23 | public HyperlinkButton() 24 | { 25 | } 26 | 27 | public Uri NavigateUri 28 | { 29 | get { return (Uri)this.GetValue(NavigateUriProperty); } 30 | set { this.SetValue(NavigateUriProperty, value); } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Controls/ICommandBarElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public interface ICommandBarElement 6 | { 7 | event EventHandler VisibilityChanged; 8 | 9 | bool IsCompact { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Controls/IPivotItemProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Appercode.UI.Controls; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public interface IPivotItemProvider 10 | { 11 | int Count { get; } 12 | UIElement CreateItemElement(int position); 13 | object GetHeader(int position); 14 | } 15 | } -------------------------------------------------------------------------------- /Controls/Image.Abstract.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Media; 2 | using System; 3 | using System.Windows; 4 | using System.Windows.Media; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public sealed partial class Image : UIElement 9 | { 10 | private void ApplyNativeSource() 11 | { 12 | } 13 | 14 | private void ApplyNativeStretch() 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Controls/Input/InputScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls.Input 8 | { 9 | public enum InputScope 10 | { 11 | Default, 12 | Text, 13 | Search, 14 | Numbers, 15 | EmailAddress 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Controls/ItemCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public class ItemCollection : PresentationFrameworkCollection 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Controls/ItemsControl.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Markup; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | // ReSharper disable CSharpWarnings::CS1591 6 | /// 7 | /// Represents a control that can be used to present a collection of items. 8 | /// 9 | [ContentProperty("Items")] 10 | public partial class ItemsControl 11 | { 12 | 13 | /// 14 | /// Adds panel to native visual tree 15 | /// 16 | protected virtual void AddPanelToNativeContainer() 17 | { 18 | } 19 | 20 | /// 21 | /// Removes panel from native visual tree 22 | /// 23 | protected virtual void RemovePanelFromNativeContainer() 24 | { 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Controls/ItemsControl.Droid.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.NativeControl.Wrapers; 2 | using System.Drawing; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class ItemsControl 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.Parent != null) 11 | { 12 | if(this.NativeUIElement == null) 13 | { 14 | this.NativeUIElement = new WrapedViewGroup(this.Context); 15 | this.AddPanelToNativeContainer(); 16 | } 17 | base.NativeInit(); 18 | } 19 | } 20 | 21 | protected override void NativeArrange(RectangleF finalRect) 22 | { 23 | base.NativeArrange(finalRect); 24 | finalRect.Width -= this.Margin.HorizontalThicknessF(); 25 | finalRect.Height -= this.Margin.VerticalThicknessF(); 26 | this.panel.Arrange(new RectangleF(PointF.Empty, finalRect.Size)); 27 | } 28 | 29 | protected virtual void AddPanelToNativeContainer() 30 | { 31 | if (this.NativeUIElement != null) 32 | { 33 | ((WrapedViewGroup)this.NativeUIElement).AddView(this.panel.NativeUIElement); 34 | } 35 | } 36 | 37 | protected virtual void RemovePanelFromNativeContainer() 38 | { 39 | if (this.NativeUIElement != null) 40 | { 41 | ((WrapedViewGroup)this.NativeUIElement).RemoveAllViews(); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Controls/ItemsControl.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class ItemsControl 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.Parent != null) 11 | { 12 | if (this.NativeUIElement == null) 13 | { 14 | this.NativeUIElement = new UIView(); 15 | this.NativeUIElement.ClipsToBounds = true; 16 | this.AddPanelToNativeContainer(); 17 | } 18 | base.NativeInit(); 19 | } 20 | } 21 | protected override void NativeArrange(CGRect finalRect) 22 | { 23 | base.NativeArrange(finalRect); 24 | finalRect.Width -= this.Margin.HorizontalThicknessF(); 25 | finalRect.Height -= this.Margin.VerticalThicknessF(); 26 | this.panel.Arrange(new CGRect(CGPoint.Empty, finalRect.Size)); 27 | } 28 | 29 | protected virtual void AddPanelToNativeContainer() 30 | { 31 | if (this.NativeUIElement != null) 32 | { 33 | this.NativeUIElement.AddSubview(this.panel.NativeUIElement); 34 | } 35 | } 36 | 37 | protected virtual void RemovePanelFromNativeContainer() 38 | { 39 | this.panel.NativeUIElement.RemoveFromSuperview(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Controls/ItemsPanelTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls 2 | { 3 | public class ItemsPanelTemplate : FrameworkTemplate 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Controls/ListBox.Droid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls 14 | { 15 | public partial class ListBox 16 | { 17 | public override View NativeUIElement 18 | { 19 | get 20 | { 21 | return this.scrollViewer == null ? base.NativeUIElement : this.scrollViewer.NativeUIElement; 22 | } 23 | protected internal set 24 | { 25 | if(this.scrollViewer == null) 26 | { 27 | base.NativeUIElement = value; 28 | return; 29 | } 30 | this.scrollViewer.NativeUIElement = value; 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Controls/ListBox.iOS.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class ListBox 6 | { 7 | public override UIView NativeUIElement 8 | { 9 | get 10 | { 11 | return this.scrollViewer == null ? base.NativeUIElement : this.scrollViewer.NativeUIElement; 12 | } 13 | protected internal set 14 | { 15 | if(this.scrollViewer == null) 16 | { 17 | base.NativeUIElement = value; 18 | return; 19 | } 20 | this.scrollViewer.NativeUIElement = value; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Controls/ListBoxItem.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public partial class ListBoxItem 9 | { 10 | protected bool NativeIsSelected { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Controls/ListBoxItem.Droid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls 14 | { 15 | public partial class ListBoxItem 16 | { 17 | protected bool NativeIsSelected { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Controls/ListBoxItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | #if __IOS__ 4 | using RectangleF = CoreGraphics.CGRect; 5 | using SizeF = CoreGraphics.CGSize; 6 | #else 7 | using System.Drawing; 8 | #endif 9 | 10 | namespace Appercode.UI.Controls 11 | { 12 | public partial class ListBoxItem : ContentControl 13 | { 14 | public static readonly DependencyProperty IsSelectedProperty = 15 | DependencyProperty.Register("IsSelected", typeof(bool), typeof(ListBoxItem), new PropertyMetadata(false, (d, e) => 16 | { 17 | ((ListBoxItem)d).NativeIsSelected = (bool)e.NewValue; 18 | })); 19 | 20 | public bool IsSelected 21 | { 22 | get { return (bool)this.GetValue(IsSelectedProperty); } 23 | set { this.SetValue(IsSelectedProperty, value); } 24 | } 25 | 26 | protected override void ArrangeContent(SizeF finalSize) 27 | { 28 | var padding = this.Padding; 29 | var availableSize = new SizeF( 30 | finalSize.Width - padding.HorizontalThicknessF() - this.Margin.HorizontalThicknessF(), 31 | finalSize.Height - padding.VerticalThicknessF() - this.Margin.VerticalThicknessF()); 32 | var contentSize = this.MessureContent(availableSize); 33 | 34 | var contentFrame = new RectangleF(padding.LeftF(), padding.TopF(), contentSize.Width, contentSize.Height); 35 | 36 | this.NativeArrangeContent(contentFrame); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Controls/ListBoxItem.iOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class ListBoxItem 6 | { 7 | protected bool NativeIsSelected { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Controls/ListPicker.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class ListPicker 10 | { 11 | private void ApplyNativeSelectedValue(object newValue) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/ListPicker.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Primitives; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | /// 7 | /// Provides control with popup to select item from list 8 | /// 9 | public partial class ListPicker : PickerBase 10 | { 11 | public static readonly DependencyProperty SelectedValueProperty = 12 | DependencyProperty.Register("SelectedValue", typeof(object), typeof(ListPicker), new PropertyMetadata(null, (d, e) => 13 | { 14 | ((ListPicker)d).ApplyNativeSelectedValue(e.NewValue); 15 | })); 16 | 17 | /// 18 | /// Initializes instans of ListPicker class 19 | /// 20 | public ListPicker() 21 | { 22 | } 23 | 24 | public object SelectedValue 25 | { 26 | get { return (object)this.GetValue(SelectedValueProperty); } 27 | set { this.SetValue(SelectedValueProperty, value); } 28 | } 29 | 30 | protected override void OnItemsSourceChanged(object oldValue, object newValue) 31 | { 32 | base.OnItemsSourceChanged(oldValue, newValue); 33 | this.RefreshItems(); 34 | } 35 | 36 | partial void RefreshItems(); 37 | } 38 | } -------------------------------------------------------------------------------- /Controls/ManipulationMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum ManipulationMode 9 | { 10 | Control, 11 | System 12 | } 13 | } -------------------------------------------------------------------------------- /Controls/Media/ImageSource.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.Graphics; 2 | 3 | namespace Appercode.UI.Controls.Media 4 | { 5 | public abstract partial class ImageSource 6 | { 7 | public abstract Bitmap GetBitmap(); 8 | } 9 | } -------------------------------------------------------------------------------- /Controls/Media/ImageSource.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Media.Imaging; 2 | using System; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Controls.Media 8 | { 9 | internal enum ImageStatus 10 | { 11 | None, 12 | Loading, 13 | Loaded, 14 | Failed 15 | } 16 | 17 | [TypeConverterAttribute(typeof(ImageSourceConverter))] 18 | public abstract partial class ImageSource : DependencyObject 19 | { 20 | internal ImageSource() 21 | { 22 | } 23 | 24 | internal ImageStatus ImageLoadStatus 25 | { 26 | get; 27 | set; 28 | } 29 | } 30 | 31 | public class ImageSourceConverter : TypeConverter 32 | { 33 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 34 | { 35 | if (sourceType == typeof(string)) 36 | { 37 | return true; 38 | } 39 | return base.CanConvertFrom(context, sourceType); 40 | } 41 | 42 | public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) 43 | { 44 | string s = value as string; 45 | if (s != null) 46 | { 47 | if (s.Contains(':')) 48 | { 49 | return new BitmapImage(new Uri(s, UriKind.Absolute)); 50 | } 51 | else 52 | { 53 | return new BitmapImage(new Uri(s, UriKind.Relative)); 54 | } 55 | } 56 | return base.ConvertFrom(context, culture, value); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Controls/Media/ImageSource.iOS.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace Appercode.UI.Controls.Media 4 | { 5 | public partial class ImageSource 6 | { 7 | public abstract UIImage GetUIImage(); 8 | } 9 | } -------------------------------------------------------------------------------- /Controls/Media/Imaging/BitmapCreateOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls.Media.Imaging 7 | { 8 | // http://msdn.microsoft.com/ru-ru/library/system.windows.media.imaging.bitmapcreateoptions(v=vs.110).aspx 9 | public enum BitmapCreateOptions 10 | { 11 | None = 0, 12 | DelayCreation = 2, 13 | IgnoreImageCache = 8, 14 | BackgroundCreation = 16 15 | } 16 | } -------------------------------------------------------------------------------- /Controls/Media/Imaging/BitmapImage.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls.Media.Imaging 8 | { 9 | public partial class BitmapImage 10 | { 11 | private void UriChanged(Uri uri1, Uri uri2) 12 | { 13 | this.ImageFailed(this, new System.Windows.ExceptionRoutedEventArgs()); 14 | this.ImageOpened(this, new System.Windows.ExceptionRoutedEventArgs()); 15 | this.DownloadProgress(this, new DownloadProgressEventArgs()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Controls/Media/Imaging/DownloadProgressEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Controls.Media.Imaging 8 | { 9 | public class DownloadProgressEventArgs : EventArgs 10 | { 11 | internal DownloadProgressEventArgs() 12 | { 13 | } 14 | 15 | internal DownloadProgressEventArgs(int progress) 16 | { 17 | this.Progress = progress; 18 | } 19 | 20 | public int Progress 21 | { 22 | get; 23 | internal set; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Controls/Media/TokenizerHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Controls.Media 8 | { 9 | internal static class TokenizerHelper 10 | { 11 | internal static char GetNumericListSeparator(IFormatProvider provider) 12 | { 13 | char chr = ','; 14 | NumberFormatInfo instance = NumberFormatInfo.GetInstance(provider); 15 | if (instance.NumberDecimalSeparator.Length > 0 && chr == instance.NumberDecimalSeparator[0]) 16 | { 17 | chr = ';'; 18 | } 19 | return chr; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Controls/MediaElement.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Media; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | public partial class MediaElement 8 | { 9 | private Nullable NativeAudioStreamIndex { get; set; } 10 | 11 | private bool NativeAutoPlay { get; set; } 12 | 13 | private double NativeBalance { get; set; } 14 | 15 | private bool NativeIsMuted { get; set; } 16 | 17 | private TimeSpan NativePosition { get; set; } 18 | 19 | private Uri NativeSource { get; set; } 20 | 21 | private Stretch NativeStretch { get; set; } 22 | 23 | private double NativeVolume { get; set; } 24 | 25 | private static double GetNativeVolumeInitialValue() 26 | { 27 | return 0; 28 | } 29 | 30 | private void NativePause() 31 | { 32 | } 33 | 34 | private void NativePlay() 35 | { 36 | } 37 | 38 | private void NativeStop() 39 | { 40 | } 41 | 42 | private void NativeArrangeVideoView(RectangleF finalRect) 43 | { 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Controls/NativeControl/ActivityEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using System; 3 | 4 | namespace Appercode.UI.Controls.NativeControl 5 | { 6 | public class ActivityEventArgs : EventArgs 7 | { 8 | public ActivityEventArgs(Activity activity) 9 | { 10 | this.Activity = activity; 11 | } 12 | 13 | public Activity Activity { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/NativeControl/BundleEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Android.OS; 2 | using System; 3 | 4 | namespace Appercode.UI.Controls.NativeControl 5 | { 6 | public class BundleEventArgs : EventArgs 7 | { 8 | public BundleEventArgs(Bundle bundle) 9 | { 10 | this.Bundle = bundle; 11 | } 12 | 13 | public Bundle Bundle { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/NativeControl/CheckBoxDrawableHelper.cs: -------------------------------------------------------------------------------- 1 | using Android.Content; 2 | using Android.Graphics.Drawables; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Controls.NativeControl 9 | { 10 | public class CheckBoxDrawableHelper : Android.Widget.CheckBox 11 | { 12 | private CheckBoxDrawableHelper(Context context) 13 | : base(context) 14 | { 15 | } 16 | 17 | public static Drawable BackgroundImage 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public static Drawable GetDrawable(Context context) 24 | { 25 | var cb = new CheckBoxDrawableHelper(context); 26 | return BackgroundImage; 27 | } 28 | 29 | public override void SetButtonDrawable(Android.Graphics.Drawables.Drawable d) 30 | { 31 | BackgroundImage = d; 32 | 33 | base.SetButtonDrawable(d); 34 | } 35 | 36 | public override void SetButtonDrawable(int resid) 37 | { 38 | BackgroundImage = this.Context.Resources.GetDrawable(resid); 39 | 40 | base.SetButtonDrawable(resid); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Controls/NativeControl/NativeContentControl.cs: -------------------------------------------------------------------------------- 1 | using Android.Content; 2 | using Android.Views; 3 | using Appercode.UI.Controls.NativeControl.Wrapers; 4 | 5 | namespace Appercode.UI.Controls.NativeControl 6 | { 7 | public class NativeContentControl : WrapedViewGroup 8 | { 9 | public NativeContentControl(Context context) 10 | : base(context) 11 | { 12 | } 13 | 14 | protected override void OnLayout(bool changed, int l, int t, int r, int b) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Controls/NativeControl/NativeToggleButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl 14 | { 15 | public class NativeToggleButton : NativeContentControl 16 | { 17 | private static int[] checkedStateSet = 18 | { 19 | Android.Resource.Attribute.StateChecked 20 | }; 21 | 22 | public NativeToggleButton(Context context) 23 | : base(context) 24 | { 25 | } 26 | 27 | public bool IsChecked 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | protected override int[] OnCreateDrawableState(int extraSpace) 34 | { 35 | var drawableState = base.OnCreateDrawableState(extraSpace + 1); 36 | if (this.IsChecked) 37 | { 38 | NativeToggleButton.MergeDrawableStates(drawableState, checkedStateSet); 39 | } 40 | return drawableState; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Controls/NativeControl/RadioButtonDrawableHelper.cs: -------------------------------------------------------------------------------- 1 | using Android.Content; 2 | using Android.Graphics.Drawables; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Controls.NativeControl 9 | { 10 | public class RadioButtonDrawableHelper : Android.Widget.RadioButton 11 | { 12 | private RadioButtonDrawableHelper(Context context) 13 | : base(context) 14 | { 15 | } 16 | 17 | public static Drawable BackgroundImage 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public static Drawable GetDrawable(Context context) 24 | { 25 | var cb = new RadioButtonDrawableHelper(context); 26 | 27 | return BackgroundImage; 28 | } 29 | 30 | public override void SetButtonDrawable(Android.Graphics.Drawables.Drawable d) 31 | { 32 | BackgroundImage = d; 33 | 34 | base.SetButtonDrawable(d); 35 | } 36 | 37 | public override void SetButtonDrawable(int resid) 38 | { 39 | BackgroundImage = this.Context.Resources.GetDrawable(resid); 40 | 41 | base.SetButtonDrawable(resid); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/ClickDetector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | internal class ClickDetector 16 | { 17 | private View owner; 18 | 19 | public ClickDetector(View owner) 20 | { 21 | this.owner = owner; 22 | } 23 | 24 | public bool Detect(MotionEvent e) 25 | { 26 | if (e.Action == MotionEventActions.Up && this.PointInView(e.GetX(), e.GetY())) 27 | { 28 | return true; 29 | } 30 | else 31 | { 32 | return false; 33 | } 34 | } 35 | 36 | private bool PointInView(float localX, float localY) 37 | { 38 | float slop = ViewConfiguration.Get(this.owner.Context).ScaledTouchSlop; 39 | return localX >= -slop && localY >= -slop && localX < ((this.owner.Right - this.owner.Left) + slop) && 40 | localY < ((this.owner.Bottom - this.owner.Top) + slop); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/IClickableView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | 5 | namespace Appercode.UI.Controls.NativeControl.Wrapers 6 | { 7 | internal interface IClickableView 8 | { 9 | event EventHandler NativeClick; 10 | } 11 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/IJavaFinalizable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | public interface IJavaFinalizable 16 | { 17 | event EventHandler JavaFinalized; 18 | } 19 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/ISelectableView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | internal interface ISelectableView 16 | { 17 | event EventHandler NativeSelect; 18 | void WrapedNativeRaiseSelect(); 19 | } 20 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/ITapableView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace Appercode.UI.Controls.NativeControl.Wrapers 5 | { 6 | public interface ITapableView 7 | { 8 | event EventHandler NativeTap; 9 | void WrapedNativeRaiseTap(); 10 | } 11 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/NativeMediaPlayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Android.App; 6 | using Android.Content; 7 | using Android.Media; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | public class NativeMediaPlayer : MediaPlayer 16 | { 17 | public NativeMediaPlayer() 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/WrapedEditText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | public class WrapedEditText : EditText, ITapableView, IJavaFinalizable, View.IOnClickListener 16 | { 17 | public WrapedEditText(IntPtr handle, Android.Runtime.JniHandleOwnership transfer) 18 | : base(handle, transfer) 19 | { 20 | this.SetOnClickListener(this); 21 | } 22 | 23 | public WrapedEditText(Context context) 24 | : base(context) 25 | { 26 | this.SetOnClickListener(this); 27 | } 28 | 29 | public event EventHandler NativeTap; 30 | public event EventHandler JavaFinalized; 31 | 32 | public void WrapedNativeRaiseTap() 33 | { 34 | if (this.NativeTap != null) 35 | { 36 | this.NativeTap(this, null); 37 | } 38 | } 39 | 40 | protected override void JavaFinalize() 41 | { 42 | if (this.JavaFinalized != null) 43 | { 44 | this.JavaFinalized(null, null); 45 | } 46 | base.JavaFinalize(); 47 | } 48 | 49 | public void OnClick(View v) 50 | { 51 | WrapedNativeRaiseTap(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/WrapedImageView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | public class WrapedImageView : ImageView, ITapableView, IJavaFinalizable, View.IOnClickListener 16 | { 17 | public WrapedImageView(Context context) 18 | : base(context) 19 | { 20 | this.SetOnClickListener(this); 21 | } 22 | 23 | public event EventHandler NativeTap; 24 | public event EventHandler JavaFinalized; 25 | 26 | public void WrapedNativeRaiseTap() 27 | { 28 | if (this.NativeTap != null) 29 | { 30 | this.NativeTap(this, null); 31 | } 32 | } 33 | 34 | protected override void JavaFinalize() 35 | { 36 | if (this.JavaFinalized != null) 37 | { 38 | this.JavaFinalized(null, null); 39 | } 40 | base.JavaFinalize(); 41 | } 42 | 43 | public void OnClick(View v) 44 | { 45 | WrapedNativeRaiseTap(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/WrapedProgressBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace Appercode.UI.Controls.NativeControl.Wrapers 14 | { 15 | public class WrapedProgressBar : Android.Widget.ProgressBar, ITapableView, IJavaFinalizable, View.IOnClickListener 16 | { 17 | public WrapedProgressBar(IntPtr handle, Android.Runtime.JniHandleOwnership transfer) 18 | : base(handle, transfer) 19 | { 20 | this.SetOnClickListener(this); 21 | } 22 | 23 | public WrapedProgressBar(Context context, Android.Util.IAttributeSet attrs, int defStyle) 24 | : base(context, attrs, defStyle) 25 | { 26 | this.SetOnClickListener(this); 27 | } 28 | 29 | public event EventHandler NativeTap; 30 | public event EventHandler JavaFinalized; 31 | 32 | public void WrapedNativeRaiseTap() 33 | { 34 | if (this.NativeTap != null) 35 | { 36 | this.NativeTap(this, null); 37 | } 38 | } 39 | 40 | protected override void JavaFinalize() 41 | { 42 | if (this.JavaFinalized != null) 43 | { 44 | this.JavaFinalized(null, null); 45 | } 46 | base.JavaFinalize(); 47 | } 48 | 49 | public void OnClick(View v) 50 | { 51 | WrapedNativeRaiseTap(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Controls/NativeControl/Wrapers/WrappedSeekBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.Content; 4 | using Android.Views; 5 | using Android.Widget; 6 | 7 | namespace Appercode.UI.Controls.NativeControl.Wrapers 8 | { 9 | public class WrappedSeekBar : SeekBar, ITapableView, IJavaFinalizable, View.IOnClickListener 10 | { 11 | public WrappedSeekBar(IntPtr handle, Android.Runtime.JniHandleOwnership transfer) 12 | : base(handle, transfer) 13 | { 14 | this.SetOnClickListener(this); 15 | } 16 | 17 | public WrappedSeekBar(Context context) 18 | : base(context) 19 | { 20 | this.SetOnClickListener(this); 21 | } 22 | 23 | public event EventHandler NativeTap; 24 | public event EventHandler JavaFinalized; 25 | 26 | public void WrapedNativeRaiseTap() 27 | { 28 | if (this.NativeTap != null) 29 | { 30 | this.NativeTap(this, null); 31 | } 32 | } 33 | 34 | protected override void JavaFinalize() 35 | { 36 | if (this.JavaFinalized != null) 37 | { 38 | this.JavaFinalized(null, null); 39 | } 40 | base.JavaFinalize(); 41 | } 42 | 43 | public void OnClick(View v) 44 | { 45 | WrapedNativeRaiseTap(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Controls/Navigation/IFrame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Threading; 4 | 5 | namespace Appercode.UI.Controls.Navigation 6 | { 7 | /// 8 | /// interface for navigaion frames in Appercode 9 | /// 10 | public interface IFrame 11 | { 12 | event NavigatedEventHandler Navigated; 13 | 14 | event NavigatingCancelEventHandler Navigating; 15 | 16 | event NavigationFailedEventHandler NavigationFailed; 17 | 18 | event NavigationStoppedEventHandler NavigationStopped; 19 | 20 | /// 21 | /// Returns an IEnumerable that can be used to enumerate the entries in back navigation history for a Frame. 22 | /// 23 | IEnumerable BackStack { get; } 24 | 25 | int CacheSize 26 | { 27 | get; 28 | set; 29 | } 30 | 31 | bool CanGoBack 32 | { 33 | get; 34 | } 35 | 36 | bool CanGoForward 37 | { 38 | get; 39 | } 40 | 41 | AppercodePage CurrentPage 42 | { 43 | get; 44 | } 45 | 46 | Dispatcher Dispatcher 47 | { 48 | get; 49 | } 50 | 51 | bool IsNavigationInProgress 52 | { 53 | get; 54 | } 55 | 56 | bool Navigate(Type sourcePageType, NavigationType navigationType); 57 | 58 | bool Navigate(Type sourcePageType, object parameter, NavigationType navigationType); 59 | 60 | ////bool IsInDesignModeX(); 61 | 62 | void Load(); 63 | 64 | void GoBack(); 65 | void GoForward(); 66 | 67 | void RemoveBackEntry(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Controls/Navigation/IFrameStyler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls.Navigation 4 | { 5 | public interface IFrameStyler 6 | { 7 | void StyleNavBar(StackNavigationFrame stackNavigationFrame); 8 | 9 | void StyleTabBar(TabsNavigationFrame tabsNavigationFrame); 10 | } 11 | } -------------------------------------------------------------------------------- /Controls/Navigation/NavigatedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls.Navigation 7 | { 8 | public delegate void NavigatedEventHandler(object sender, NavigationEventArgs e); 9 | } 10 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigatingCancelEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace Appercode.UI.Controls.Navigation 5 | { 6 | public sealed class NavigatingCancelEventArgs : CancelEventArgs 7 | { 8 | public NavigatingCancelEventArgs(Type pageType, NavigationMode mode) 9 | { 10 | this.SourcePageType = pageType; 11 | this.NavigationMode = mode; 12 | this.IsCancelable = true; 13 | this.IsNavigationInitiator = true; 14 | } 15 | 16 | public NavigatingCancelEventArgs(Type pageType, NavigationMode mode, bool isCancelable, bool isNavigationInitiator) 17 | { 18 | this.SourcePageType = pageType; 19 | this.NavigationMode = mode; 20 | this.IsCancelable = isCancelable; 21 | this.IsNavigationInitiator = isNavigationInitiator; 22 | } 23 | 24 | public bool IsCancelable 25 | { 26 | get; 27 | private set; 28 | } 29 | 30 | public bool IsNavigationInitiator 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | public NavigationMode NavigationMode 37 | { 38 | get; 39 | private set; 40 | } 41 | 42 | public Type SourcePageType 43 | { 44 | get; 45 | private set; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigatingCancelEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls.Navigation 2 | { 3 | public delegate void NavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e); 4 | } 5 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigatingEventArgs.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | #endregion //Using directives 8 | 9 | namespace Appercode.UI.Controls.Navigation 10 | { 11 | /// 12 | /// Represents an event arguments object for navigating events 13 | /// 14 | public class NavigatingEventArgs : CancelEventArgs 15 | { 16 | #region Constructors 17 | 18 | /// 19 | /// Initializes the event arguments object 20 | /// 21 | public NavigatingEventArgs() 22 | { 23 | } 24 | 25 | #endregion // Constructors 26 | 27 | #region Properties 28 | 29 | /// 30 | /// Gets or sets related URI 31 | /// 32 | public Uri Uri { get; internal set; } 33 | 34 | #endregion // Properties 35 | } 36 | } -------------------------------------------------------------------------------- /Controls/Navigation/NavigationFailedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls.Navigation 7 | { 8 | public sealed class NavigationFailedEventArgs : EventArgs 9 | { 10 | internal NavigationFailedEventArgs(Uri uri, Exception error) 11 | { 12 | this.Uri = uri; 13 | this.Exception = error; 14 | } 15 | 16 | internal NavigationFailedEventArgs(Type sourcePageType, Exception error) 17 | { 18 | this.SourcePageType = sourcePageType; 19 | this.Exception = error; 20 | } 21 | 22 | /// 23 | /// Gets or sets related URI 24 | /// 25 | public Uri Uri { get; internal set; } 26 | 27 | public Exception Exception 28 | { 29 | get; 30 | private set; 31 | } 32 | 33 | public bool Handled 34 | { 35 | get; 36 | set; 37 | } 38 | 39 | public Type SourcePageType 40 | { 41 | get; 42 | private set; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigationFailedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls.Navigation 7 | { 8 | public delegate void NavigationFailedEventHandler(object sender, NavigationFailedEventArgs e); 9 | } 10 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigationMode.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls.Navigation 2 | { 3 | public enum NavigationMode : byte 4 | { 5 | New, 6 | Back, 7 | Forward, 8 | Refresh, 9 | Reset 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigationStoppedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls.Navigation 7 | { 8 | public delegate void NavigationStoppedEventHandler(object sender, NavigationEventArgs e); 9 | } 10 | -------------------------------------------------------------------------------- /Controls/Navigation/NavigationType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls.Navigation 4 | { 5 | public enum NavigationType 6 | { 7 | Default = 0, 8 | Modal 9 | } 10 | } -------------------------------------------------------------------------------- /Controls/Navigation/Primitives/TabBarTabsCollection.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls.Navigation.Primitives 2 | { 3 | public class TabBarTabsCollection : PresentationFrameworkCollection 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Controls/NotifyEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | /// 6 | /// Provides data for the WebBrowser control WebBrowser.ScriptNotify event. 7 | /// 8 | public class NotifyEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets argument data passed from JavaScript. 12 | /// 13 | public string Value { get; internal set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/Orientation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public enum Orientation 6 | { 7 | Vertical, 8 | Horizontal 9 | } 10 | } -------------------------------------------------------------------------------- /Controls/OrientationChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public class OrientationChangedEventArgs : EventArgs 9 | { 10 | private PageOrientation orientation; 11 | 12 | public OrientationChangedEventArgs(PageOrientation orientation) 13 | { 14 | this.orientation = orientation; 15 | } 16 | 17 | public PageOrientation Orientation 18 | { 19 | get 20 | { 21 | return this.orientation; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Controls/PageOrientation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum PageOrientation 9 | { 10 | None = 0, 11 | Portrait = 1, 12 | Landscape = 2, 13 | PortraitUp = 5, 14 | PortraitDown = 9, 15 | LandscapeLeft = 18, 16 | LandscapeRight = 34 17 | } 18 | } -------------------------------------------------------------------------------- /Controls/Panel.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Windows.Markup; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | [ContentProperty("Children")] 9 | public abstract partial class Panel 10 | { 11 | private void NativeOnbackgroundChange() 12 | { 13 | } 14 | 15 | internal void AddNativeChildView(UIElement item) 16 | { 17 | } 18 | 19 | internal void RemoveNativeChildView(UIElement item) 20 | { 21 | } 22 | 23 | /// 24 | /// Arranges childs of panel in 25 | /// 26 | /// 27 | protected virtual void ArrangeChilds(System.Drawing.SizeF size) 28 | { 29 | } 30 | 31 | /// 32 | /// Cache measured size of panel 33 | /// 34 | /// 35 | protected void SetMeasuredSize(SizeF measuredSize) 36 | { 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Controls/PasswordBox.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class PasswordBox 10 | { 11 | public string NativePassword { get; set; } 12 | 13 | public int NativeMaxLength { get; set; } 14 | 15 | private void NativeSelect(int start, int length) 16 | { 17 | PasswordChanged(this, new RoutedEventArgs()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Controls/Pivot.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class Pivot 10 | { 11 | private void SetNativeViewPagerToHeaderControl() 12 | { 13 | } 14 | 15 | private void RemoveNativeViewPagerFromHeaderControl() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Controls/Pivot.Droid.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.NativeControl.Wrapers; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class Pivot 6 | { 7 | protected override void AddPanelToNativeContainer() 8 | { 9 | base.AddPanelToNativeContainer(); 10 | 11 | if (this.PivotHeader != null) 12 | { 13 | ((WrapedViewGroup)this.NativeUIElement).AddView(((UIElement)this.PivotHeader).NativeUIElement); 14 | } 15 | } 16 | 17 | private void SetNativeViewPagerToHeaderControl() 18 | { 19 | if (PivotHeader != null && this.panel != null && this.panel.NativeUIElement != null) 20 | { 21 | PivotHeader.SetNativeViewPager((WrappedViewPager)this.panel.NativeUIElement); 22 | } 23 | } 24 | 25 | private void RemoveNativeViewPagerFromHeaderControl() 26 | { 27 | if (PivotHeader != null) 28 | { 29 | PivotHeader.FreeNativeViewPager(); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Controls/Pivot.iOS.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls 2 | { 3 | public partial class Pivot 4 | { 5 | protected override void AddPanelToNativeContainer() 6 | { 7 | base.AddPanelToNativeContainer(); 8 | 9 | if (this.NativeUIElement != null) 10 | { 11 | this.NativeUIElement.AddSubview(((UIElement)this.PivotHeader).NativeUIElement); 12 | } 13 | } 14 | 15 | private void SetNativeViewPagerToHeaderControl() 16 | { 17 | if (this.PivotHeader != null && this.panel != null) 18 | { 19 | this.PivotHeader.SetVirtualizingPanel((PivotVirtualizingPanel)this.panel); 20 | } 21 | } 22 | 23 | private void RemoveNativeViewPagerFromHeaderControl() 24 | { 25 | if (this.PivotHeader != null && this.panel != null) 26 | { 27 | this.PivotHeader.FreeVirtualizingPanel(); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Controls/PivotHeaderItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public class PivotHeaderItem : ListBoxItem 6 | { 7 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) 8 | { 9 | base.OnPropertyChanged(e); 10 | 11 | if (e.Property == ListBoxItem.IsSelectedProperty) 12 | { 13 | int maxIteration = 4; 14 | for (var ancestor = this.Parent; maxIteration >= 0 && ancestor != null; --maxIteration, ancestor = ancestor.Parent) 15 | { 16 | if (ancestor is PivotHeadersControl) 17 | { 18 | ((PivotHeadersControl)ancestor).NotifyItemSelectionChanged(this, (bool)e.OldValue, (bool)e.NewValue); 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Controls/PivotHeadersControl.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Appercode.UI.Controls 9 | { 10 | public partial class PivotHeadersControl 11 | { 12 | } 13 | 14 | public partial class CirclePivotHeaderControl : Control, IPivotHeaderControl 15 | { 16 | public IEnumerable ItemsSource { get; set; } 17 | 18 | public int SelectedIndex { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Controls/PivotItem.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public class PivotItem : ContentControl 6 | { 7 | public static readonly DependencyProperty HeaderProperty = 8 | DependencyProperty.Register("Header", typeof(object), typeof(PivotItem), new PropertyMetadata(null)); 9 | 10 | public PivotItem() 11 | { 12 | this.HorizontalAlignment = HorizontalAlignment.Stretch; 13 | this.VerticalAlignment = VerticalAlignment.Stretch; 14 | } 15 | 16 | public object Header 17 | { 18 | get { return (object)GetValue(HeaderProperty); } 19 | set { SetValue(HeaderProperty, value); } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Controls/PivotItemContainerGenerator.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Primitives; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public class PivotItemContainerGenerator : ItemContainerGenerator 7 | { 8 | internal PivotItemContainerGenerator(FrameworkElementFactory containerFactory, ItemCollection collection) 9 | : base(containerFactory, collection) { } 10 | 11 | internal override DependencyObject LinkContainerToItem(int index, DependencyObject container) 12 | { 13 | var itemData = this.collection[index] as PivotItem; 14 | return itemData ?? base.LinkContainerToItem(index, container); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Controls/PivotVirtualizingPanel.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Specialized; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public partial class PivotVirtualizingPanel 6 | { 7 | public int CurrentPage { get; set; } 8 | 9 | public void ItemsUpdated(NotifyCollectionChangedEventArgs e) 10 | { 11 | } 12 | 13 | public void RefreshNativeAdapter() 14 | { 15 | } 16 | 17 | private void ArrangeCurrentlyInstantiatedElements() 18 | { 19 | } 20 | 21 | private void ArrangeItemAtPosition(UIElement res, int position) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Controls/Popups/MessageDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Appercode.UI.Controls.Popups 4 | { 5 | public sealed partial class MessageDialog 6 | { 7 | public MessageDialog(string content) 8 | : this(content, null) 9 | { 10 | } 11 | 12 | public MessageDialog(string content, string title) 13 | { 14 | this.Content = content; 15 | this.Title = title; 16 | this.Commands = new List(); 17 | } 18 | 19 | public uint CancelCommandIndex { get; set; } 20 | 21 | public IList Commands { get; private set; } 22 | 23 | public string Content { get; set; } 24 | 25 | public uint DefaultCommandIndex { get; set; } 26 | 27 | public string Title { get; set; } 28 | 29 | public void ShowAsync() 30 | { 31 | this.NativeShowAsync(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Controls/Popups/UICommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Input; 6 | 7 | namespace Appercode.UI.Controls.Popups 8 | { 9 | public delegate void UICommandInvokedHandler(UICommand command); 10 | 11 | public sealed class UICommand 12 | { 13 | public UICommand(string label):this(label, null) 14 | { 15 | } 16 | 17 | public UICommand(string label, UICommandInvokedHandler action) 18 | { 19 | this.Label = label; 20 | this.Action = action; 21 | } 22 | 23 | internal string Label 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | internal UICommandInvokedHandler Action 30 | { 31 | get; 32 | set; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Controls/Primitives/ButtonBase.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Input; 6 | 7 | namespace Appercode.UI.Controls.Primitives 8 | { 9 | public partial class ButtonBase 10 | { 11 | 12 | public ICommand NativeCommand { get; set; } 13 | 14 | public Controls.ClickMode NativeClickMode { get; set; } 15 | 16 | public object NativeCommandParameter { get; set; } 17 | 18 | public bool NativeIsPressed { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Controls/Primitives/ButtonBase.Droid.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using Appercode.UI.Controls.NativeControl.Wrapers; 3 | using System; 4 | using System.Windows.Input; 5 | 6 | namespace Appercode.UI.Controls.Primitives 7 | { 8 | public partial class ButtonBase 9 | { 10 | protected ClickMode NativeClickMode 11 | { 12 | get; 13 | set; 14 | } 15 | 16 | protected bool NativeIsPressed 17 | { 18 | get { return (this.NativeUIElement.Pressed); } 19 | } 20 | 21 | protected internal override void NativeInit() 22 | { 23 | base.NativeInit(); 24 | if (this.NativeUIElement != null && this.NativeUIElement is IClickableView) 25 | { 26 | ((IClickableView)this.NativeUIElement).NativeClick -= this.ButtonBase_NativeClick; 27 | ((IClickableView)this.NativeUIElement).NativeClick += this.ButtonBase_NativeClick; 28 | } 29 | } 30 | 31 | protected override void NativeArrange(RectangleF finalRect) 32 | { 33 | base.NativeArrange(finalRect); 34 | if (controlTemplateInstance != null && this.controlTemplateInstance.NativeUIElement is IClickableView) 35 | { 36 | ((IClickableView)this.controlTemplateInstance.NativeUIElement).NativeClick -= this.ButtonBase_NativeClick; 37 | ((IClickableView)this.controlTemplateInstance.NativeUIElement).NativeClick += this.ButtonBase_NativeClick; 38 | } 39 | } 40 | 41 | private void ButtonBase_NativeClick(object sender, EventArgs e) 42 | { 43 | if (this.IsEnabled) 44 | { 45 | this.OnClick(); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Controls/Primitives/ButtonBase.iOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls.Primitives 4 | { 5 | public partial class ButtonBase 6 | { 7 | internal override bool ChildrenShouldForwardTouch 8 | { 9 | get { return this.IsEnabled; } 10 | } 11 | 12 | protected bool NativeIsPressed 13 | { 14 | set { } 15 | } 16 | 17 | protected ClickMode NativeClickMode 18 | { 19 | set { } 20 | } 21 | 22 | protected override void OnContentChanged(object oldContent, object newContent) 23 | { 24 | base.OnContentChanged(oldContent, newContent); 25 | var element = newContent as UIElement; 26 | if (element != null) 27 | { 28 | element.NativeUIElement.UserInteractionEnabled = false; 29 | } 30 | } 31 | 32 | internal override void OnTouchDown() 33 | { 34 | base.OnTouchDown(); 35 | if (this.IsEnabled && this.ClickMode == ClickMode.Press) 36 | { 37 | this.OnClick(); 38 | } 39 | } 40 | 41 | internal override void OnTouchUp() 42 | { 43 | base.OnTouchUp(); 44 | if (this.IsEnabled && this.ClickMode == ClickMode.Release) 45 | { 46 | this.OnClick(); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Controls/Primitives/GeneratorDirection.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Controls.Primitives 2 | { 3 | public enum GeneratorDirection 4 | { 5 | Forward, 6 | Backward, 7 | } 8 | } -------------------------------------------------------------------------------- /Controls/Primitives/IItemContainerGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Controls.Primitives 8 | { 9 | public interface IItemContainerGenerator 10 | { 11 | IItemContainerGenerator GetItemContainerGeneratorForPanel(Panel panel); 12 | 13 | IDisposable StartAt(GeneratorPosition position, GeneratorDirection direction, bool allowStartAtRealizedItem); 14 | 15 | DependencyObject GenerateNext(out bool isNewlyRealized); 16 | 17 | void PrepareItemContainer(DependencyObject container); 18 | 19 | void RemoveAll(); 20 | 21 | void Remove(GeneratorPosition position, int count); 22 | 23 | GeneratorPosition GeneratorPositionFromIndex(int itemIndex); 24 | 25 | int IndexFromGeneratorPosition(GeneratorPosition position); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Controls/Primitives/IVirtualizingPanel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Specialized; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.Controls.Primitives 5 | { 6 | public interface IVirtualizingPanel 7 | { 8 | /// 9 | /// Generator for containers of items(for ListBoxItem for ex.) 10 | /// 11 | ItemContainerGenerator Generator { get; set; } 12 | 13 | /// 14 | /// Gets or set ScrollViewer virtualisation will be based on 15 | /// 16 | ScrollViewer ScrollOwner { get; set; } 17 | 18 | bool HasNativeScroll { get; } 19 | 20 | void ItemsUpdated(NotifyCollectionChangedEventArgs e); 21 | 22 | /// 23 | /// Set IsSelected of realized item 24 | /// 25 | /// index of element 26 | /// value to set 27 | /// true if IsSelected was set, otherwise false 28 | bool SetIsSelectedOnRealizedItem(int index, bool value); 29 | 30 | void SetPadding(Thickness padding); 31 | } 32 | } -------------------------------------------------------------------------------- /Controls/Primitives/IconElement.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace Appercode.UI.Controls.Primitives 5 | { 6 | public abstract partial class IconElement : UIElement 7 | { 8 | public static readonly DependencyProperty ForegroundProperty = 9 | DependencyProperty.Register("Foreground", typeof(Brush), typeof(IconElement)); 10 | 11 | public Brush Foreground 12 | { 13 | get { return (Brush)GetValue(ForegroundProperty); } 14 | set { this.SetValue(ForegroundProperty, value); } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Controls/Primitives/IconElement.iOS.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace Appercode.UI.Controls.Primitives 4 | { 5 | public abstract partial class IconElement : UIElement 6 | { 7 | protected internal abstract UIBarButtonItem GetNativeItem(); 8 | } 9 | } -------------------------------------------------------------------------------- /Controls/Primitives/PickerBase.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls.Primitives 8 | { 9 | public partial class PickerBase 10 | { 11 | public void NativeShow() 12 | { 13 | } 14 | 15 | public void NativeDismiss() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Controls/Primitives/RangeBase.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls.Primitives { 8 | public partial class RangeBase { 9 | internal double NativeLargeChange { get; set; } 10 | internal double NativeMaximum { get; set; } 11 | internal double NativeMinimum { get; set; } 12 | internal double NativeSmallChange { get; set; } 13 | internal double NativeValue { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/Primitives/ToggleButton.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Controls.Primitives 8 | { 9 | public partial class ToggleButton 10 | { 11 | protected bool? NativeIsChecked { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Controls/ProgressBar.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class ProgressBar 10 | { 11 | private bool NativeIsIndeterminate { get; set; } 12 | 13 | private void ApplyNativeIsIndeterminate(bool p) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Controls/ProgressRing.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Media; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | public partial class ProgressRing : Control 8 | { 9 | public static readonly DependencyProperty IsActiveProperty = 10 | DependencyProperty.Register("IsActive", typeof(bool), typeof(ProgressRing), new PropertyMetadata(false, OnIsActiveChanged)); 11 | 12 | static ProgressRing() 13 | { 14 | ForegroundProperty.AddOwner(typeof(ProgressRing), new PropertyMetadata(new SolidColorBrush(AppercodeColors.White))); 15 | } 16 | 17 | public bool IsActive 18 | { 19 | get { return (bool)GetValue(IsActiveProperty); } 20 | set { this.SetValue(IsActiveProperty, value); } 21 | } 22 | 23 | private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 24 | { 25 | var control = d as ProgressRing; 26 | if (control != null && e.NewValue is bool) 27 | { 28 | control.IsActiveChanged((bool)e.NewValue); 29 | } 30 | } 31 | 32 | partial void IsActiveChanged(bool newValue); 33 | } 34 | } -------------------------------------------------------------------------------- /Controls/RangePicker.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class RangePicker 10 | { 11 | private void ApplyNativeLeftValue(object newValue) 12 | { 13 | } 14 | 15 | private void ApplyNativeRightValue(object newValue) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Controls/RangePicker.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | /// 6 | /// Class for pick range value from one 7 | /// 8 | public partial class RangePicker : ListPicker 9 | { 10 | public static readonly DependencyProperty LeftValueProperty = 11 | DependencyProperty.Register("LeftValue", typeof(object), typeof(RangePicker), new PropertyMetadata(null, (d, e)=> 12 | { 13 | ((RangePicker)d).ApplyNativeLeftValue(e.NewValue); 14 | })); 15 | 16 | public static readonly DependencyProperty RightValueProperty = 17 | DependencyProperty.Register("RightValue", typeof(object), typeof(RangePicker), new PropertyMetadata(null, (d, e)=> 18 | { 19 | ((RangePicker)d).ApplyNativeRightValue(e.NewValue); 20 | })); 21 | 22 | /// 23 | /// Picker left value 24 | /// 25 | public object LeftValue 26 | { 27 | get { return (object)this.GetValue(LeftValueProperty); } 28 | set { this.SetValue(LeftValueProperty, value); } 29 | } 30 | 31 | /// 32 | /// Picker right value 33 | /// 34 | public object RightValue 35 | { 36 | get { return (object)this.GetValue(RightValueProperty); } 37 | set { this.SetValue(RightValueProperty, value); } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Controls/RowDefinitionCollection.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Base; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | /// 6 | /// Provides access to an ordered, strongly typed collection of RowDefinition objects. 7 | /// 8 | public class RowDefinitionCollection : GridSizeCollectionBase 9 | { 10 | /// 11 | /// Initializes the row definition collection for specified grid 12 | /// 13 | /// 14 | internal RowDefinitionCollection(Grid owner) : base(owner) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Controls/ScrollBarVisibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum ScrollBarVisibility 9 | { 10 | Disabled, 11 | Auto, 12 | ////Hidden, 13 | Visible 14 | } 15 | } -------------------------------------------------------------------------------- /Controls/ScrollViewer.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Appercode.UI.Controls 9 | { 10 | public partial class ScrollViewer 11 | { 12 | public ScrollBarVisibility NativeHorizontalScrollBarVisibility { get; set; } 13 | 14 | public ScrollBarVisibility NativeVerticalScrollBarVisibility { get; set; } 15 | 16 | private void SetContentScrolableSize(SizeF contentSize) 17 | { 18 | } 19 | 20 | private SizeF MeasureContent(SizeF sizeF) 21 | { 22 | return sizeF; 23 | } 24 | 25 | private void NativeScrollToHorizontalOffset(double offset) 26 | { 27 | } 28 | 29 | private void NativeScrollToVerticalOffset(double offset) 30 | { 31 | } 32 | 33 | private void NativeMoveToVerticalOffset(double offset) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Controls/SelectionChangedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public delegate void SelectionChangedEventHandler(object sender, SelectionChangedEventArgs e); 7 | 8 | public class SelectionChangedEventArgs : RoutedEventArgs 9 | { 10 | private object[] addedItems; 11 | 12 | private object[] removedItems; 13 | 14 | public SelectionChangedEventArgs(IList removedItems, IList addedItems) 15 | { 16 | if (removedItems == null) 17 | { 18 | throw new ArgumentNullException("removedItems"); 19 | } 20 | if (addedItems == null) 21 | { 22 | throw new ArgumentNullException("addedItems"); 23 | } 24 | this.removedItems = new object[removedItems.Count]; 25 | removedItems.CopyTo(this.removedItems, 0); 26 | this.addedItems = new object[addedItems.Count]; 27 | addedItems.CopyTo(this.addedItems, 0); 28 | } 29 | 30 | public IList AddedItems 31 | { 32 | get 33 | { 34 | return this.addedItems; 35 | } 36 | } 37 | 38 | public IList RemovedItems 39 | { 40 | get 41 | { 42 | return this.removedItems; 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Controls/SelectionMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum SelectionMode 9 | { 10 | Single, 11 | Multiple, 12 | ////Extended 13 | } 14 | } -------------------------------------------------------------------------------- /Controls/Slider.Abstract.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Appercode.UI.Controls 3 | { 4 | public partial class Slider 5 | { 6 | 7 | #region Properties 8 | 9 | internal bool NativeIsDirectionReversed { get; set; } 10 | internal bool NativeIsFocused { get; set; } 11 | internal Orientation NativeOrientation { get; set; } 12 | 13 | #endregion 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/StackPanel.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Controls 8 | { 9 | public partial class StackPanel 10 | { 11 | private void NativeChildrenCollectionChanged() 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Controls/StackPanel.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class StackPanel 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.Parent != null) 11 | { 12 | if (this.NativeUIElement == null) 13 | { 14 | this.NativeUIElement = new UIView { ClipsToBounds = true }; 15 | } 16 | 17 | base.NativeInit(); 18 | } 19 | } 20 | 21 | protected override void ArrangeChilds(CGSize size) 22 | { 23 | this.UpdateLayout(); 24 | } 25 | 26 | private void NativeChildrenCollectionChanged() 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Controls/SupportedPageOrientation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum SupportedPageOrientation 9 | { 10 | Portrait = 1, 11 | Landscape = 2, 12 | PortraitOrLandscape = 3 13 | } 14 | } -------------------------------------------------------------------------------- /Controls/TextAlignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum TextAlignment 9 | { 10 | Left, 11 | Center, 12 | Right, 13 | } 14 | } -------------------------------------------------------------------------------- /Controls/TextBlock.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | using System.Windows.Markup; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | [ContentProperty("Text")] 9 | public partial class TextBlock 10 | { 11 | protected string NativeText { get; set; } 12 | 13 | protected double NativeFontSize { get; set; } 14 | 15 | protected TextWrapping NativeTextWrapping { get; set; } 16 | 17 | protected TextTrimming NativeTextTrimming { get; set; } 18 | 19 | protected FontWeight NativeFontWeight { get; set; } 20 | 21 | protected FontStyle NativeFontStyle { get; set; } 22 | 23 | protected TextAlignment NativeTextAlignment { get; set; } 24 | 25 | protected FontFamily NativeFontFamily { get; set; } 26 | 27 | protected Brush NativeForeground { get; set; } 28 | 29 | protected Thickness NativePadding { get; set; } 30 | 31 | private static double GetDefaultFontSize() 32 | { 33 | return 17; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Controls/TextBox.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using Appercode.UI.Controls.Input; 7 | 8 | namespace Appercode.UI.Controls 9 | { 10 | public partial class TextBox 11 | { 12 | private string nativeText = null; 13 | 14 | public int NativeSelectionStart { get; set; } 15 | 16 | public int NativeSelectionLength { get; set; } 17 | 18 | public bool NativeIsReadOnly { get; set; } 19 | 20 | protected string NativeText 21 | { 22 | get 23 | { 24 | return nativeText; 25 | } 26 | set 27 | { 28 | this.nativeText = value; 29 | } 30 | } 31 | 32 | protected int NativeMaxLength { get; set; } 33 | 34 | protected bool NativeAcceptsReturn { get; set; } 35 | 36 | protected TextAlignment NativeTextAlignment { get; set; } 37 | 38 | protected InputScope NativeInputScope { get; set; } 39 | 40 | public void NativeSelect(int start, int length) 41 | { 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Controls/TextChangedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public delegate void TextChangedEventHandler(object sender, TextChangedEventArgs e); 7 | } -------------------------------------------------------------------------------- /Controls/TextTrimming.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public enum TextTrimming 6 | { 7 | None = 0, 8 | WordEllipsis = 2 9 | } 10 | } -------------------------------------------------------------------------------- /Controls/TextWrapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public enum TextWrapping 6 | { 7 | NoWrap = 1, 8 | Wrap = 2 9 | } 10 | } -------------------------------------------------------------------------------- /Controls/UIElement.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Windows.Markup; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | [RuntimeNameProperty("Name")] 7 | public partial class UIElement 8 | { 9 | protected internal object NativeUIElement { get; set; } 10 | 11 | internal virtual bool IsFocused 12 | { 13 | get { return false; } 14 | } 15 | 16 | private Visibility NativeVisibility { get; set; } 17 | 18 | private double NativeWidth { get; set; } 19 | 20 | private double NativeHeight { get; set; } 21 | 22 | /// 23 | /// Measure 24 | /// 25 | /// 26 | /// 27 | protected virtual SizeF NativeMeasureOverride(SizeF availableSize) 28 | { 29 | return new SizeF(); 30 | } 31 | 32 | /// 33 | /// Arrange 34 | /// 35 | /// 36 | protected virtual void NativeArrange(RectangleF finalRect) 37 | { 38 | } 39 | 40 | /// 41 | /// Init 42 | /// 43 | protected internal virtual void NativeInit() 44 | { 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Controls/UIElementCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Controls 4 | { 5 | public sealed class UIElementCollection : PresentationFrameworkCollection 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /Controls/UserControl.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Markup; 7 | 8 | namespace Appercode.UI.Controls 9 | { 10 | [ContentProperty("Content")] 11 | public partial class UserControl 12 | { 13 | private void OnNativeContentChanged(UIElement oldValue, UIElement newValue) 14 | { 15 | } 16 | 17 | protected void NativeArrangeContent(RectangleF finalRect) 18 | { 19 | } 20 | 21 | private SizeF NativeMeasureContent(SizeF availableSize) 22 | { 23 | return new SizeF(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Controls/UserControl.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace Appercode.UI.Controls 5 | { 6 | public partial class UserControl 7 | { 8 | protected internal override void NativeInit() 9 | { 10 | if (this.NativeUIElement == null) 11 | { 12 | this.NativeUIElement = new UIView(); 13 | } 14 | if (this.Content != null && this.Content.NativeUIElement != null) 15 | { 16 | this.NativeUIElement.AddSubview(this.Content.NativeUIElement); 17 | } 18 | this.NativeUIElement.ClipsToBounds = true; 19 | base.NativeInit(); 20 | } 21 | 22 | protected void NativeArrangeContent(CGRect finalRect) 23 | { 24 | this.Content.Arrange(finalRect); 25 | } 26 | 27 | private void OnNativeContentChanged(UIElement oldValue, UIElement newValue) 28 | { 29 | if (this.NativeUIElement != null) 30 | { 31 | if (oldValue != null) 32 | { 33 | oldValue.NativeUIElement.RemoveFromSuperview(); 34 | } 35 | LogicalTreeHelper.AddLogicalChild(this, newValue); 36 | this.NativeUIElement.AddSubview(newValue.NativeUIElement); 37 | } 38 | else 39 | { 40 | LogicalTreeHelper.AddLogicalChild(this, newValue); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Controls/ValidationError.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public class ValidationError 9 | { 10 | internal ValidationError(Exception exception, bool useDefaultString) 11 | { 12 | this.Exception = exception; 13 | if (useDefaultString) 14 | { 15 | this.ErrorContent = "ValidationError"; 16 | return; 17 | } 18 | this.ErrorContent = exception.Message; 19 | } 20 | 21 | internal ValidationError(object errorContent) 22 | { 23 | this.ErrorContent = errorContent; 24 | } 25 | 26 | public object ErrorContent 27 | { 28 | get; 29 | private set; 30 | } 31 | 32 | public Exception Exception 33 | { 34 | get; 35 | private set; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Controls/ValidationErrorEventAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum ValidationErrorEventAction 9 | { 10 | Added, 11 | Removed 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Controls/ValidationErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public class ValidationErrorEventArgs : RoutedEventArgs 9 | { 10 | internal ValidationErrorEventArgs(ValidationErrorEventAction action, ValidationError error) 11 | { 12 | this.Action = action; 13 | this.Error = error; 14 | this.Handled = false; 15 | } 16 | 17 | public ValidationErrorEventAction Action 18 | { 19 | get; 20 | internal set; 21 | } 22 | 23 | public ValidationError Error 24 | { 25 | get; 26 | internal set; 27 | } 28 | 29 | public bool Handled 30 | { 31 | get; 32 | set; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Controls/VirtualizingPanel.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls.Primitives; 2 | using System; 3 | using System.Collections.Specialized; 4 | using System.Windows; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public abstract class VirtualizingPanel : Panel, IVirtualizingPanel 9 | { 10 | protected ScrollViewer scrollOwner; 11 | 12 | public ItemContainerGenerator Generator { get; set; } 13 | 14 | public virtual bool HasNativeScroll 15 | { 16 | get 17 | { 18 | return false; 19 | } 20 | } 21 | 22 | public ScrollViewer ScrollOwner 23 | { 24 | get 25 | { 26 | return this.scrollOwner; 27 | } 28 | set 29 | { 30 | if (this.scrollOwner != null) 31 | { 32 | this.scrollOwner.ScrollChanged -= this.Value_ScrollChanged; 33 | } 34 | if (value != null) 35 | { 36 | value.ScrollChanged += this.Value_ScrollChanged; 37 | } 38 | this.scrollOwner = value; 39 | } 40 | } 41 | 42 | public virtual void ItemsUpdated(NotifyCollectionChangedEventArgs e) 43 | { 44 | throw new NotImplementedException(); 45 | } 46 | 47 | public virtual bool SetIsSelectedOnRealizedItem(int index, bool value) 48 | { 49 | throw new NotImplementedException(); 50 | } 51 | 52 | public virtual void SetPadding(Thickness padding) 53 | { 54 | } 55 | 56 | protected virtual void Value_ScrollChanged(object sender, ScrollChangedEventArgs e) 57 | { 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Controls/VirtualizingStackPanel.Abstract.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Appercode.UI.Controls 3 | { 4 | public partial class VirtualizingStackPanel 5 | { 6 | private void NativeScrollUpate(int oldFirstVirtulizedItemIndex, int newFirstVirtulizedItemIndex, int oldLastVirtulizedItemIndex, int newLastVirtulizedItemIndex) 7 | { 8 | } 9 | 10 | private void ReloadNativeItems() 11 | { 12 | } 13 | 14 | private bool NativeSetIsSelectedOnRealizedItem(int index, bool value) 15 | { 16 | return false; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Controls/Visibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Controls 7 | { 8 | public enum Visibility : byte 9 | { 10 | Visible, 11 | Collapsed 12 | } 13 | } -------------------------------------------------------------------------------- /Controls/WebBrowser.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | 5 | namespace Appercode.UI.Controls 6 | { 7 | [EditorBrowsable(EditorBrowsableState.Always)] 8 | public sealed partial class WebBrowser : WebBrowserBase, ISupportInitialize 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Controls/WebBrowserBase.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using Appercode.UI.Controls; 7 | #endregion //Using directives 8 | 9 | namespace Appercode.UI.Controls 10 | { 11 | /// 12 | /// Represents a base class for WebBrowser control 13 | /// 14 | /// 15 | /// I'm actually not sure if we need this class, but Original Microsoft class hierarchy does have it 16 | /// 17 | public class WebBrowserBase : Control 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /Data/BindingExpressionBase.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Data 4 | { 5 | public abstract class BindingExpressionBase : Expression 6 | { 7 | internal BindingExpressionBase() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Data/BindingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Data 7 | { 8 | public enum BindingMode 9 | { 10 | OneWay = 1, 11 | OneTime = 2, 12 | TwoWay = 3 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Data/FilterEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Data 4 | { 5 | public class FilterEventArgs : EventArgs 6 | { 7 | private object item; 8 | 9 | private bool accepted; 10 | 11 | internal FilterEventArgs(object item) 12 | { 13 | this.item = item; 14 | this.accepted = true; 15 | } 16 | 17 | public bool Accepted 18 | { 19 | get 20 | { 21 | return this.accepted; 22 | } 23 | set 24 | { 25 | this.accepted = value; 26 | } 27 | } 28 | 29 | public object Item 30 | { 31 | get 32 | { 33 | return this.item; 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Data/FilterEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Data 2 | { 3 | public delegate void FilterEventHandler(object sender, FilterEventArgs e); 4 | } -------------------------------------------------------------------------------- /Data/IValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Appercode.UI.Data 5 | { 6 | /// Provides a way to apply custom logic to a binding. 7 | public interface IValueConverter 8 | { 9 | /// Converts a value. 10 | /// A converted value. If the method returns null, the valid null value is used. 11 | /// The value produced by the binding source. 12 | /// The type of the binding target property. 13 | /// The converter parameter to use. 14 | /// The culture to use in the converter. 15 | object Convert(object value, Type targetType, object parameter, CultureInfo culture); 16 | 17 | /// Converts a value. 18 | /// A converted value. If the method returns null, the valid null value is used. 19 | /// The value that is produced by the binding target. 20 | /// The type to convert to. 21 | /// The converter parameter to use. 22 | /// The culture to use in the converter. 23 | object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Data/RelativeSource.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Markup; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Data 8 | { 9 | public class RelativeSource : IMarkupExtension 10 | { 11 | private bool isInitialized; 12 | 13 | private RelativeSourceMode mode = RelativeSourceMode.TemplatedParent; 14 | 15 | public RelativeSource() 16 | { 17 | } 18 | 19 | public RelativeSource(RelativeSourceMode mode) 20 | { 21 | this.Mode = mode; 22 | } 23 | 24 | public RelativeSourceMode Mode 25 | { 26 | get 27 | { 28 | return this.mode; 29 | } 30 | set 31 | { 32 | if (!this.isInitialized) 33 | { 34 | this.mode = value; 35 | this.isInitialized = true; 36 | return; 37 | } 38 | if (this.mode != value) 39 | { 40 | throw new InvalidOperationException(); 41 | } 42 | } 43 | } 44 | 45 | #region IMarkupExtension Members 46 | 47 | bool IMarkupExtension.IsValidTargetForExtension(object target, object dp) 48 | { 49 | return false; 50 | } 51 | 52 | void IMarkupExtension.SetupExtension(object target, object dp) 53 | { 54 | } 55 | 56 | #endregion 57 | } 58 | } -------------------------------------------------------------------------------- /Data/RelativeSourceMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Data 7 | { 8 | public enum RelativeSourceMode 9 | { 10 | TemplatedParent = 1, 11 | Self = 2 12 | } 13 | } -------------------------------------------------------------------------------- /Data/UpdateSourceTrigger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Data 7 | { 8 | public enum UpdateSourceTrigger 9 | { 10 | Default = 0, 11 | Explicit = 3 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI 2 | { 3 | /// 4 | /// Describes the visual structure of a data object. 5 | /// 6 | public partial class DataTemplate : FrameworkTemplate 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /FrameworkTemplate.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Markup; 3 | 4 | namespace Appercode.UI 5 | { 6 | [ContentProperty("VisualTree")] 7 | public abstract partial class FrameworkTemplate 8 | { 9 | /// 10 | /// This definition is only for XAML XSD schema generation 11 | /// 12 | public static readonly DependencyProperty VisualTreeProperty = 13 | DependencyProperty.Register( 14 | "VisualTree", 15 | typeof(FrameworkElementFactory), 16 | typeof(FrameworkTemplate), 17 | new PropertyMetadata()); 18 | } 19 | } -------------------------------------------------------------------------------- /GridUnitType.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI 2 | { 3 | /// 4 | /// Describes the kind of value that a GridLength object is holding. 5 | /// 6 | public enum GridUnitType 7 | { 8 | /// 9 | /// The size is determined by the size properties of the content object. 10 | /// 11 | Auto = 0, 12 | 13 | /// 14 | /// The value is expressed as a pixel. 15 | /// 16 | Pixel = 1, 17 | 18 | /// 19 | /// The value is expressed as a weighted proportion of available space. 20 | /// 21 | Star = 2, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Helpers/WeakEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | 5 | namespace Appercode.Helpers 6 | { 7 | 8 | /// 9 | /// Event handler week refeenced to target 10 | /// 11 | /// 12 | [DebuggerNonUserCode] 13 | public sealed class WeakEventHandler where TEventArgs : EventArgs 14 | { 15 | private readonly WeakReference targetReference; 16 | private readonly MethodInfo method; 17 | 18 | 19 | /// 20 | /// Conctructor for WeakEventHandler class 21 | /// 22 | /// event callback 23 | public WeakEventHandler(EventHandler callback) 24 | { 25 | this.method = callback.Method; 26 | this.targetReference = new WeakReference(callback.Target); 27 | } 28 | 29 | /// 30 | /// Hendler, if target not null invaces callback 31 | /// 32 | /// 33 | /// 34 | [DebuggerNonUserCode] 35 | public void Handler(object sender, TEventArgs e) 36 | { 37 | var target = this.targetReference.Target; 38 | if (target != null) 39 | { 40 | var callback = (Action)Delegate.CreateDelegate(typeof(Action), target, this.method, true); 41 | if (callback != null) 42 | { 43 | callback(sender, e); 44 | } 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Input/GestureEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System; 3 | using System.Windows; 4 | 5 | namespace Appercode.UI.Input 6 | { 7 | public sealed class GestureEventArgs : RoutedEventArgs 8 | { 9 | public bool Handled { get; set; } 10 | 11 | public Point GetPosition(UIElement relativeTo) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Internals/BaseValueSourceInternal.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals 2 | { 3 | internal enum BaseValueSourceInternal : short 4 | { 5 | Unknown, 6 | Default, 7 | Inherited, 8 | ThemeStyle, 9 | ThemeStyleTrigger, 10 | Style, 11 | TemplateTrigger, 12 | StyleTrigger, 13 | ImplicitReference, 14 | ParentTemplate, 15 | ParentTemplateTrigger, 16 | Local 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Internals/BindingValueCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Internals 4 | { 5 | internal class BindingValueCache 6 | { 7 | internal readonly Type BindingValueType; 8 | 9 | internal readonly object ValueAsBindingValueType; 10 | 11 | internal BindingValueCache(Type bindingValueType, object valueAsBindingValueType) 12 | { 13 | this.BindingValueType = bindingValueType; 14 | this.ValueAsBindingValueType = valueAsBindingValueType; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Internals/BindingValueChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal class BindingValueChangedEventArgs : EventArgs 9 | { 10 | private object oldValue; 11 | 12 | private object newValue; 13 | 14 | internal BindingValueChangedEventArgs(object oldValue, object newValue) 15 | { 16 | this.oldValue = oldValue; 17 | this.newValue = newValue; 18 | } 19 | 20 | public object NewValue 21 | { 22 | get 23 | { 24 | return this.newValue; 25 | } 26 | } 27 | 28 | public object OldValue 29 | { 30 | get 31 | { 32 | return this.oldValue; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Internals/Boxes/BooleanBoxes.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals.Boxes 2 | { 3 | internal static class BooleanBoxes 4 | { 5 | internal static object TrueBox; 6 | 7 | internal static object FalseBox; 8 | 9 | static BooleanBoxes() 10 | { 11 | BooleanBoxes.TrueBox = true; 12 | BooleanBoxes.FalseBox = false; 13 | } 14 | 15 | internal static object Box(bool value) 16 | { 17 | if (value) 18 | { 19 | return BooleanBoxes.TrueBox; 20 | } 21 | return BooleanBoxes.FalseBox; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Internals/CollectionView/IViewLifetime.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals.CollectionView 2 | { 3 | internal interface IViewLifetime 4 | { 5 | object ViewManagerData 6 | { 7 | get; 8 | set; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Internals/CollectionView/ViewRecord.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Appercode.UI.Internals.CollectionView 4 | { 5 | internal class ViewRecord 6 | { 7 | internal ViewRecord(ICollectionView view) 8 | { 9 | this.View = view; 10 | this.IsInitialized = false; 11 | this.Version = -1; 12 | } 13 | 14 | internal bool IsInitialized 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | internal int Version 21 | { 22 | get; 23 | set; 24 | } 25 | 26 | internal ICollectionView View 27 | { 28 | get; 29 | private set; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Internals/CollectionView/ViewTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.CollectionView 7 | { 8 | internal class ViewTable 9 | { 10 | private Dictionary cvsToViewRecord = new Dictionary(); 11 | 12 | public ViewTable() 13 | { 14 | } 15 | 16 | internal ViewRecord this[object o] 17 | { 18 | get 19 | { 20 | ViewRecord viewRecord = null; 21 | this.cvsToViewRecord.TryGetValue(new WeakRefKey(o), out viewRecord); 22 | return viewRecord; 23 | } 24 | set 25 | { 26 | this.cvsToViewRecord[new WeakRefKey(o)] = value; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Internals/DataContextChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal sealed class DataContextChangedEventArgs : EventArgs 9 | { 10 | public DataContextChangedEventArgs(DataContextChangedReason reason) 11 | { 12 | this.ChangeReason = reason; 13 | } 14 | 15 | public DataContextChangedReason ChangeReason 16 | { 17 | get; 18 | private set; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Internals/DataContextChangedEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals 2 | { 3 | internal delegate void DataContextChangedEventHandler(object sender, DataContextChangedEventArgs e); 4 | } -------------------------------------------------------------------------------- /Internals/DataContextChangedReason.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal enum DataContextChangedReason 9 | { 10 | NewDataContext, 11 | EnteringLiveTree 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Internals/DeferredReference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Internals 4 | { 5 | internal abstract class DeferredReference 6 | { 7 | protected DeferredReference() 8 | { 9 | } 10 | 11 | internal abstract object GetValue(BaseValueSourceInternal valueSource); 12 | 13 | internal abstract Type GetValueType(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Internals/DependencyPropertyChangedWeakListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.Internals 5 | { 6 | internal class DependencyPropertyChangedWeakListener 7 | { 8 | private DependencyObject source; 9 | 10 | private WeakReference expression; 11 | 12 | internal DependencyPropertyChangedWeakListener(DependencyObject source, TemplateBindingExpression expression) 13 | { 14 | this.source = source; 15 | this.expression = new WeakReference(expression); 16 | this.source.DPChanged += this.SourcePropertyChanged; 17 | } 18 | 19 | internal void Disconnect() 20 | { 21 | if (this.source == null) 22 | { 23 | return; 24 | } 25 | this.source.DPChanged -= this.SourcePropertyChanged; 26 | this.source = null; 27 | this.expression = null; 28 | } 29 | 30 | internal void SourcePropertyChanged(object sender, DependencyPropertyChangedEventArgs e) 31 | { 32 | TemplateBindingExpression target; 33 | if (this.expression != null) 34 | { 35 | target = this.expression.Target as TemplateBindingExpression; 36 | } 37 | else 38 | { 39 | target = null; 40 | } 41 | TemplateBindingExpression templateBindingExpression = target; 42 | if (templateBindingExpression == null) 43 | { 44 | this.Disconnect(); 45 | return; 46 | } 47 | 48 | templateBindingExpression.SourcePropertyChanged(sender, e.Property); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Internals/DependencySource.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Internals 4 | { 5 | internal sealed class DependencySource 6 | { 7 | private DependencyObject dependencyObject; 8 | 9 | private DependencyProperty dp; 10 | 11 | public DependencySource(DependencyObject d, DependencyProperty dp) 12 | { 13 | this.dependencyObject = d; 14 | this.dp = dp; 15 | } 16 | 17 | public DependencyObject DependencyObject 18 | { 19 | get 20 | { 21 | return this.dependencyObject; 22 | } 23 | } 24 | 25 | public DependencyProperty DependencyProperty 26 | { 27 | get 28 | { 29 | return this.dp; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Internals/ExpressionMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal enum ExpressionMode 9 | { 10 | None, 11 | NonSharable, 12 | ForwardsInvalidations, 13 | SupportsUnboundSources 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Internals/Helpers/MathF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | #if !__IOS__ 4 | using nfloat = System.Single; 5 | #endif 6 | 7 | namespace Appercode.UI 8 | { 9 | internal static class MathF 10 | { 11 | public const float E = 2.71828f; 12 | public const float PI = 3.14159f; 13 | private const double MinimumDelta = 0.00001; 14 | 15 | public static nfloat Abs(nfloat value) 16 | { 17 | return (nfloat)Math.Abs(value); 18 | } 19 | 20 | public static bool AreNotClose(nfloat value1, nfloat value2) 21 | { 22 | if (value1 == value2) 23 | { 24 | return false; 25 | } 26 | 27 | var delta = value1 - value2; 28 | return delta > MinimumDelta || delta < -MinimumDelta; 29 | } 30 | 31 | public static nfloat GetNotNaN(this double value) 32 | { 33 | return double.IsNaN(value) ? default(nfloat) : (nfloat)value; 34 | } 35 | 36 | public static nfloat Max(nfloat val1, nfloat val2) 37 | { 38 | return val1 > val2 ? val1 : val2; 39 | } 40 | 41 | public static nfloat Min(nfloat val1, nfloat val2) 42 | { 43 | return val1 < val2 ? val1 : val2; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Internals/Helpers/ThicknessExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | #if __IOS__ 4 | using System; 5 | #else 6 | using nfloat = System.Single; 7 | #endif 8 | 9 | namespace Appercode.UI 10 | { 11 | internal static class ThicknessExtensions 12 | { 13 | public static double HorizontalThickness(this Thickness thickness) 14 | { 15 | return thickness.Left + thickness.Right; 16 | } 17 | 18 | public static double VerticalThickness(this Thickness thickness) 19 | { 20 | return thickness.Top + thickness.Bottom; 21 | } 22 | 23 | public static nfloat HorizontalThicknessF(this Thickness thickness) 24 | { 25 | return (nfloat)HorizontalThickness(thickness); 26 | } 27 | 28 | public static nfloat VerticalThicknessF(this Thickness thickness) 29 | { 30 | return (nfloat)VerticalThickness(thickness); 31 | } 32 | 33 | public static nfloat TopF(this Thickness thickness) 34 | { 35 | return (nfloat)thickness.Top; 36 | } 37 | 38 | public static nfloat BottomF(this Thickness thickness) 39 | { 40 | return (nfloat)thickness.Bottom; 41 | } 42 | 43 | public static nfloat LeftF(this Thickness thickness) 44 | { 45 | return (nfloat)thickness.Left; 46 | } 47 | 48 | public static nfloat RightF(this Thickness thickness) 49 | { 50 | return (nfloat)thickness.Right; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Internals/ICollectionChangedListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Internals 8 | { 9 | internal interface ICollectionChangedListener 10 | { 11 | void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Internals/IDataContextChangedListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal interface IDataContextChangedListener 9 | { 10 | void OnDataContextChanged(object sender, DataContextChangedEventArgs e); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Internals/IErrorsChangedListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Internals 8 | { 9 | internal interface IErrorsChangedListener 10 | { 11 | void OnErrorsChanged(object sender, bool notifyChild, DataErrorsChangedEventArgs e); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Internals/IMarkupExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Markup 4 | { 5 | internal interface IMarkupExtension 6 | { 7 | bool IsValidTargetForExtension(object target, object dp); 8 | 9 | void SetupExtension(object target, object dp); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Internals/ISealable.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals 2 | { 3 | internal interface ISealable 4 | { 5 | bool CanSeal 6 | { 7 | get; 8 | } 9 | 10 | bool IsSealed 11 | { 12 | get; 13 | } 14 | 15 | void Seal(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Internals/InterfaceConverter.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Internals 9 | { 10 | internal class InterfaceConverter : IValueConverter 11 | { 12 | private Type sourceType; 13 | 14 | private Type targetType; 15 | 16 | internal InterfaceConverter(Type sourceType, Type targetType) 17 | { 18 | this.sourceType = sourceType; 19 | this.targetType = targetType; 20 | } 21 | 22 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 23 | { 24 | return this.ConvertTo(o, this.targetType); 25 | } 26 | 27 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 28 | { 29 | return this.ConvertTo(o, this.sourceType); 30 | } 31 | 32 | private object ConvertTo(object o, Type type) 33 | { 34 | if (!type.IsInstanceOfType(o)) 35 | { 36 | return null; 37 | } 38 | return o; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Internals/LogicalOp.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals 2 | { 3 | internal enum LogicalOp 4 | { 5 | Equals, 6 | NotEquals 7 | } 8 | } -------------------------------------------------------------------------------- /Internals/ObjectSourceConverter.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Internals 9 | { 10 | internal class ObjectSourceConverter : DefaultValueConverter, IValueConverter 11 | { 12 | public ObjectSourceConverter(Type targetType) 13 | : base(null, typeof(object), targetType, true, false) 14 | { 15 | } 16 | 17 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 18 | { 19 | if ((o != null && this.targetType.IsAssignableFrom(o.GetType())) || (o == null && DefaultValueConverter.AcceptsNull(this.targetType))) 20 | { 21 | return o; 22 | } 23 | if (this.targetType != typeof(string)) 24 | { 25 | CultureInfo invariantCulture = CultureInfo.InvariantCulture; 26 | string str = "ValueConverter can't convert Type {0} to Type {1}"; 27 | object[] objArray = new object[] { o.GetType().ToString(), this.targetType.ToString() }; 28 | throw new InvalidOperationException(string.Format(invariantCulture, str, objArray)); 29 | } 30 | return o.ToString(); 31 | } 32 | 33 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 34 | { 35 | return o; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Internals/ObjectTargetConverter.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Appercode.UI.Internals 9 | { 10 | internal class ObjectTargetConverter : DefaultValueConverter, IValueConverter 11 | { 12 | public ObjectTargetConverter(Type sourceType) 13 | : base(null, sourceType, typeof(object), true, false) 14 | { 15 | } 16 | 17 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 18 | { 19 | return o; 20 | } 21 | 22 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 23 | { 24 | if (o == null && DefaultValueConverter.AcceptsNull(this.sourceType)) 25 | { 26 | return o; 27 | } 28 | if (o != null && this.sourceType.IsAssignableFrom(o.GetType())) 29 | { 30 | return o; 31 | } 32 | if (this.sourceType != typeof(string)) 33 | { 34 | CultureInfo invariantCulture = CultureInfo.InvariantCulture; 35 | string str = "ValueConverter can't convert Type {0} to Type {1}"; 36 | object[] objArray = new object[] { o.GetType().ToString(), this.sourceType.ToString() }; 37 | throw new InvalidOperationException(string.Format(invariantCulture, str, objArray)); 38 | } 39 | return o.ToString(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Internals/PathParser/DependencyPropertyAccessStepDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace Appercode.UI.Internals.PathParser 8 | { 9 | internal class DependencyPropertyAccessStepDescriptor : PropertyPathStepDescriptor 10 | { 11 | private DependencyProperty property; 12 | 13 | internal DependencyPropertyAccessStepDescriptor(DependencyProperty property) 14 | { 15 | this.property = property; 16 | } 17 | 18 | internal override PropertyPathStep CreateStep(PropertyPathListener listener, object source, bool listenToChanges) 19 | { 20 | return new PropertyAccessPathStep(listener, source, this.property, listenToChanges); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Internals/PathParser/IRaisePropertyPathStepChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal interface IRaisePropertyPathStepChanged 9 | { 10 | void RaisePropertyPathStepChanged(PropertyListener source); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Internals/PathParser/ISourcePropertyChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI.Internals.PathParser 8 | { 9 | internal interface ISourcePropertyChanged 10 | { 11 | void SourcePropertyChanged(object sender, PropertyChangedEventArgs args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Internals/PathParser/IndexerPathStepDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal class IndexerPathStepDescriptor : PropertyPathStepDescriptor 9 | { 10 | private string index; 11 | 12 | internal IndexerPathStepDescriptor(string index) 13 | { 14 | this.index = index; 15 | } 16 | 17 | internal override PropertyPathStep CreateStep(PropertyPathListener listener, object source, bool listenToChanges) 18 | { 19 | return new IndexerPathStep(listener, source, this.index, listenToChanges); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Internals/PathParser/PropertyAccessPathStepDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal class PropertyAccessPathStepDescriptor : PropertyPathStepDescriptor 9 | { 10 | private string name; 11 | 12 | internal PropertyAccessPathStepDescriptor(string name) 13 | { 14 | this.name = name; 15 | } 16 | 17 | internal override PropertyPathStep CreateStep(PropertyPathListener listener, object source, bool listenToChanges) 18 | { 19 | return new PropertyAccessPathStep(listener, source, this.name, listenToChanges); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Internals/PathParser/PropertyListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal abstract class PropertyListener 9 | { 10 | protected readonly IRaisePropertyPathStepChanged PathStep; 11 | 12 | protected bool listenToChanges; 13 | 14 | internal PropertyListener(IRaisePropertyPathStepChanged pathStep, bool listenToChanges) 15 | { 16 | this.PathStep = pathStep; 17 | this.listenToChanges = listenToChanges; 18 | } 19 | 20 | internal abstract object Property 21 | { 22 | get; 23 | } 24 | 25 | internal string PropertyName 26 | { 27 | get 28 | { 29 | return ((PropertyPathStep)this.PathStep).PropertyName; 30 | } 31 | } 32 | 33 | internal abstract Type PropertyType 34 | { 35 | get; 36 | } 37 | 38 | internal abstract object Source 39 | { 40 | get; 41 | set; 42 | } 43 | 44 | internal abstract Type SourceType 45 | { 46 | get; 47 | } 48 | 49 | internal abstract object Value 50 | { 51 | get; 52 | set; 53 | } 54 | 55 | internal abstract void Disconnect(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Internals/PathParser/PropertyPathChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal class PropertyPathChangedEventArgs 9 | { 10 | internal PropertyPathChangedEventArgs(PropertyPathStep source) 11 | { 12 | this.ChangedPart = source; 13 | } 14 | 15 | internal PropertyPathStep ChangedPart 16 | { 17 | get; 18 | private set; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Internals/PathParser/PropertyPathStep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal abstract class PropertyPathStep 9 | { 10 | internal PropertyPathStep(PropertyPathListener listener) 11 | { 12 | this.Listener = listener; 13 | } 14 | 15 | internal abstract bool IsConnected 16 | { 17 | get; 18 | } 19 | 20 | internal PropertyPathListener Listener 21 | { 22 | get; 23 | private set; 24 | } 25 | 26 | internal PropertyPathStep NextStep 27 | { 28 | get; 29 | set; 30 | } 31 | 32 | internal abstract object Property 33 | { 34 | get; 35 | } 36 | 37 | internal abstract string PropertyName 38 | { 39 | get; 40 | } 41 | 42 | internal abstract object Source 43 | { 44 | get; 45 | } 46 | 47 | internal abstract Type Type 48 | { 49 | get; 50 | } 51 | 52 | internal abstract object Value 53 | { 54 | get; 55 | set; 56 | } 57 | 58 | internal abstract void Disconnect(); 59 | 60 | internal abstract void ReConnect(object newSource); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Internals/PathParser/PropertyPathStepChangedHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal delegate void PropertyPathStepChangedHandler(PropertyPathListener source, PropertyPathChangedEventArgs args); 9 | } -------------------------------------------------------------------------------- /Internals/PathParser/PropertyPathStepDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal abstract class PropertyPathStepDescriptor 9 | { 10 | protected PropertyPathStepDescriptor() 11 | { 12 | } 13 | 14 | internal abstract PropertyPathStep CreateStep(PropertyPathListener listener, object source, bool listenToChanges); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Internals/PathParser/SourcePathStepDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals.PathParser 7 | { 8 | internal class SourcePathStepDescriptor : PropertyPathStepDescriptor 9 | { 10 | public SourcePathStepDescriptor() 11 | { 12 | } 13 | 14 | internal override PropertyPathStep CreateStep(PropertyPathListener listener, object source, bool listenToChanges) 15 | { 16 | return new SourcePropertyPathStep(listener, source); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Internals/PropertyValue.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.Internals 4 | { 5 | internal struct PropertyValue 6 | { 7 | internal PropertyValueType ValueType; 8 | 9 | ////internal TriggerCondition[] Conditions; 10 | 11 | internal string ChildName; 12 | 13 | internal DependencyProperty Property; 14 | 15 | internal object ValueInternal; 16 | 17 | internal object Value 18 | { 19 | get 20 | { 21 | DeferredReference valueInternal = this.ValueInternal as DeferredReference; 22 | if (valueInternal != null) 23 | { 24 | this.ValueInternal = valueInternal.GetValue(BaseValueSourceInternal.Unknown); 25 | } 26 | return this.ValueInternal; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Internals/PropertyValueType.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI.Internals 2 | { 3 | internal enum PropertyValueType 4 | { 5 | Set, 6 | Trigger, 7 | PropertyTriggerResource, 8 | DataTrigger, 9 | DataTriggerResource, 10 | TemplateBinding, 11 | Resource 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Internals/ResourceDictionaryCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using Appercode.UI.StylesAndResources; 4 | 5 | namespace Appercode.UI.Internals 6 | { 7 | internal class ResourceDictionaryCollection : ObservableCollection 8 | { 9 | private ResourceDictionary owner; 10 | 11 | internal ResourceDictionaryCollection(ResourceDictionary owner) 12 | { 13 | this.owner = owner; 14 | } 15 | 16 | protected override void ClearItems() 17 | { 18 | for (int i = 0; i < this.Count; i++) 19 | { 20 | this.owner.RemoveParentOwners(base[i]); 21 | } 22 | base.ClearItems(); 23 | } 24 | 25 | protected override void InsertItem(int index, ResourceDictionary item) 26 | { 27 | if (item == null) 28 | { 29 | throw new ArgumentNullException("item"); 30 | } 31 | base.InsertItem(index, item); 32 | } 33 | 34 | protected override void SetItem(int index, ResourceDictionary item) 35 | { 36 | if (item == null) 37 | { 38 | throw new ArgumentNullException("item"); 39 | } 40 | base.SetItem(index, item); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Internals/ResourcesChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.Internals 4 | { 5 | internal class ResourcesChangedEventArgs : EventArgs 6 | { 7 | private ResourcesChangeInfo info; 8 | 9 | internal ResourcesChangedEventArgs(ResourcesChangeInfo info) 10 | { 11 | this.info = info; 12 | } 13 | 14 | internal ResourcesChangeInfo Info 15 | { 16 | get 17 | { 18 | return this.info; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Internals/SourceDefaultValueConverter.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace Appercode.UI.Internals 10 | { 11 | internal class SourceDefaultValueConverter : DefaultValueConverter, IValueConverter 12 | { 13 | public SourceDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType, bool shouldConvertFrom, bool shouldConvertTo) 14 | : base(typeConverter, sourceType, targetType, shouldConvertFrom, shouldConvertTo) 15 | { 16 | } 17 | 18 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 19 | { 20 | return this.ConvertTo(o, this.targetType, culture); 21 | } 22 | 23 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 24 | { 25 | return this.ConvertFrom(o, this.sourceType, culture); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Internals/StyleHelper.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System; 3 | using System.Windows; 4 | 5 | namespace Appercode.UI.Internals 6 | { 7 | internal static class StyleHelper 8 | { 9 | internal static void SealIfSealable(object p) 10 | { 11 | var sealeble = p as ISealable; 12 | if (sealeble != null && sealeble.CanSeal) 13 | { 14 | sealeble.Seal(); 15 | } 16 | } 17 | 18 | internal static int CreateChildIndexFromChildName(string p, FrameworkTemplate frameworkTemplate) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | 23 | internal static bool IsStylingLogicalTree(DependencyProperty dp, object value) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | internal static void DoTemplateInvalidations(ContentPresenter contentPresenter, DataTemplate template) 29 | { 30 | // throw new NotImplementedException(); 31 | } 32 | 33 | internal static void UpdateTemplateCache(ContentPresenter contentPresenter, FrameworkTemplate frameworkTemplate1, FrameworkTemplate frameworkTemplate2, DependencyProperty dependencyProperty) 34 | { 35 | // throw new NotImplementedException(); 36 | } 37 | 38 | internal static void AddCustomTemplateRoot(ContentPresenter container, TextBlock textBlock, bool p1, bool p2) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | 43 | internal static void AddCustomTemplateRoot(Appercode.UI.Controls.UIElement container, Appercode.UI.Controls.UIElement uiElement) 44 | { 45 | throw new NotImplementedException(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Internals/TargetDefaultValueConverter.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace Appercode.UI.Internals 10 | { 11 | internal class TargetDefaultValueConverter : DefaultValueConverter, IValueConverter 12 | { 13 | public TargetDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType, bool shouldConvertFrom, bool shouldConvertTo) 14 | : base(typeConverter, sourceType, targetType, shouldConvertFrom, shouldConvertTo) 15 | { 16 | } 17 | 18 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 19 | { 20 | return this.ConvertFrom(o, this.targetType, culture); 21 | } 22 | 23 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 24 | { 25 | return this.ConvertTo(o, this.sourceType, culture); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Internals/WeakDataContextChangedListener.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System; 3 | 4 | namespace Appercode.UI.Internals 5 | { 6 | internal class WeakDataContextChangedListener 7 | { 8 | private WeakReference weakListener; 9 | private UIElement mentor; 10 | 11 | internal WeakDataContextChangedListener(UIElement mentor, IDataContextChangedListener listener) 12 | { 13 | this.mentor = mentor; 14 | this.mentor.DataContextChanged += this.MentorDataContextChanged; 15 | this.weakListener = new WeakReference(listener); 16 | } 17 | 18 | internal void Disconnect() 19 | { 20 | if (this.mentor != null) 21 | { 22 | this.mentor.DataContextChanged -= this.MentorDataContextChanged; 23 | this.mentor = null; 24 | this.weakListener = null; 25 | } 26 | } 27 | 28 | private void MentorDataContextChanged(object sender, DataContextChangedEventArgs e) 29 | { 30 | if (this.weakListener != null) 31 | { 32 | IDataContextChangedListener target; 33 | if (this.weakListener.TryGetTarget(out target)) 34 | { 35 | target.OnDataContextChanged(sender, e); 36 | } 37 | else 38 | { 39 | this.Disconnect(); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Internals/WeakRefKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI.Internals 7 | { 8 | internal struct WeakRefKey 9 | { 10 | private WeakReference weakRef; 11 | 12 | private int hashCode; 13 | 14 | internal WeakRefKey(object target) 15 | { 16 | this.weakRef = new WeakReference(target); 17 | this.hashCode = target != null ? target.GetHashCode() : 314159; 18 | } 19 | 20 | internal object Target 21 | { 22 | get 23 | { 24 | return this.weakRef.Target; 25 | } 26 | } 27 | 28 | public static bool operator ==(WeakRefKey left, WeakRefKey right) 29 | { 30 | if ((object)left == null) 31 | { 32 | return (object)right == null; 33 | } 34 | return left.Equals(right); 35 | } 36 | 37 | public static bool operator !=(WeakRefKey left, WeakRefKey right) 38 | { 39 | return !(left == right); 40 | } 41 | 42 | public override bool Equals(object o) 43 | { 44 | if (!(o is WeakRefKey)) 45 | { 46 | return false; 47 | } 48 | WeakRefKey weakRefKey = (WeakRefKey)o; 49 | object target = this.Target; 50 | object obj = weakRefKey.Target; 51 | if (target != null && obj != null) 52 | { 53 | return target == obj; 54 | } 55 | return this.weakRef == weakRefKey.weakRef; 56 | } 57 | 58 | public override int GetHashCode() 59 | { 60 | return this.hashCode; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Key.snk -------------------------------------------------------------------------------- /Markup/StaticResource.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.StylesAndResources; 2 | 3 | namespace Appercode.UI.Markup 4 | { 5 | public abstract class StaticResource { } 6 | } -------------------------------------------------------------------------------- /PerfomanceLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Appercode.UI 8 | { 9 | public static class PerfomanceLogger 10 | { 11 | private static List> eventsList = new List>(); 12 | 13 | public static void Log(string info) 14 | { 15 | eventsList.Add(new Tuple(DateTime.Now, info)); 16 | } 17 | 18 | public static void Print() 19 | { 20 | #if __ANDROID__ 21 | var saveDirictory = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/Appercodelogs/"; 22 | if (!Directory.Exists(saveDirictory)) 23 | { 24 | Directory.CreateDirectory(saveDirictory); 25 | } 26 | 27 | var filePath = saveDirictory + "log" + DateTime.Now + ".txt"; 28 | 29 | StringBuilder sb = new StringBuilder(); 30 | eventsList.ForEach((x) => 31 | { 32 | sb.AppendLine(x.Item1.ToString("hh:mm:ss.fffffff") + " " + x.Item2); 33 | }); 34 | 35 | 36 | try 37 | { 38 | using (StreamWriter outfile = new StreamWriter(filePath)) 39 | { 40 | outfile.Write(sb.ToString()); 41 | } 42 | } 43 | catch (Exception e) 44 | { 45 | System.Diagnostics.Debug.WriteLine(e.Message); 46 | } 47 | 48 | #endif 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UI Framework 2 | Appercode UI Framework brings Windows Phone UI Object Model to iOS and Android. 3 | 4 | Appercode contains more than 30 controls ported from Windows Phone starting from TextBlock and Button to Grid and WebBrowser. Apart from them the platform provides some additional cross-platform controls such as Fly-out menu and Tabs control. On top of that developers can create their own controls and enlarge the platform. 5 | 6 | Appercode was created to reduce the entry level requirements for new developers familiar with Windows Phone. Therefore, by using it you get the tools, very similar to those in Windows Phone. To create cross-platform applications you do not have to learn iOS or Android. 7 | -------------------------------------------------------------------------------- /Resources/anim/fadein.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 9 | 10 | 16 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Resources/anim/fadeout.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxChecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxChecked.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxChecked@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxChecked@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxCheckediOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxCheckediOS6.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxCheckediOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxCheckediOS6@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxUnchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxUnchecked.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxUnchecked@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxUnchecked@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxUncheckediOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxUncheckediOS6.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/CheckBoxUncheckediOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/CheckBoxUncheckediOS6@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/ProgressIndicatorBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/ProgressIndicatorBar.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/ProgressIndicatorBar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/ProgressIndicatorBar@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/ProgressIndicatorDefault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/ProgressIndicatorDefault.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/ProgressIndicatorDefault@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/ProgressIndicatorDefault@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonChecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonChecked.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonChecked@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonChecked@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonCheckediOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonCheckediOS6.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonCheckediOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonCheckediOS6@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonUnchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonUnchecked.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonUnchecked@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonUnchecked@2x.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonUncheckediOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonUncheckediOS6.png -------------------------------------------------------------------------------- /Resources/iOS_Resources/RadioButtonUncheckediOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/Resources/iOS_Resources/RadioButtonUncheckediOS6@2x.png -------------------------------------------------------------------------------- /RoutedEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI 4 | { 5 | public sealed class RoutedEvent 6 | { 7 | public RoutedEvent(string name, Type handlerType) 8 | { 9 | this.Name = name; 10 | this.HandlerType = handlerType; 11 | } 12 | 13 | public Type HandlerType { get; private set; } 14 | public string Name { get; private set; } 15 | public Type OwnerType { get; private set; } 16 | public RoutingStrategy RoutingStrategy { get; private set; } 17 | 18 | public RoutedEvent AddOwner(Type ownerType) 19 | { 20 | this.OwnerType = ownerType; 21 | return this; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return this.Name; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RoutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Appercode.UI 7 | { 8 | /// 9 | /// Represents the method that will handle various routed events that do not have specific event data beyond the data that is common for all routed events 10 | /// 11 | /// The object where the event handler is attached 12 | /// The event data 13 | public delegate void RoutedEventHandler(object sender, RoutedEventArgs e); 14 | 15 | /// 16 | /// Contains state information and event data associated with a routed event 17 | /// 18 | public class RoutedEventArgs : EventArgs 19 | { 20 | /// 21 | /// Initializes a new instance of the RoutedEventArgs class 22 | /// 23 | public RoutedEventArgs() 24 | { 25 | } 26 | 27 | /// 28 | /// Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class 29 | /// 30 | public object OriginalSource 31 | { 32 | get; 33 | set; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /RoutingStrategy.cs: -------------------------------------------------------------------------------- 1 | namespace Appercode.UI 2 | { 3 | public enum RoutingStrategy 4 | { 5 | Bubble, 6 | Direct, 7 | Tunnel 8 | } 9 | } -------------------------------------------------------------------------------- /StylesAndResources/ApplicationResourcesAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Appercode.UI.StylesAndResources 4 | { 5 | /// 6 | /// Attribute that determenates resources that availible in all pages in application 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 9 | public sealed class ApplicationResourcesAttribute : Attribute 10 | { 11 | /// 12 | /// ApplicationResourcesAttribute constructor 13 | /// 14 | public ApplicationResourcesAttribute() 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /StylesAndResources/ResourceDictionary.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Appercode/Appercode.UIFramework/63eba322af789679293554d3dffd57114b0d4edd/StylesAndResources/ResourceDictionary.cs -------------------------------------------------------------------------------- /StylesAndResources/Setter.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Markup; 2 | 3 | namespace Appercode.UI.StylesAndResources 4 | { 5 | [ContentProperty("Value")] 6 | public partial class Setter 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StylesAndResources/Setter.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.StylesAndResources 4 | { 5 | public sealed partial class Setter : SetterBase 6 | { 7 | private DependencyProperty property; 8 | private object value; 9 | 10 | public Setter() 11 | { 12 | } 13 | 14 | public Setter(DependencyProperty property, object value) : this() 15 | { 16 | this.property = property; 17 | this.value = value; 18 | } 19 | 20 | public DependencyProperty Property 21 | { 22 | get { return this.property; } 23 | set { this.property = value; } 24 | } 25 | 26 | public object Value 27 | { 28 | get { return this.value; } 29 | set { this.value = value; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /StylesAndResources/SetterBase.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Appercode.UI.StylesAndResources 4 | { 5 | public abstract class SetterBase : DependencyObject 6 | { 7 | public static readonly DependencyProperty IsSealedProperty = 8 | DependencyProperty.Register("IsSealed", typeof(bool), typeof(SetterBase), new PropertyMetadata(false)); 9 | 10 | public override bool IsSealed 11 | { 12 | get { return (bool)this.GetValue(IsSealedProperty); } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StylesAndResources/SetterBaseCollection.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.StylesAndResources 5 | { 6 | public sealed class SetterBaseCollection : PresentationFrameworkCollection 7 | { 8 | public static readonly DependencyProperty IsSealedProperty = 9 | DependencyProperty.Register("IsSealed", typeof(bool), typeof(SetterBaseCollection), new PropertyMetadata(false)); 10 | 11 | public override bool IsSealed 12 | { 13 | get { return (bool)this.GetValue(IsSealedProperty); } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StylesAndResources/Style.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Markup; 2 | 3 | namespace Appercode.UI.StylesAndResources 4 | { 5 | [ContentProperty("Setters")] 6 | public partial class Style 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StylesAndResources/Style.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Appercode.UI.StylesAndResources 5 | { 6 | public partial class Style : DependencyObject 7 | { 8 | private readonly SetterBaseCollection setters; 9 | private Type targetType; 10 | private Style basedOn; 11 | 12 | public Style() 13 | { 14 | this.setters = new SetterBaseCollection(); 15 | } 16 | 17 | public Style(Type targetType) : this() 18 | { 19 | this.targetType = targetType; 20 | } 21 | 22 | public Type TargetType 23 | { 24 | get { return this.targetType; } 25 | set { this.targetType = value; } 26 | } 27 | 28 | public Style BasedOn 29 | { 30 | get { return this.basedOn; } 31 | set { this.basedOn = value; } 32 | } 33 | 34 | public sealed override bool IsSealed 35 | { 36 | get { return false; } 37 | } 38 | 39 | public SetterBaseCollection Setters 40 | { 41 | get { return this.setters; } 42 | } 43 | 44 | public object FindValue(DependencyProperty property) 45 | { 46 | foreach (var setterBase in this.setters) 47 | { 48 | var setter = setterBase as Setter; 49 | if (setter.Property == property) 50 | { 51 | return setter.Value; 52 | } 53 | } 54 | 55 | if (this.basedOn != null) 56 | { 57 | return this.basedOn.FindValue(property); 58 | } 59 | 60 | return DependencyProperty.UnsetValue; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /System.Windows/ExceptionRoutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | 3 | namespace System.Windows 4 | { 5 | public class ExceptionRoutedEventArgs : RoutedEventArgs 6 | { 7 | internal string ErrorMessage = ""; 8 | 9 | private Exception innerException; 10 | 11 | internal ExceptionRoutedEventArgs(Exception innerException) 12 | { 13 | this.innerException = innerException; 14 | } 15 | 16 | internal ExceptionRoutedEventArgs() 17 | { 18 | } 19 | 20 | public Exception ErrorException 21 | { 22 | get 23 | { 24 | return new Exception(this.ErrorMessage, this.innerException); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /System.Windows/GetReadOnlyValueCallback.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Internals; 2 | 3 | namespace System.Windows 4 | { 5 | internal delegate object GetReadOnlyValueCallback(DependencyObject d, out BaseValueSourceInternal source); 6 | } -------------------------------------------------------------------------------- /System.Windows/HorizontalAlignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows 7 | { 8 | public enum HorizontalAlignment 9 | { 10 | Left, 11 | Center, 12 | Right, 13 | Stretch 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /System.Windows/Input/FocusManager.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using Appercode.UI.Controls; 3 | 4 | namespace System.Windows.Input 5 | { 6 | /// 7 | /// A helper class that allows getting the UI element that has focus. 8 | /// 9 | public static partial class FocusManager 10 | { 11 | /// 12 | /// Gets the element in the UI that has focus. 13 | /// 14 | /// The object that has focus or null if there is no focused element. 15 | public static object GetFocusedElement() 16 | { 17 | return GetFocusedElement(AppercodeVisualRoot.Instance.Child); 18 | } 19 | 20 | internal static object GetFocusedElement(UIElement element) 21 | { 22 | if (element.IsFocused) 23 | { 24 | return element; 25 | } 26 | 27 | var children = LogicalTreeHelper.GetChildren(element); 28 | foreach (var child in children) 29 | { 30 | var childUIElement = child as UIElement; 31 | if (childUIElement != null) 32 | { 33 | var focused = GetFocusedElement(childUIElement); 34 | if (focused != null) 35 | { 36 | return focused; 37 | } 38 | } 39 | } 40 | 41 | return null; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /System.Windows/Markup/IAddChild.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Markup 7 | { 8 | /// Provides a means to parse elements which permit child elements or text. 9 | public interface IAddChild 10 | { 11 | /// Adds a child object. 12 | /// The child object to add. 13 | void AddChild(object value); 14 | 15 | /// Adds the text content of a node to the object. 16 | /// The text to add to the object. 17 | void AddText(string text); 18 | } 19 | } -------------------------------------------------------------------------------- /System.Windows/Media/Brush.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.Graphics.Drawables; 2 | using Appercode.UI; 3 | 4 | namespace System.Windows.Media 5 | { 6 | public abstract partial class Brush : DependencyObject 7 | { 8 | public virtual Drawable ToDrawable() 9 | { 10 | return null; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /System.Windows/Media/Brush.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using System; 3 | 4 | namespace System.Windows.Media 5 | { 6 | public abstract partial class Brush : DependencyObject 7 | { 8 | public static readonly DependencyProperty OpacityProperty; 9 | 10 | //// TODO TransformProperty, RelativeTransformProperty 11 | 12 | public double Opacity 13 | { 14 | get 15 | { 16 | return (double)this.GetValue(Brush.OpacityProperty); 17 | } 18 | set 19 | { 20 | this.SetValue(Brush.OpacityProperty, value); 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /System.Windows/Media/Brush.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace System.Windows.Media 5 | { 6 | public partial class Brush 7 | { 8 | public virtual UIColor ToUIColor(CGSize size) 9 | { 10 | return null; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /System.Windows/Media/BrushMappingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Media 7 | { 8 | public enum BrushMappingMode 9 | { 10 | Absolute, 11 | RelativeToBoundingBox 12 | } 13 | } -------------------------------------------------------------------------------- /System.Windows/Media/Color.Droid.cs: -------------------------------------------------------------------------------- 1 | using AColor = Android.Graphics.Color; 2 | 3 | namespace System.Windows.Media 4 | { 5 | public partial struct Color 6 | { 7 | public AColor ToNativeColor() 8 | { 9 | return AColor.Argb( 10 | innerRgbColor.A, 11 | innerRgbColor.R, 12 | innerRgbColor.G, 13 | innerRgbColor.B); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /System.Windows/Media/Color.iOS.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace System.Windows.Media 4 | { 5 | public partial struct Color 6 | { 7 | private const float Divider = (float)byte.MaxValue; 8 | 9 | public static implicit operator UIColor(Color color) 10 | { 11 | return color.ToUIColor(); 12 | } 13 | 14 | public UIColor ToUIColor() 15 | { 16 | return new UIColor( 17 | this.innerRgbColor.R / Divider, 18 | this.innerRgbColor.G / Divider, 19 | this.innerRgbColor.B / Divider, 20 | this.innerRgbColor.A / Divider); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /System.Windows/Media/ColorInterpolationMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Media 7 | { 8 | public enum ColorInterpolationMode 9 | { 10 | ScRgbLinearInterpolation, 11 | SRgbLinearInterpolation 12 | } 13 | } -------------------------------------------------------------------------------- /System.Windows/Media/GradientSpreadMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Media 7 | { 8 | public enum GradientSpreadMethod 9 | { 10 | Pad, 11 | Reflect, 12 | Repeat 13 | } 14 | } -------------------------------------------------------------------------------- /System.Windows/Media/GradientStop.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Media; 8 | 9 | namespace System.Windows.Media 10 | { 11 | public sealed class GradientStop : DependencyObject 12 | { 13 | public static readonly DependencyProperty ColorProperty = 14 | DependencyProperty.Register("Color", typeof(Color), typeof(GradientStop), new PropertyMetadata(default(Color))); 15 | 16 | public static readonly DependencyProperty OffsetProperty = 17 | DependencyProperty.Register("Offset", typeof(double), typeof(GradientStop), new PropertyMetadata(default(double))); 18 | 19 | public Color Color 20 | { 21 | get { return (Color)GetValue(ColorProperty); } 22 | set { this.SetValue(ColorProperty, value); } 23 | } 24 | 25 | public double Offset 26 | { 27 | get { return (double)GetValue(OffsetProperty); } 28 | set { this.SetValue(OffsetProperty, value); } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /System.Windows/Media/GradientStopCollection.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI.Controls; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | 8 | namespace System.Windows.Media 9 | { 10 | public sealed class GradientStopCollection : PresentationFrameworkCollection 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /System.Windows/Media/ImageBrush.Droid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Android.App; 6 | using Android.Content; 7 | using Android.Graphics; 8 | using Android.Graphics.Drawables; 9 | using Android.OS; 10 | using Android.Runtime; 11 | using Android.Views; 12 | using Android.Widget; 13 | using Appercode.UI.Controls.Media.Imaging; 14 | using Java.IO; 15 | 16 | namespace System.Windows.Media 17 | { 18 | public partial class ImageBrush 19 | { 20 | public override Drawable ToDrawable() 21 | { 22 | BitmapDrawable drawable = new BitmapDrawable(this.ImageSource.GetBitmap()); 23 | if (this.Stretch == Stretch.None) 24 | { 25 | drawable.Gravity = GravityFlags.Center; 26 | } 27 | else 28 | { 29 | drawable.Gravity = GravityFlags.Fill; 30 | } 31 | return drawable; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /System.Windows/Media/ImageBrush.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using Appercode.UI.Controls.Media; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Windows; 8 | using System.Windows.Media; 9 | 10 | namespace System.Windows.Media 11 | { 12 | public sealed partial class ImageBrush : Brush 13 | { 14 | public static readonly DependencyProperty ImageSourceProperty = 15 | DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ImageBrush), new PropertyMetadata(12900, (d, e) => { })); 16 | 17 | public static readonly DependencyProperty StretchProperty = 18 | DependencyProperty.Register("Stretch", typeof(Stretch), typeof(ImageBrush), new PropertyMetadata(Stretch.Fill)); 19 | 20 | public ImageSource ImageSource 21 | { 22 | get 23 | { 24 | return (ImageSource)this.GetValue(ImageBrush.ImageSourceProperty); 25 | } 26 | set 27 | { 28 | this.SetValue(ImageBrush.ImageSourceProperty, value); 29 | } 30 | } 31 | 32 | public Stretch Stretch 33 | { 34 | get { return (Stretch)this.GetValue(StretchProperty); } 35 | set { this.SetValue(StretchProperty, value); } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /System.Windows/Media/MediaElementState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Media 7 | { 8 | public enum MediaElementState 9 | { 10 | Closed = 0, 11 | Opening = 1, 12 | Buffering = 2, 13 | Playing = 3, 14 | Paused = 4, 15 | Stopped = 5, 16 | Individualizing = 6, 17 | AcquiringLicense = 7 18 | } 19 | } -------------------------------------------------------------------------------- /System.Windows/Media/SolidColorBrush.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.Graphics.Drawables; 2 | 3 | namespace System.Windows.Media 4 | { 5 | public partial class SolidColorBrush 6 | { 7 | public override Drawable ToDrawable() 8 | { 9 | return new ColorDrawable(Color.ToNativeColor()); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /System.Windows/Media/SolidColorBrush.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using System; 3 | using System.Windows.Media; 4 | 5 | namespace System.Windows.Media 6 | { 7 | public sealed partial class SolidColorBrush : Brush 8 | { 9 | public static readonly DependencyProperty ColorProperty = 10 | DependencyProperty.Register("Color", typeof(object), typeof(System.Windows.Media.Color), 11 | new PropertyMetadata(null, (d, e) => 12 | { 13 | })); 14 | 15 | public SolidColorBrush(Color color) 16 | { 17 | this.Color = color; 18 | } 19 | 20 | public System.Windows.Media.Color Color 21 | { 22 | get 23 | { 24 | return (Color)this.GetValue(SolidColorBrush.ColorProperty); 25 | } 26 | set 27 | { 28 | this.SetValue(SolidColorBrush.ColorProperty, value); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /System.Windows/Media/SolidColorBrush.iOS.cs: -------------------------------------------------------------------------------- 1 | using CoreGraphics; 2 | using UIKit; 3 | 4 | namespace System.Windows.Media 5 | { 6 | public partial class SolidColorBrush 7 | { 8 | public override UIColor ToUIColor(CGSize size) 9 | { 10 | /*byte[] data = new byte[(int)(rect.Width * 4 * rect.Height)]; 11 | CGBitmapContext context = new CGBitmapContext(data, (int)rect.Width, (int)rect.Height, 8, (int)rect.Width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.NoneSkipFirst); 12 | context.ScaleCTM(1f, -1f); 13 | context.TranslateCTM(0, -rect.Height); 14 | context.SetFillColor(1.0f, 0.0f, 0.5f, 1.0f); 15 | context.FillRect(rect); 16 | 17 | var cgImage = context.ToImage(); 18 | var image = new UIImage(cgImage); 19 | 20 | var color = UIColor.FromPatternImage(image); 21 | 22 | context.Dispose(); 23 | cgImage.Dispose(); 24 | * 25 | */ 26 | 27 | UIColor color = new UIColor(this.Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f, this.Color.A / 255f); 28 | 29 | return color; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /System.Windows/Media/Stretch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows.Media 7 | { 8 | public enum Stretch 9 | { 10 | /// 11 | /// The content preserves its original size. 12 | /// 13 | None, 14 | 15 | /// 16 | /// The content is resized to fill the destination dimensions. The aspect ratio is not preserved. 17 | /// 18 | Fill, 19 | 20 | /// 21 | /// The content is resized to fit in the destination dimensions while it preserves its native aspect ratio. 22 | /// 23 | Uniform, 24 | 25 | /// 26 | /// The content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions. 27 | /// 28 | UniformToFill 29 | } 30 | } -------------------------------------------------------------------------------- /System.Windows/NullableBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Globalization; 3 | using Appercode.UI.Controls; 4 | 5 | namespace System.Windows 6 | { 7 | public sealed class NullableBoolConverter : TypeConverter 8 | { 9 | public NullableBoolConverter() 10 | { 11 | } 12 | 13 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 14 | { 15 | if (TypeConverters.CanConvertFrom(sourceType)) 16 | { 17 | return true; 18 | } 19 | return sourceType == typeof(bool); 20 | } 21 | 22 | public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) 23 | { 24 | bool? nullable; 25 | if (value is bool) 26 | { 27 | return (bool?)value; 28 | } 29 | string str = value as string; 30 | if (str == null && value != null) 31 | { 32 | return TypeConverters.ConvertFrom(this, value, null); 33 | } 34 | if (!string.IsNullOrEmpty(str)) 35 | { 36 | nullable = new bool?(bool.Parse(str)); 37 | } 38 | else 39 | { 40 | bool? nullable1 = null; 41 | nullable = nullable1; 42 | } 43 | return nullable; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /System.Windows/ReadOnlyFrameworkPropertyMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace System.Windows 4 | { 5 | internal class ReadOnlyFrameworkPropertyMetadata : PropertyMetadata 6 | { 7 | private GetReadOnlyValueCallback getValueCallback; 8 | 9 | public ReadOnlyFrameworkPropertyMetadata(object defaultValue, GetReadOnlyValueCallback getValueCallback) 10 | : base(defaultValue) 11 | { 12 | this.getValueCallback = getValueCallback; 13 | } 14 | 15 | internal override GetReadOnlyValueCallback GetReadOnlyValueCallback 16 | { 17 | get { return this.getValueCallback; } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /System.Windows/RoutedPropertyChangedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | 8 | namespace System.Windows 9 | { 10 | public delegate void RoutedPropertyChangedEventHandler(object sender, RoutedPropertyChangedEventArgs e); 11 | 12 | public class RoutedPropertyChangedEventArgs : RoutedEventArgs 13 | { 14 | public RoutedPropertyChangedEventArgs(T oldValue, T newValue) 15 | { 16 | this.OldValue = oldValue; 17 | this.NewValue = newValue; 18 | } 19 | public T NewValue 20 | { 21 | get; 22 | private set; 23 | } 24 | 25 | public T OldValue 26 | { 27 | get; 28 | private set; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /System.Windows/Thickness.iOS.cs: -------------------------------------------------------------------------------- 1 | using Appercode.UI; 2 | using UIKit; 3 | 4 | namespace System.Windows 5 | { 6 | public partial struct Thickness 7 | { 8 | public static explicit operator UIEdgeInsets(Thickness thickness) 9 | { 10 | return new UIEdgeInsets(thickness.TopF(), thickness.LeftF(), thickness.BottomF(), thickness.RightF()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /System.Windows/Threading/Dispatcher.Abstract.cs: -------------------------------------------------------------------------------- 1 | namespace System.Windows.Threading 2 | { 3 | public sealed partial class Dispatcher 4 | { 5 | /// 6 | /// Is current thread the UI thread. 7 | /// 8 | public bool CheckAccess() 9 | { 10 | return true; 11 | } 12 | 13 | /// 14 | /// Invoke in UI thread. 15 | /// 16 | public void BeginInvoke(Action a) 17 | { 18 | a.Invoke(); 19 | } 20 | 21 | /// 22 | /// Invoke in UI thread. 23 | /// 24 | public void BeginInvoke(Delegate d, params object[] args) 25 | { 26 | d.DynamicInvoke(args); 27 | } 28 | 29 | private static object InvokeInternal(Delegate d, object[] args) 30 | { 31 | return d.DynamicInvoke(args); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /System.Windows/Threading/Dispatcher.Droid.cs: -------------------------------------------------------------------------------- 1 | using Android.OS; 2 | using System.Threading; 3 | 4 | namespace System.Windows.Threading 5 | { 6 | public sealed partial class Dispatcher 7 | { 8 | /// 9 | /// Invoke in UI thread. 10 | /// 11 | public void BeginInvoke(Action a) 12 | { 13 | var h = new Handler(Looper.MainLooper); 14 | h.Post(a); 15 | } 16 | 17 | /// 18 | /// Invoke in UI thread. 19 | /// 20 | public void BeginInvoke(Delegate d, params object[] args) 21 | { 22 | var h = new Handler(Looper.MainLooper); 23 | h.Post(() => d.DynamicInvoke(args)); 24 | } 25 | 26 | /// 27 | /// Is current thread the UI thread. 28 | /// 29 | public bool CheckAccess() 30 | { 31 | return SynchronizationContext.Current != null; 32 | } 33 | 34 | private static object InvokeInternal(Delegate d, object[] args) 35 | { 36 | throw new NotImplementedException("Synchronous invocation from a non-UI thread is not implemented."); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /System.Windows/Threading/DispatcherObject.Abstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace System.Windows.Threading 4 | { 5 | public partial class DispatcherObject 6 | { 7 | public DispatcherObject() 8 | { 9 | this.dispatcher = Dispatcher.CurrentDispatcher; 10 | } 11 | 12 | public void VerifyAccess() 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /System.Windows/Threading/DispatcherObject.Droid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Android.App; 7 | using Android.Content; 8 | using Android.OS; 9 | using Android.Runtime; 10 | using Android.Views; 11 | using Android.Widget; 12 | 13 | namespace System.Windows.Threading 14 | { 15 | public partial class DispatcherObject 16 | { 17 | /// Initializes a new instance of the class. 18 | protected DispatcherObject() 19 | { 20 | this.dispatcher = Dispatcher.CurrentDispatcher; 21 | } 22 | 23 | public void VerifyAccess() 24 | { 25 | if(this.dispatcher != null) 26 | { 27 | this.dispatcher.CheckAccess(); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /System.Windows/Threading/DispatcherObject.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | namespace System.Windows.Threading 3 | { 4 | public abstract partial class DispatcherObject 5 | { 6 | private Dispatcher dispatcher; 7 | 8 | /// Gets the this is associated with. 9 | /// The dispatcher. 10 | public Dispatcher Dispatcher 11 | { 12 | get 13 | { 14 | return this.dispatcher; 15 | } 16 | } 17 | 18 | /// Determines whether the calling thread has access to this . 19 | /// true if the calling thread has access to this object; otherwise, false. 20 | public bool CheckAccess() 21 | { 22 | bool flag = true; 23 | Dispatcher dispatcher = this.dispatcher; 24 | if (dispatcher != null) 25 | { 26 | flag = dispatcher.CheckAccess(); 27 | } 28 | return flag; 29 | } 30 | 31 | internal void DetachFromDispatcher() 32 | { 33 | this.dispatcher = null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /System.Windows/Threading/DispatcherObject.iOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace System.Windows.Threading 8 | { 9 | public partial class DispatcherObject 10 | { 11 | /// Initializes a new instance of the class. 12 | protected DispatcherObject() 13 | { 14 | this.dispatcher = Dispatcher.CurrentDispatcher; 15 | } 16 | 17 | public void VerifyAccess() 18 | { 19 | if (this.dispatcher != null) 20 | { 21 | this.dispatcher.CheckAccess(); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /System.Windows/VerticalAlignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Windows 7 | { 8 | public enum VerticalAlignment 9 | { 10 | Top, 11 | Center, 12 | Bottom, 13 | Stretch 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TextChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace Appercode.UI 5 | { 6 | public class TextChangedEventArgs : RoutedEventArgs 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /packages.Appercode.UIFramework.Droid.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------