public void Template_Result_Becomes_Visual_Child() { Control templateResult = new Control(); var template = new FuncControlTemplate(_ => { return templateResult; }); var target = new TemplatedControl { Template = template, }; target.Measure(new Size(100, 100)); var children = target.GetVisualChildren().ToList(); Assert.Equal(new[] { templateResult }, children); }
public void Template_Gets_Executed_On_Measure() { bool executed = false; var template = new FuncControlTemplate(_ => { executed = true; return new Control(); }); var target = new TemplatedControl { Template = template, }; target.Measure(new Size(100, 100)); Assert.True(executed); }
public void TemplatedParent_Is_Set_On_Generated_Template() { Control templateResult = new Control(); var template = new ControlTemplate(_ => { return templateResult; }); var target = new TemplatedControl { Template = template, }; target.Measure(new Size(100, 100)); Assert.Equal(target, templateResult.TemplatedParent); }