none
Original template for DocumentViewer

    Question

  • Where can I find the original ControlTemplate for DocumentViewer? I need to create a control similar to Search button which is presented in DocumentViewer. If anyone know about this, please share with me.
    Prabu
    Tuesday, December 01, 2009 2:12 PM

All replies

  • Here is the template from Blend 4

    <Style x:Key="DocumentViewerStyleStandard" BasedOn="{x:Null}" TargetType="{x:Type DocumentViewer}">
    	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
    	<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
    	<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    	<Setter Property="ContextMenu" Value="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerContextMenu, TypeInTargetAssembly={x:Type System_Windows_Documents:PresentationUIStyleResources}}}"/>
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type DocumentViewer}">
    				<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Focusable="False">
    					<Grid Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local">
    						<Grid.ColumnDefinitions>
    							<ColumnDefinition Width="*"/>
    						</Grid.ColumnDefinitions>
    						<Grid.RowDefinitions>
    							<RowDefinition Height="Auto"/>
    							<RowDefinition Height="*"/>
    							<RowDefinition Height="Auto"/>
    						</Grid.RowDefinitions>
    						<ContentControl Grid.Column="0" Focusable="{TemplateBinding Focusable}" Grid.Row="0" Style="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerToolBarStyleKey, TypeInTargetAssembly={x:Type System_Windows_Documents:PresentationUIStyleResources}}}" TabIndex="0"/>
    						<ScrollViewer x:Name="PART_ContentHost" CanContentScroll="true" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalScrollBarVisibility="Auto" IsTabStop="true" Grid.Row="1" TabIndex="1"/>
    						<DockPanel Grid.Row="1">
    							<FrameworkElement DockPanel.Dock="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    							<Rectangle Height="10" Visibility="Visible" VerticalAlignment="top">
    								<Rectangle.Fill>
    									<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
    										<LinearGradientBrush.GradientStops>
    											<GradientStopCollection>
    												<GradientStop Color="#66000000" Offset="0"/>
    												<GradientStop Color="Transparent" Offset="1"/>
    											</GradientStopCollection>
    										</LinearGradientBrush.GradientStops>
    									</LinearGradientBrush>
    								</Rectangle.Fill>
    							</Rectangle>
    						</DockPanel>
    						<ContentControl x:Name="PART_FindToolBarHost" Grid.Column="0" Focusable="{TemplateBinding Focusable}" Grid.Row="2" TabIndex="2"/>
    					</Grid>
    				</Border>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>
    Sunday, June 13, 2010 7:40 PM