コード例 #1
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.ItemsView.HorizontalScrollBarVisibility):
                ItemsViewControl.HorizontalScrollBarVisibility = (XF.ScrollBarVisibility)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.ItemsView.ItemsUpdatingScrollMode):
                ItemsViewControl.ItemsUpdatingScrollMode = (XF.ItemsUpdatingScrollMode)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.ItemsView.RemainingItemsThreshold):
                ItemsViewControl.RemainingItemsThreshold = AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.ItemsView.VerticalScrollBarVisibility):
                ItemsViewControl.VerticalScrollBarVisibility = (XF.ScrollBarVisibility)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.ItemsView.ItemsSource):
                ItemsViewControl.ItemsSource = AttributeHelper.DelegateToObject <IEnumerable>(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #2
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.MenuItem.@class):
                MenuItemControl.@class = AttributeHelper.GetStringList(attributeValue);
                break;

            case nameof(XF.MenuItem.IconImageSource):
                MenuItemControl.IconImageSource = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.MenuItem.IsDestructive):
                MenuItemControl.IsDestructive = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.MenuItem.IsEnabled):
                MenuItemControl.IsEnabled = AttributeHelper.GetBool(attributeValue, true);
                break;

            case nameof(XF.MenuItem.StyleClass):
                MenuItemControl.StyleClass = AttributeHelper.GetStringList(attributeValue);
                break;

            case nameof(XF.MenuItem.Text):
                MenuItemControl.Text = (string)attributeValue;
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #3
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.Image.Aspect):
                ImageControl.Aspect = (XF.Aspect)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.Image.IsAnimationPlaying):
                ImageControl.IsAnimationPlaying = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.Image.IsOpaque):
                ImageControl.IsOpaque = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.Image.Source):
                ImageControl.Source = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #4
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(MC.SelectableItemsView.SelectedItem):
                SelectableItemsViewControl.SelectedItem = AttributeHelper.DelegateToObject <object>(attributeValue);
                break;

            case nameof(MC.SelectableItemsView.SelectedItems):
                // Don't assign value if lists content is equal. Otherwise leads to infinite loop when binded.
                var listValue = AttributeHelper.DelegateToObject <IList <object> >(attributeValue);
                if (!Enumerable.SequenceEqual(listValue, SelectableItemsViewControl.SelectedItems))
                {
                    SelectableItemsViewControl.SelectedItems = listValue;
                }
                break;

            case nameof(MC.SelectableItemsView.SelectionMode):
                SelectableItemsViewControl.SelectionMode = (MC.SelectionMode)AttributeHelper.GetInt(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #5
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.Page.BackgroundImageSource):
                PageControl.BackgroundImageSource = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Page.IconImageSource):
                PageControl.IconImageSource = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Page.IsBusy):
                PageControl.IsBusy = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.Page.Padding):
                PageControl.Padding = AttributeHelper.StringToThickness(attributeValue);
                break;

            case nameof(XF.Page.Title):
                PageControl.Title = (string)attributeValue;
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #6
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.Button.BorderColor):
                ButtonControl.BorderColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Button.BorderWidth):
                ButtonControl.BorderWidth = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            case nameof(XF.Button.CharacterSpacing):
                ButtonControl.CharacterSpacing = AttributeHelper.StringToDouble((string)attributeValue);
                break;

            case nameof(XF.Button.CornerRadius):
                ButtonControl.CornerRadius = AttributeHelper.GetInt(attributeValue, -1);
                break;

            case nameof(XF.Button.FontAttributes):
                ButtonControl.FontAttributes = (XF.FontAttributes)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.Button.FontFamily):
                ButtonControl.FontFamily = (string)attributeValue;
                break;

            case nameof(XF.Button.FontSize):
                ButtonControl.FontSize = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            case nameof(XF.Button.ImageSource):
                ButtonControl.ImageSource = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Button.Padding):
                ButtonControl.Padding = AttributeHelper.StringToThickness(attributeValue);
                break;

            case nameof(XF.Button.Text):
                ButtonControl.Text = (string)attributeValue;
                break;

            case nameof(XF.Button.TextColor):
                ButtonControl.TextColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Button.TextTransform):
                ButtonControl.TextTransform = (XF.TextTransform)AttributeHelper.GetInt(attributeValue, (int)XF.TextTransform.Default);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #7
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.Shell.FlyoutBackgroundColor):
                ShellControl.FlyoutBackgroundColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Shell.FlyoutBackgroundImage):
                ShellControl.FlyoutBackgroundImage = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Shell.FlyoutBackgroundImageAspect):
                ShellControl.FlyoutBackgroundImageAspect = (XF.Aspect)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.Shell.FlyoutBehavior):
                ShellControl.FlyoutBehavior = (XF.FlyoutBehavior)AttributeHelper.GetInt(attributeValue, (int)XF.FlyoutBehavior.Flyout);
                break;

            case nameof(XF.Shell.FlyoutHeaderBehavior):
                ShellControl.FlyoutHeaderBehavior = (XF.FlyoutHeaderBehavior)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.Shell.FlyoutHeight):
                ShellControl.FlyoutHeight = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            case nameof(XF.Shell.FlyoutIcon):
                ShellControl.FlyoutIcon = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Shell.FlyoutIsPresented):
                ShellControl.FlyoutIsPresented = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.Shell.FlyoutVerticalScrollMode):
                ShellControl.FlyoutVerticalScrollMode = (XF.ScrollMode)AttributeHelper.GetInt(attributeValue, (int)XF.ScrollMode.Auto);
                break;

            case nameof(XF.Shell.FlyoutWidth):
                ShellControl.FlyoutWidth = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #8
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.InputView.CharacterSpacing):
                InputViewControl.CharacterSpacing = AttributeHelper.StringToDouble((string)attributeValue);
                break;

            case nameof(XF.InputView.IsReadOnly):
                InputViewControl.IsReadOnly = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.InputView.IsSpellCheckEnabled):
                InputViewControl.IsSpellCheckEnabled = AttributeHelper.GetBool(attributeValue, true);
                break;

            case nameof(XF.InputView.Keyboard):
                InputViewControl.Keyboard = AttributeHelper.DelegateToObject <XF.Keyboard>(attributeValue);
                break;

            case nameof(XF.InputView.MaxLength):
                InputViewControl.MaxLength = AttributeHelper.GetInt(attributeValue, int.MaxValue);
                break;

            case nameof(XF.InputView.Placeholder):
                InputViewControl.Placeholder = (string)attributeValue;
                break;

            case nameof(XF.InputView.PlaceholderColor):
                InputViewControl.PlaceholderColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.InputView.Text):
                InputViewControl.Text = (string)attributeValue;
                break;

            case nameof(XF.InputView.TextColor):
                InputViewControl.TextColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.InputView.TextTransform):
                InputViewControl.TextTransform = (XF.TextTransform)AttributeHelper.GetInt(attributeValue, (int)XF.TextTransform.Default);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #9
0
        public void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(WVM.RootComponent.ComponentType):
                RootComponentControl.ComponentType = AttributeHelper.DelegateToObject <Type>(attributeValue);
                break;

            case nameof(WVM.RootComponent.Parameters):
                RootComponentControl.Parameters = AttributeHelper.DelegateToObject <IDictionary <string, object> >(attributeValue);
                break;

            case nameof(WVM.RootComponent.Selector):
                RootComponentControl.Selector = (string)attributeValue;
                break;
            }
        }
コード例 #10
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(MC.StructuredItemsView.ItemSizingStrategy):
                StructuredItemsViewControl.ItemSizingStrategy = (MC.ItemSizingStrategy)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(MC.StructuredItemsView.ItemsLayout):
                StructuredItemsViewControl.ItemsLayout = AttributeHelper.DelegateToObject <MC.IItemsLayout>(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #11
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.BaseShellItem.FlyoutIcon):
                BaseShellItemControl.FlyoutIcon = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.BaseShellItem.FlyoutItemIsVisible):
                BaseShellItemControl.FlyoutItemIsVisible = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.BaseShellItem.Icon):
                BaseShellItemControl.Icon = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.BaseShellItem.IsEnabled):
                BaseShellItemControl.IsEnabled = AttributeHelper.GetBool(attributeValue, true);
                break;

            case nameof(XF.BaseShellItem.IsTabStop):
                BaseShellItemControl.IsTabStop = AttributeHelper.GetBool(attributeValue, true);
                break;

            case nameof(XF.BaseShellItem.IsVisible):
                BaseShellItemControl.IsVisible = AttributeHelper.GetBool(attributeValue, true);
                break;

            case nameof(XF.BaseShellItem.Route):
                BaseShellItemControl.Route = (string)attributeValue;
                break;

            case nameof(XF.BaseShellItem.TabIndex):
                BaseShellItemControl.TabIndex = AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.BaseShellItem.Title):
                BaseShellItemControl.Title = (string)attributeValue;
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #12
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.ImageButton.Aspect):
                ImageButtonControl.Aspect = (XF.Aspect)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(XF.ImageButton.BorderColor):
                ImageButtonControl.BorderColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.ImageButton.BorderWidth):
                ImageButtonControl.BorderWidth = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            case nameof(XF.ImageButton.CornerRadius):
                ImageButtonControl.CornerRadius = AttributeHelper.GetInt(attributeValue, -1);
                break;

            case nameof(XF.ImageButton.IsOpaque):
                ImageButtonControl.IsOpaque = AttributeHelper.GetBool(attributeValue);
                break;

            case nameof(XF.ImageButton.Padding):
                ImageButtonControl.Padding = AttributeHelper.StringToThickness(attributeValue);
                break;

            case nameof(XF.ImageButton.Source):
                ImageButtonControl.Source = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #13
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(XF.Slider.Maximum):
                SliderControl.Maximum = AttributeHelper.StringToDouble((string)attributeValue, 1.00);
                break;

            case nameof(XF.Slider.MaximumTrackColor):
                SliderControl.MaximumTrackColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Slider.Minimum):
                SliderControl.Minimum = AttributeHelper.StringToDouble((string)attributeValue);
                break;

            case nameof(XF.Slider.MinimumTrackColor):
                SliderControl.MinimumTrackColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Slider.ThumbColor):
                SliderControl.ThumbColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(XF.Slider.ThumbImageSource):
                SliderControl.ThumbImageSource = AttributeHelper.DelegateToObject <XF.ImageSource>(attributeValue);
                break;

            case nameof(XF.Slider.Value):
                SliderControl.Value = AttributeHelper.StringToDouble((string)attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }
コード例 #14
0
        public override void ApplyAttribute(ulong attributeEventHandlerId, string attributeName, object attributeValue, string attributeEventUpdatesAttributeName)
        {
            switch (attributeName)
            {
            case nameof(MC.Picker.CharacterSpacing):
                PickerControl.CharacterSpacing = AttributeHelper.StringToDouble((string)attributeValue, 0.0);
                break;

            case nameof(MC.Picker.FontAttributes):
                PickerControl.FontAttributes = (MC.FontAttributes)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(MC.Picker.FontFamily):
                PickerControl.FontFamily = (string)attributeValue;
                break;

            case nameof(MC.Picker.FontSize):
                PickerControl.FontSize = AttributeHelper.StringToDouble((string)attributeValue, -1.00);
                break;

            case nameof(MC.Picker.HorizontalTextAlignment):
                PickerControl.HorizontalTextAlignment = (TextAlignment)AttributeHelper.GetInt(attributeValue);
                break;

            case nameof(MC.Picker.ItemDisplayBinding):
                PickerControl.ItemDisplayBinding = new MC.Binding((string)attributeValue);
                break;

            case nameof(MC.Picker.ItemsSource):
                var items = AttributeHelper.DelegateToObject <IList>(attributeValue);
                // IMPORTANT! don't set ItemsSource again if it is already set
                // Resetting ItemsSource will confuse the SelectedItem property and cause and infinite loop
                if (PickerControl.ItemsSource != items)
                {
                    PickerControl.ItemsSource = items;
                }
                break;

            case nameof(MC.Picker.TextColor):
                PickerControl.TextColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(MC.Picker.Title):
                PickerControl.Title = (string)attributeValue;
                break;

            case nameof(MC.Picker.TitleColor):
                PickerControl.TitleColor = AttributeHelper.StringToColor((string)attributeValue);
                break;

            case nameof(MC.Picker.SelectedIndex):
                var index = AttributeHelper.GetInt(attributeValue);
                if (PickerControl.SelectedIndex != index)
                {
                    PickerControl.SelectedIndex = index;
                }
                break;

            case nameof(MC.Picker.SelectedItem):
                var item = AttributeHelper.DelegateToObject <object>(attributeValue);
                if (PickerControl.SelectedItem != item)
                {
                    PickerControl.SelectedItem = item;
                }
                break;

            case nameof(MC.Label.VerticalTextAlignment):
                PickerControl.VerticalTextAlignment = (TextAlignment)AttributeHelper.GetInt(attributeValue);
                break;

            default:
                base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
                break;
            }
        }