Customize Appearance

These questions are based on 70-502 CSHP – TS – Microsoft .NET Framework 3.5: Windows Presentation Foundation (C# .NET)
Microsoft
Self Test Software Practice Test


Objective: Customize appearance.
Sub-objective: Change the appearance of a control by using templates.


Multiple answer, multiple-choice


You are using the Microsoft .NET 3.5 Framework.


You are developing a Windows Presentation Foundation (WPF) application to manage customer surveys for a marketing firm. You have designed a window to allow employees to add audio and video comments on each survey report. The record buttons should display as red circles rather than displaying as standard buttons.


Which two actions should you take? (Choose two. Each answer is part of the complete solution.)



  1. Add the following markup to the window’s resource section:
    <ControlTemplate x:Key=”RedCircleTemplate” TargetType=”{x:Type Button}”>
     <Grid>
     <Ellipse Width=”{DynamicResource Button.Width}”
     Height=”{DynamicResource Button.Width}”
     Fill=”Red” Stroke=”Black” />
     <Border VerticalAlignment=”Center” HorizontalAlignment=”Center”
     BorderBrush=”White” Background=”White”>
     <TextBlock Margin=”2″>Record</TextBlock>
     </Border>
     </Grid>
    </ControlTemplate>
  2. Add the following markup to the window’s resource section:
    <ControlTemplate x:Key=”RedCircleTemplate” TargetType=”{x:Type Button}”>
     <Grid>
     <Ellipse Width=”{Binding Source=Button, Path=Width}”
     Height=”=”{Binding Source=Button, Path=Width}”
     Fill=”Red” Stroke=”Black” />
     <Border VerticalAlignment=”Center” HorizontalAlignment=”Center”
     BorderBrush=”White” Background=”White”>
     <AdornedElementPlaceholder Margin=”2″ />
     </Border>
     </Grid>
    </ControlTemplate>
  3. Add the following markup to the window’s resource section:
    <ControlTemplate x:Key=”RedCircleTemplate” TargetType=”{x:Type Button}”>
     <Grid>
     <Ellipse Width=”{TemplateBinding Width}”
     Height=”{TemplateBinding Width}”
     Fill=”Red” Stroke=”Black” />
     <Border VerticalAlignment=”Center” HorizontalAlignment=”Center”
     BorderBrush=”White” Background=”White”>
     <ContentPresenter Margin=”2″ />
     </Border>
     </Grid>
    </ControlTemplate>
  4. Add the following markup for the video and audio record buttons:
    <Button Name=”RecordAudio”
     Style=”{StaticResource RedCircleTemplate}” Width=”50″>
     Audio
    </Button>
    <Button Name=”RecordVideo”
     Style=”{StaticResource RedCircleTemplate}” Width=”50″>
     Video
    </Button>
  5. Add the following markup for the video and audio record buttons:
    <Button Name=”RecordAudio”
     Template=”{StaticResource RedCircleTemplate}” Width=”50″>
     Audio
    </Button>
    <Button Name=”RecordVideo”
     Template=”{StaticResource RedCircleTemplate}” Width=”50″>
     Video
    </Button>
  6. Add the following markup for the video and audio record buttons:
    <Button Name=”RecordAudio”
     ContentTemplate=”{StaticResource RedCircleTemplate}”…

cmadmin

ABOUT THE AUTHOR

Posted in Uncategorized|

Comment:

Powered by WebDesk