当前位置: 首页>>代码示例>>C#>>正文


C# BindableObject类代码示例

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


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


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