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


C# ComboBox.ApplyTemplate方法代码示例

本文整理汇总了C#中System.Windows.Controls.ComboBox.ApplyTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.ApplyTemplate方法的具体用法?C# ComboBox.ApplyTemplate怎么用?C# ComboBox.ApplyTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ComboBox的用法示例。


在下文中一共展示了ComboBox.ApplyTemplate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetComboBoxPopup

 private static Popup GetComboBoxPopup(ComboBox comboBox)
 {
     if (comboBox == null || comboBox.Template == null)
     {
         return null;
     }
     comboBox.ApplyTemplate();
     return comboBox.Template.FindName(PopupTemplateName, comboBox) as Popup;
 }
开发者ID:noamkfir,项目名称:snoopwpf,代码行数:9,代码来源:ComboBoxSettings.cs

示例2: EnableEditing

 private bool EnableEditing(ComboBox box)
 {
     //Включаем редактирование
     if (!box.IsEditable && box.SelectedItem != null && box.SelectedItem.ToString().Length == 0)
     {
         box.IsEditable = true;
         box.ToolTip = Languages.Translate("Enter - apply, Esc - cancel.");
         box.ApplyTemplate();
         return true;
     }
     return false;
 }
开发者ID:MaksHDR,项目名称:xvid4psp,代码行数:12,代码来源:FormatSettings.xaml.cs

示例3: RemoveBeforeTemplateLoaded

		public void RemoveBeforeTemplateLoaded ()
		{
			int before = 0;
			int after = 0;
			ComboBox box = new ComboBox ();

			box.Loaded += delegate { before++; };
			TestPanel.Children.Add (box);
			box.Loaded += delegate { after++; };
			TestPanel.Children.Clear ();

			Enqueue (() => {
				Assert.AreEqual (1, before, "#1");
				Assert.AreEqual (0, after, "#2");
			});
			Enqueue (() => {
				// Make sure that the second handler definitely hasn't being called
				Assert.AreEqual (1, before, "#3");
				Assert.AreEqual (0, after, "#4");

				// Apply the template and see if this causes Loaded emission
				Assert.IsTrue (box.ApplyTemplate (), "#5");
			});
			Enqueue (() => {
				Assert.AreEqual (1, before, "#6");
				Assert.AreEqual (0, after, "#7");
			});

			EnqueueTestComplete ();
		}
开发者ID:kangaroo,项目名称:moon,代码行数:30,代码来源:LoadedTest.cs

示例4: RemoveAfterTemplateLoaded_test

		public void RemoveAfterTemplateLoaded_test (bool match_tick_numbers)
		{
			int before = 0;
			int after = 0;
			ComboBox box = new ComboBox ();

			box.Loaded += delegate { before++; };
			TestPanel.Children.Add (box);
			box.Loaded += delegate { after++; };

			Enqueue (() => {
				Assert.AreEqual (1, before, "#1");
				if (match_tick_numbers) {
					Assert.AreEqual (0, after, "#2");
				}
				box.ApplyTemplate ();
				TestPanel.Children.Clear ();
			});
			Enqueue (() => {
				Assert.AreEqual (1, before, "#3");
				Assert.AreEqual (1, after, "#4");
			});
			Enqueue (() => {
				// Make sure that the values really aren't changing
				Assert.AreEqual (1, before, "#5");
				Assert.AreEqual (1, after, "#6");
			});

			EnqueueTestComplete ();
		}
开发者ID:kangaroo,项目名称:moon,代码行数:30,代码来源:LoadedTest.cs

示例5: EmitBeforeAndAfter2

		public void EmitBeforeAndAfter2 ()
		{
			// If we call ApplyTemplate (), the second set of Loaded
			// events is emitted immediately.
			bool before_b = false;
			bool before_c = false;
			bool after_b = false;
			bool after_c = false;

			Canvas c = new Canvas ();
			ComboBox b = new ComboBox ();
			c.Children.Add (b);

			c.Loaded += delegate { before_c = true; };
			b.Loaded += delegate { before_b = true; };
			TestPanel.Children.Add (c);
			c.Loaded += delegate { after_c = true; };
			b.Loaded += delegate { after_b = true; };
			
			// Calling 'ApplyTemplate' emits the Loaded
			// events for the template, so all handlers will
			// be raised during the next tick.
			b.ApplyTemplate ();

			Enqueue (() => {
				Assert.IsTrue (before_b, "#1");
				Assert.IsTrue (before_c, "#2");
				Assert.IsTrue (after_b, "#3");
				Assert.IsTrue (after_c, "#4");
			});
			EnqueueTestComplete ();
		}
开发者ID:kangaroo,项目名称:moon,代码行数:32,代码来源:LoadedTest.cs

示例6: TemplateClosesDropdown

		public void TemplateClosesDropdown ()
		{
			ComboBox box = new ComboBox ();
			box.IsDropDownOpen = true;
			Assert.IsTrue (box.ApplyTemplate (), "#1");
			Assert.IsFalse (box.IsDropDownOpen, "#2");
		}
开发者ID:shana,项目名称:moon,代码行数:7,代码来源:ComboBoxTest.cs

示例7: SelectedItemUsesGenerator

		public void SelectedItemUsesGenerator ()
		{
			ComboBox box = new ComboBox ();
			CreateAsyncTest (box, () => {
				box.ApplyTemplate ();
				box.Items.Add (new object ());
				box.SelectedIndex = 0;
				Assert.IsNotNull (box.ItemContainerGenerator.ContainerFromIndex (0), "#1");
			});
		}
开发者ID:shana,项目名称:moon,代码行数:10,代码来源:ComboBoxTest.cs


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