30 likes | 112 Views
Pytania na egzamin #1. Szablony kontrolek. 1. Which of the following XAML samples correctly binds the Background property of the Label control in the template to the Background property of its templated parent?.
E N D
Pytania na egzamin #1 Szablony kontrolek
1. Which of the following XAML samples correctly binds the Backgroundproperty of theLabel control in the template to the Background property ofits templated parent? • A.<ControlTemplate x:Key="TestTemplate„> <LabelBackground="Background" /></ControlTemplate> • B.<ControlTemplate x:Key="TestTemplate„> <LabelBackground="{BindingBackground}" /></ControlTemplate> • C.<ControlTemplate x:Key="TestTemplate„> <Label Background="{TemplateBindingBackground}" /></ControlTemplate> • D.<ControlTemplate x:Key="TestTemplate„><Label Background="{Binding RelativeSource={RelativeSourceTemplatedParent}, Path=Background}" /></ControlTemplate>
2. Which of the following XAML samples correctly appliesthe control template to allinstances of Label in Window? • A.<Window.Resources><ControlTemplate x:Key="TestTemplate„TargetType="Label“><Label Background="{Binding RelativeSource={RelativeSourceTemplatedParent}, Path=Background}" /> </ControlTemplate> <Style TargetType="Label„><Setter Property="Template" Value="{StaticResourceTestTemplate}" /> </Style></Window.Resources> • B.<Window.Resources> <Style TargetType="Label„><Setter Property="Template" Value="{StaticResourceTestTemplate}" /> </Style><ControlTemplate x:Key="TestTemplate" TargetType="Label“><Label Background="{Binding RelativeSource={RelativeSourceTemplatedParent}, Path=Background}" /> </ControlTemplate></Window.Resources>