Esempio n. 1
0
 public void DoesntApplyIfNotItemsSourceSubclass()
 {
     WrapInAThread(() =>
     {
         var textBox1 = new TextBox {
             DataContext = viewModel
         };
         var strategy1 = new ItemsControlContentStrategy();
         Assert.False(strategy1.Applies(new TemplateContext
         {
             Element         = textBox1,
             TemplateOptions = options
         }));
     });
 }
Esempio n. 2
0
        void GenerateTemplate(ItemsControl control)
        {
            ItemsControlContentStrategy strategy = new ItemsControlContentStrategy();
            var templateContext = new TemplateContext
            {
                Element         = control,
                TemplateOptions = options
            };

            if (strategy.Applies(templateContext))
            {
                strategy.Apply(templateContext);
                control.ItemsSource = viewModel.People;
            }
        }