• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# BindableObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BindableObject的典型用法代码示例。如果您正苦于以下问题:C# BindableObject类的具体用法?C# BindableObject怎么用?C# BindableObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BindableObject类属于命名空间,在下文中一共展示了BindableObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ItemsSourcePropertyChanged

 private static void ItemsSourcePropertyChanged(BindableObject bindable, object oldValue, object newValue)
 {
     var articles = newValue as IEnumerable;
     var galery = bindable as ArticleCarouselView;
     if (galery != null)
     {
         if (articles != null)
         {
             foreach (var article in articles)
             {
                 try
                 {
                     galery.BatchBegin();
                     galery.Children.Add(new BigArticleView {BindingContext = article});
                     galery.BatchCommit();
                 }
                 catch
                 {
                 }
             }
         }
         else
         {
             try
             {
                 galery.Children.Clear();
             }
             catch
             {
             }
         }
     }
 }
开发者ID:woellij,项目名称:LokalReporterApp,代码行数:33,代码来源:ArticleCarouselView.xaml.cs


示例2: ItemsSourceChanged

        private static void ItemsSourceChanged(BindableObject bindable, IEnumerable oldValue, IEnumerable newValue) {
            var picker = (Picker)bindable;
            if (picker == null)
                throw new Exception("only support Picker");

            var selected = picker.SelectedIndex;

            var type = newValue.GetType().GenericTypeArguments[0].GetTypeInfo();
            var dp = (string)bindable.GetValue(DisplayPathProperty);
            PropertyInfo p = null;
            if (!string.IsNullOrWhiteSpace(dp)) {
                p = type.GetDeclaredProperty(dp);
            }
            foreach (var o in newValue) {
                object value = null;
                if (p != null)
                    value = p.GetValue(o);
                else
                    value = o;

                if (value != null)
                    picker.Items.Add(value.ToString());
            }

            picker.SelectedIndex = selected;
        }
开发者ID:zhangcj,项目名称:Xamarin.Forms.Lagou,代码行数:26,代码来源:PickerBinder.cs


示例3: OnSelectTemplate

		protected override DataTemplate OnSelectTemplate(object item, int columnIndex, BindableObject container)
		{
			if (columnIndex == 0)
				return _leftTemplate;

			return _rightTemplate;
		}
开发者ID:daniel-luberda,项目名称:DLToolkit.Forms.Controls,代码行数:7,代码来源:TemplateSelectorPageSelector.cs


示例4: OnItemsSourceChanged

 private static void OnItemsSourceChanged(BindableObject bindable, IEnumerable oldvalue, IEnumerable newvalue)
 {
     var radButtons = bindable as BindableRadioGroup;
    
     radButtons.rads.Clear();
     radButtons.Children.Clear();
     if (newvalue != null)
     {
       
         int radIndex = 0;
         foreach (var item in newvalue)
         {
             var rad = new CustomRadioButton();
             rad.Text = item.ToString();
             rad.Id = radIndex;  
            
             rad.CheckedChanged += radButtons.OnCheckedChanged;
           
             radButtons.rads.Add(rad);
                             
             radButtons.Children.Add(rad);
             radIndex++;
         }
     }
 }
开发者ID:kirtisagar,项目名称:XamarinFormsRadioButtonXAML,代码行数:25,代码来源:BindableRadioGroup.cs


示例5: IsShowAnimChanged

 private static void IsShowAnimChanged(BindableObject bindable, bool oldvalue, bool newvalue)
 {
     var control = bindable as SkypeAnimControl;
     if(control == null) return;
     control.IsShowAnim = newvalue;
     control.ShowAnimEvent?.Invoke(control, new EventArgs());
 }
开发者ID:xamarindevelopervietnam,项目名称:XSkypeControl,代码行数:7,代码来源:SkypeAnimControl.cs


示例6: VMChanged

        private static void VMChanged(BindableObject bindable, object oldValue, object newValue)
        {
            if (newValue == null)
                return;

            var vm = (Screen)newValue;
            //var view = vm.GetView();
            var vmView = ViewLocator.LocateForModel(vm, null, null);
            if (vmView == null)
                throw new Exception("没有找到视图");
            ViewModelBinder.Bind(vm, vmView, null);

            var activator = vm as IActivate;
            if (activator != null)
                activator.Activate();

            var page = (ViewLocatorPage)bindable;
            if (null != (ContentPage)vmView) {
                var vp = (ContentPage)vmView;
                page.Content = vp.Content;
                if (vp.ToolbarItems != null)
                    foreach (var t in vp.ToolbarItems)
                        page.ToolbarItems.Add(t);
            } else if (null != (Xamarin.Forms.View)vmView) {
                page.Content = (Xamarin.Forms.View)vmView;
            }
        }
开发者ID:gruan01,项目名称:Xamarin-Example,代码行数:27,代码来源:ViewLocatorPage.cs


示例7: UpdateTexts

		static void UpdateTexts(BindableObject bindable, string oldValue, string newValue)
		{
			var instance = bindable as Bz29300DummyView;
			instance.Children.Clear();
			for (int i = 0; i < instance.NumOfRepeat; i++)
				instance.Children.Add(new Label() {Text = newValue });
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:Bz29300.xaml.cs


示例8: MergedStyle

			public MergedStyle(Type targetType, BindableObject target)
			{
				Target = target;
				TargetType = targetType;
				RegisterImplicitStyles();
				Apply(Target);
			}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:MergedStyle.cs


示例9: OnItemsSourceChanged

//		void UpdateSelected()
//		{
//			if (ItemsSource != null)
//			{
//				if (ItemsSource.Contains(SelectedItem))
//				{
//					SelectedIndex = ItemsSource.IndexOf(SelectedItem);
//				}
//				else
//				{
//					SelectedIndex = -1;
//				}
//			}
//		}

		static void OnItemsSourceChanged(BindableObject bindable, IList oldvalue, IList newvalue)
		{
			var picker = bindable as BindablePicker;

			if (picker != null)
			{
				picker.Items.Clear();
				if (newvalue == null) return;
				//now it works like "subscribe once" but you can improve
				foreach (var item in newvalue)
				{
					if (string.IsNullOrEmpty(picker.DisplayMember))
					{
						picker.Items.Add(item.ToString());
					}
					else
					{
						var type = item.GetType();

						var prop = type.GetProperty(picker.DisplayMember);

						picker.Items.Add(prop.GetValue(item).ToString());
					}
				}
			}
		}
开发者ID:RoyStobbelaar,项目名称:MedewerkerTemp,代码行数:41,代码来源:BindablePicker.cs


示例10: AccessoryButtonsPropertyChanging

        private static void AccessoryButtonsPropertyChanging(BindableObject bindable, object oldvalue,
            object newvalue)
        {
            var oldList = oldvalue as List<ToolBarButton>;

            if (oldList != null)
            {
                foreach (var button in oldList)
                    button.BindingContext = null;
            }

            var oldObs = oldvalue as INotifyCollectionChanged;
            if (oldObs != null)
                oldObs.CollectionChanged -= ((ToolBar)bindable).ButtonsOnCollectionChanged;

            var newList = newvalue as List<ToolBarButton>;

            if (newList != null)
            {
                var entry = (ExtendedEntry)bindable;
                foreach (var button in newList)
                    button.BindingContext = entry.BindingContext;
            }

            var newObs = newvalue as INotifyCollectionChanged;
            if (newObs != null)
                newObs.CollectionChanged += ((ToolBar)bindable).ButtonsOnCollectionChanged;
        }
开发者ID:jimbobbennett,项目名称:JimLib.Xamarin,代码行数:28,代码来源:ToolBar.cs


示例11: ApplyStyle

 private static void ApplyStyle(BindableObject bindable, Style newvalue)
 {
   foreach (var setter in newvalue.Setters )
   {
       bindable.SetValue(setter.Property, setter.Value);
   }
 }
开发者ID:patridge,项目名称:Xamarin.Forms.Plugins,代码行数:7,代码来源:ExtendedTextCell.cs


示例12: SelectTemplate

		/// <summary>
		/// Selects the template.
		/// </summary>
		/// <returns>The template.</returns>
		/// <param name="item">Item.</param>
		/// <param name="columnIndex">Column index.</param>
		/// <param name="container">Container.</param>
		public DataTemplate SelectTemplate(object item, int columnIndex, BindableObject container)
		{
			DataTemplate result = OnSelectTemplate(item, columnIndex, container);
			if (result is DataTemplateSelector || result is FlowTemplateSelector)
				throw new NotSupportedException("FlowTemplateSelector.OnSelectTemplate must not return another DataTemplateSelector");
			return result;
		}
开发者ID:daniel-luberda,项目名称:DLToolkit.Forms.Controls,代码行数:14,代码来源:FlowTemplateSelector.cs


示例13: OnItemsSourceChanged

        private static void OnItemsSourceChanged(BindableObject bindable, IEnumerable oldvalue, IEnumerable newvalue)
        {
            var radios = bindable as BindableRadioButtonGroup;

            if (radios == null)
            {
                return;
            }

            radios.RadioButtons.Clear();
            radios.Children.Clear();

            if (newvalue == null)
            {
                return;
            }

            var index = 0;
            foreach (var item in newvalue)
            {
                var radioButton = new CustomRadioButton { Text = item.ToString(), Id = index };

                radioButton.CheckedChanged += radios.OnCheckedChanged;

                radios.RadioButtons.Add(radioButton);

                radios.Children.Add(radioButton);
                index++;
            }
        }
开发者ID:JustinJohnWilliams,项目名称:CustomRadioButtons,代码行数:30,代码来源:BindableRadioButtonGroup.cs


示例14: GetNativeView

 public static Android.Views.View GetNativeView(BindableObject bindableObject)
 {
     var renderer = bindableObject.GetRenderer ();
     var viewGroup = renderer.ViewGroup;
     var rootView = viewGroup.RootView;
     return rootView;
 }
开发者ID:Pizzajongen,项目名称:TwinTechsFormsLib,代码行数:7,代码来源:RendererHelper.cs


示例15: OnIsSelectedChanged

		private static void OnIsSelectedChanged (BindableObject bindable, object oldvalue, object newvalue)
		{
			var tabButton = bindable as TabButton;

			tabButton.BackgroundColor = tabButton.IsSelected ? AppConstants.HeaderBackground : Color.Transparent;
			tabButton.TextColor = tabButton.IsSelected ? AppConstants.HeaderTextColour : AppConstants.TextColour;
		}
开发者ID:Vineland,项目名称:DarkestNight.App,代码行数:7,代码来源:TabButton.cs


示例16: OnHorizontalTextAlignmentPropertyChanged

		static void OnHorizontalTextAlignmentPropertyChanged(BindableObject bindable, object oldValue, object newValue)
		{
			var label = (EntryCell)bindable;
#pragma warning disable 0618 // retain until XAlign removed
			label.OnPropertyChanged(nameof(XAlign));
#pragma warning restore
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:EntryCell.cs


示例17: OnItemsSourcePropertyChanged

        private static void OnItemsSourcePropertyChanged(BindableObject bindable, IEnumerable<ILabel> oldvalue,
            IEnumerable<ILabel> newvalue)
        {
            var control = bindable as Label;
            control.FormattedText = null;

            if (newvalue == null) return;

            var formattedString = new FormattedString();
            foreach (var label in newvalue)
            {
                var color = Color.FromHex(label.Color);

                formattedString.Spans.Add(new Span
                {
                    Text = $"\u00A0{label.Name}\u00A0",
                    ForegroundColor =
                        (Color)
                            Application.Current.Resources[
                                (color.Hue > 0 ? "PrimaryLightTextColor" : "PrimaryDarkTextColor")],
                    BackgroundColor = color
                });
                formattedString.Spans.Add(new Span
                {
                    Text = " "
                });
            }

            control.FormattedText = formattedString;
        }
开发者ID:XamarinGarage,项目名称:GiTracker,代码行数:30,代码来源:IssueLabelsList.cs


示例18: OnItemsSourceChanged

        private static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BoundPicker boundPicker = (BoundPicker)bindable;
            //boundPicker.BatchBegin ();
            try
            {
                boundPicker.Items.Clear();
                var enumerable = newValue as IEnumerable;
                if (enumerable != null && enumerable.GetEnumerator().MoveNext())
                {
                    foreach (var item in enumerable)
                    {
                        boundPicker.Items.Add(item.ToString());
                    }
                }
                else
                {
                    boundPicker.Items.Add(" ");
                }

                boundPicker.InternalUpdateSelectedIndex();
            }
            finally {
                //boundPicker.BatchCommit ();
            }
        }
开发者ID:powerdude,项目名称:soltechxf,代码行数:26,代码来源:BoundPicker.cs


示例19: CommandParameterPropertyChanged

        private static void CommandParameterPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
        {
            var gesture = ((ExtendedImage) bindable)._tapGestureRecognizer;

            if (gesture != null && gesture.Command != null)
                ((RelayCommand)gesture.Command).RaiseCanExecuteChanged();
        }
开发者ID:jimbobbennett,项目名称:JimLib.Xamarin,代码行数:7,代码来源:ExtendedImage.cs


示例20: loadItemsAndSetSelected

 static void loadItemsAndSetSelected(BindableObject bindable)
 {
     ExtendedPicker picker = (ExtendedPicker)bindable;
     if (picker.ItemsSource as IEnumerable != null)
     {
         int count = 0;
         foreach (object obj in (IEnumerable)picker.ItemsSource)
         {
             string value = string.Empty;
             if (picker.DisplayProperty != null)
             {
                 var prop = obj.GetType().GetRuntimeProperties().FirstOrDefault(p => string.Equals(p.Name, picker.DisplayProperty, StringComparison.OrdinalIgnoreCase));
                 if (prop != null)
                 {
                     value = prop.GetValue(obj).ToString();
                 }
             }
             else
             {
                 value = obj.ToString();
             }
             picker.Items.Add(value);
             if (picker.SelectedItem != null)
             {
                 if (picker.SelectedItem == obj)
                 {
                     picker.SelectedIndex = count;
                 }
             }
             count++;
         }
     }
 }
开发者ID:DaveCaldeira,项目名称:NavigationTest,代码行数:33,代码来源:ExtendedPicker.cs



注:本文中的BindableObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Binder类代码示例发布时间:2022-05-24
下一篇:
C# BindableCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap