The following style uses the ‘BasedOn’ attribute to extend the default DocumentViewer style.
[XAML]
<Window x:Class='SDKSample.Window1'
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<Window.Resources>
<Style
x:Key='MyDVStyleExtend'
BasedOn='{StaticResource {x:Type DocumentViewer}}'
TargetType='{x:Type DocumentViewer}'>
<Setter Property='Background'>
<Setter.Value>
<LinearGradientBrush StartPoint='0.5,0' EndPoint='0.5,1'>
<GradientStop Offset='0.0' Color='#CC99CCFF' />
<GradientStop Offset='1.0' Color='White' />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<DocumentViewer Style='{StaticResource MyDVStyleExtend}' Name='MyDocumentViewer'/>
</Grid>
</Window>
Share with