JElster
asked on
WPF - How to wire up a Style Button to click Click Event
I have a window's resource Style.. that includes a Button. The style is for a flow document reader.
The style shows find. How do I wire up a button that I've included in the Style to the flow document reader on a page.? Please provide a simple example. Here's the style.. need the Print button wired to the page that uses this control.. thanks
<Style x:Key="documentViewerStyle " TargetType="{x:Type FlowDocumentReader}">
<!--<Setter Property="BorderBrush" Value="{DynamicResource documentViewerStyle}"/>-->
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Margin" Value="5" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="Background" Value="White" />
<Setter Property="ZoomIncrement" Value="5" />
<Setter Property="ViewingMode" Value="Scroll" />
<Setter Property="IsPageViewEnable d" Value="false" />
<Setter Property="IsTwoPageViewEna bled" Value="false" />
<Setter Property="IsScrollViewEnab led" Value="true" />
<Setter Property="Focusable" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type FlowDocumentReader}">
<DockPanel Language="en-us" LastChildFill="True" Uid="DockPanel_3">
<Grid Background="{TemplateBindi ng Background}" DockPanel.Dock="Top" HorizontalAlignment="Cente r" Uid="Grid_31">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Margin="5,2,0,0" Orientation="Horizontal" Uid="StackPanel_5">
<ToggleButton x:Name="FindButton" Command="ApplicationComman ds.Find" Focusable="False" Margin="3,0" ToolTip="Find" Uid="ToggleButton_1" Height="26.4" VerticalAlignment="Bottom" >
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Style.BasedOn>
<Style TargetType="{x:Type ButtonBase}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="3,1"/>
<Setter Property="BorderBrush" Value="{x:Null}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<Border Background="{TemplateBindi ng Background}" Uid="Border_39">
<ContentPresenter x:Name="Content" ContentTemplate="{Template Binding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{Temp lateBindin g ContentStringFormat}" RenderTransformOrigin="0.5 ,0.5" Uid="ContentPresenter_2"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform" TargetName="Content">
<Setter.Value>
<ScaleTransform ScaleY="1.1" ScaleX="1.1"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform" TargetName="Content">
<Setter.Value>
<ScaleTransform ScaleY="0.9" ScaleX="0.9"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers >
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</Style.BasedOn>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
<Path Stroke="{TemplateBinding Foreground}" Uid="Path_23" VerticalAlignment="Center" >
<Path.Data>
<GeometryGroup>
<RectangleGeometry RadiusY="1" RadiusX="1" Rect="0.5,0.5,19,19"/>
<EllipseGeometry Center="12,8" RadiusY="5" RadiusX="5"/>
<EllipseGeometry Center="12,8" RadiusY="4" RadiusX="4"/>
<LineGeometry EndPoint="9,10" StartPoint="2.5,16.5"/>
<LineGeometry EndPoint="9.5,10.5" StartPoint="3,17"/>
<LineGeometry EndPoint="10,11" StartPoint="3.5,17.5"/>
</GeometryGroup>
</Path.Data>
</Path>
</ToggleButton>
<Border x:Name="PART_FindToolBarHo st" HorizontalAlignment="Left" Uid="Border_64" Visibility="Collapsed" VerticalAlignment="Center" />
</StackPanel>
<Grid Grid.Column="0" HorizontalAlignment="Right " Uid="Grid_32" VerticalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" Source="/LandonIP.PWBReade r.BaseType s;componen t/images/Z oomOut.png " />
<Slider Grid.Column="2" TickPlacement="BottomRight " IsSnapToTickEnabled="True" FontSize="{TemplateBinding FontSize}" HorizontalAlignment="Stret ch" LargeChange="{TemplateBind ing ZoomIncrement}" Maximum="{TemplateBinding MaxZoom}" Minimum="{TemplateBinding MinZoom}" SmallChange="{TemplateBind ing ZoomIncrement}" TickFrequency="{TemplateBi nding ZoomIncrement}" Uid="Slider_3" Value="{Binding Zoom, Mode=TwoWay, RelativeSource={RelativeSo urce TemplatedParent}}" VerticalAlignment="Center" Width="100">
<Slider.Style>
<Style TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAn dHoldEnabl ed" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="OverridesDefault Style" Value="True"/>
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSo urce TemplatedParent}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#00000000"/>
<Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSo urce TemplatedParent}}"/>
<Setter Property="IsSnapToTickEnab led" Value="True"/>
<Setter Property="RenderTransformO rigin" Value="0.5,0.5"/>
<Setter Property="MinWidth" Value="50"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Padding" Value="2,0"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Opacity" Value="0.75"/>
<Setter Property="Delay" Value="1000"/>
<Setter Property="Interval" Value="250"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Border Background="Transparent" Padding="{TemplateBinding Padding}" Uid="Border_45">
<Grid ClipToBounds="False" Uid="Grid_22">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBindin g MinHeight}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Uid="TickBar_1" Visibility="Collapsed"/>
<Border Background="{TemplateBindi ng Foreground}" CornerRadius="2" Height="2" Opacity="0.5" Grid.Row="1" Uid="Border_46"/>
<Canvas Height="4" Grid.Row="1" Uid="Canvas_7" VerticalAlignment="Center" >
<Rectangle x:Name="PART_SelectionRang e" Fill="{TemplateBinding Foreground}" Height="2" Canvas.Top="1" Uid="Rectangle_17" Visibility="Hidden"/>
</Canvas>
<Track x:Name="PART_Track" Grid.Row="1" Uid="PART_Track">
<Track.DecreaseRepeatButto n>
<RepeatButton Command="Slider.DecreaseLa rge" Uid="RepeatButton_1">
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefault Style" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Background="Transparent" Uid="Border_43"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.DecreaseRepeatButt on>
<Track.IncreaseRepeatButto n>
<RepeatButton Command="Slider.IncreaseLa rge" Uid="RepeatButton_2">
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefault Style" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Background="Transparent" Uid="Border_43"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.IncreaseRepeatButt on>
<Track.Thumb>
<Thumb Background="{TemplateBindi ng Background}" Uid="Thumb_5">
<Thumb.Style>
<Style TargetType="{x:Type Thumb}">
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSo urce TemplatedParent}}"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="OverridesDefault Style" Value="True"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Padding" Value="6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border Background="Transparent" Margin="-2" Padding="{Binding Padding, RelativeSource={RelativeSo urce TemplatedParent}}" Uid="Border_44">
<Viewbox HorizontalAlignment="Cente r" Uid="Viewbox_4" VerticalAlignment="Center" Width="{Binding FontSize, RelativeSource={RelativeSo urce TemplatedParent}}">
<Viewbox.LayoutTransform>
<ScaleTransform ScaleY="1" ScaleX="1"/>
</Viewbox.LayoutTransform>
<Canvas Height="17" Uid="Canvas_6" Width="13">
<Path Data="F1 M1,0 L10,0 L11,1 L11,13 L6.5,17 L4.5,17 L0,13 L0,1 L1,0 z" Fill="{Binding Foreground, RelativeSource={RelativeSo urce TemplatedParent}}" Uid="Path_13"/>
<Path Data="F1 M1,0 L10,0 L11,1 L11,13 L6.5,17 L4.5,17 L0,13 L0,1 L1,0 z" StrokeEndLineCap="Round" StrokeDashCap="Round" Stroke="{TemplateBinding Background}" StrokeThickness="0.75" StrokeMiterLimit="1" StrokeLineJoin="Round" Uid="Path_14">
<Path.Fill>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<LinearGradientBrush.Relat iveTransfo rm>
<TransformGroup>
<TranslateTransform X="-0.5" Y="-0.5"/>
<ScaleTransform ScaleY="1" ScaleX="1"/>
<SkewTransform AngleY="0" AngleX="0"/>
<RotateTransform Angle="110"/>
<TranslateTransform X="0.5" Y="0.5"/>
</TransformGroup>
</LinearGradientBrush.Rela tiveTransf orm>
<GradientStop Color="#CC999999" Offset="0.5"/>
<GradientStop Color="#CCFFFFFF" Offset="0.8"/>
<GradientStop Color="#CCFFFFFF" Offset="0.2"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
</Canvas>
</Viewbox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
<TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" TickFrequency="75" Height="10" Placement="Bottom" Grid.Row="1" Uid="TickBar_2" Visibility="Collapsed"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelectionRange Enabled" Value="True">
<Setter Property="Visibility" TargetName="PART_Selection Range" Value="Visible"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform" >
<Setter.Value>
<ScaleTransform ScaleY="1.05" ScaleX="1.05"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1"/>
<Setter Property="RenderTransform" >
<Setter.Value>
<ScaleTransform ScaleY="1.05" ScaleX="1.05"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3"/>
</Trigger>
</ControlTemplate.Triggers >
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Slider.Style>
</Slider>
<Image Grid.Column="3" Source="/LandonIP.PWBReade r.BaseType s;componen t/images/Z oomIn.png" />
</Grid>
<Grid Grid.Column="2">
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
<Button x:Name="btnPrint" Command="{x:Static FlowDocumentReader:AppComm ands.Print }"
Height="25" Width="70" ToolTip="Print" Margin="5,0,0,0" >
<StackPanel Orientation="Horizontal" >
<Image Source="/LandonIP.PWBReade r.BaseType s;componen t/images/P rint.png"
Height="24" Width="24"/>
<TextBlock Text="Print" FontSize="12" Margin="2,2,0,0"/>
</StackPanel>
</Button>
<Button x:Name="btnExport" Command="{Binding ElementName=root, Path=Export}" Height="25" Width="70" ToolTip="Export" Margin="8,0,0,0" >
<StackPanel Orientation="Horizontal" >
<Image Source="/LandonIP.PWBReade r.BaseType s;componen t/images/M ove.png" Height="24" Width="24" />
<TextBlock Text="Export" FontSize="12" Margin="2,2,0,0"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
<!-- CONTENT !!!-->
<Grid Uid="Grid_33">
<Border x:Name="PART_ContentHost" BorderBrush="{TemplateBind ing BorderBrush}" BorderThickness="{Template Binding BorderThickness}" KeyboardNavigation.IsTabSt op="False" Margin="{TemplateBinding Padding}" KeyboardNavigation.TabInde x="1" KeyboardNavigation.TabNavi gation="Lo cal" Uid="Border_59"/>
</Grid>
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="ViewingMode" Value="Page"/>
<Trigger Property="ViewingMode" Value="TwoPage"/>
<Trigger Property="ViewingMode" Value="Scroll">
<!--<Setter Property="Visibility" TargetName="PageCountAndBu ttons" Value="Collapsed"/>-->
</Trigger>
<Trigger Property="Document" Value="{x:Null}">
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
</Trigger>
<Trigger Property="IsFindEnabled" Value="False">
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
</Trigger>
</ControlTemplate.Triggers >
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The style shows find. How do I wire up a button that I've included in the Style to the flow document reader on a page.? Please provide a simple example. Here's the style.. need the Print button wired to the page that uses this control.. thanks
<Style x:Key="documentViewerStyle
<!--<Setter Property="BorderBrush" Value="{DynamicResource documentViewerStyle}"/>-->
<Setter Property="BorderThickness"
<Setter Property="Margin" Value="5" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="Background" Value="White" />
<Setter Property="ZoomIncrement" Value="5" />
<Setter Property="ViewingMode" Value="Scroll" />
<Setter Property="IsPageViewEnable
<Setter Property="IsTwoPageViewEna
<Setter Property="IsScrollViewEnab
<Setter Property="Focusable" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type FlowDocumentReader}">
<DockPanel Language="en-us" LastChildFill="True" Uid="DockPanel_3">
<Grid Background="{TemplateBindi
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Margin="5,2,0,0" Orientation="Horizontal" Uid="StackPanel_5">
<ToggleButton x:Name="FindButton" Command="ApplicationComman
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Style.BasedOn>
<Style TargetType="{x:Type ButtonBase}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="3,1"/>
<Setter Property="BorderBrush" Value="{x:Null}"/>
<Setter Property="BorderThickness"
<Setter Property="MinWidth" Value="0"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<Border Background="{TemplateBindi
<ContentPresenter x:Name="Content" ContentTemplate="{Template
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform"
<Setter.Value>
<ScaleTransform ScaleY="1.1" ScaleX="1.1"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform"
<Setter.Value>
<ScaleTransform ScaleY="0.9" ScaleX="0.9"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</Style.BasedOn>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
<Path Stroke="{TemplateBinding Foreground}" Uid="Path_23" VerticalAlignment="Center"
<Path.Data>
<GeometryGroup>
<RectangleGeometry RadiusY="1" RadiusX="1" Rect="0.5,0.5,19,19"/>
<EllipseGeometry Center="12,8" RadiusY="5" RadiusX="5"/>
<EllipseGeometry Center="12,8" RadiusY="4" RadiusX="4"/>
<LineGeometry EndPoint="9,10" StartPoint="2.5,16.5"/>
<LineGeometry EndPoint="9.5,10.5" StartPoint="3,17"/>
<LineGeometry EndPoint="10,11" StartPoint="3.5,17.5"/>
</GeometryGroup>
</Path.Data>
</Path>
</ToggleButton>
<Border x:Name="PART_FindToolBarHo
</StackPanel>
<Grid Grid.Column="0" HorizontalAlignment="Right
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" Source="/LandonIP.PWBReade
<Slider Grid.Column="2" TickPlacement="BottomRight
<Slider.Style>
<Style TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAn
<Setter Property="Focusable" Value="False"/>
<Setter Property="OverridesDefault
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSo
<Setter Property="BorderThickness"
<Setter Property="BorderBrush" Value="#00000000"/>
<Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSo
<Setter Property="IsSnapToTickEnab
<Setter Property="RenderTransformO
<Setter Property="MinWidth" Value="50"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Padding" Value="2,0"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Opacity" Value="0.75"/>
<Setter Property="Delay" Value="1000"/>
<Setter Property="Interval" Value="250"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Border Background="Transparent" Padding="{TemplateBinding Padding}" Uid="Border_45">
<Grid ClipToBounds="False" Uid="Grid_22">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBindin
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Uid="TickBar_1" Visibility="Collapsed"/>
<Border Background="{TemplateBindi
<Canvas Height="4" Grid.Row="1" Uid="Canvas_7" VerticalAlignment="Center"
<Rectangle x:Name="PART_SelectionRang
</Canvas>
<Track x:Name="PART_Track" Grid.Row="1" Uid="PART_Track">
<Track.DecreaseRepeatButto
<RepeatButton Command="Slider.DecreaseLa
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefault
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Background="Transparent" Uid="Border_43"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.DecreaseRepeatButt
<Track.IncreaseRepeatButto
<RepeatButton Command="Slider.IncreaseLa
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefault
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Background="Transparent" Uid="Border_43"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.IncreaseRepeatButt
<Track.Thumb>
<Thumb Background="{TemplateBindi
<Thumb.Style>
<Style TargetType="{x:Type Thumb}">
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSo
<Setter Property="Focusable" Value="False"/>
<Setter Property="OverridesDefault
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Padding" Value="6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border Background="Transparent" Margin="-2" Padding="{Binding Padding, RelativeSource={RelativeSo
<Viewbox HorizontalAlignment="Cente
<Viewbox.LayoutTransform>
<ScaleTransform ScaleY="1" ScaleX="1"/>
</Viewbox.LayoutTransform>
<Canvas Height="17" Uid="Canvas_6" Width="13">
<Path Data="F1 M1,0 L10,0 L11,1 L11,13 L6.5,17 L4.5,17 L0,13 L0,1 L1,0 z" Fill="{Binding Foreground, RelativeSource={RelativeSo
<Path Data="F1 M1,0 L10,0 L11,1 L11,13 L6.5,17 L4.5,17 L0,13 L0,1 L1,0 z" StrokeEndLineCap="Round" StrokeDashCap="Round" Stroke="{TemplateBinding Background}" StrokeThickness="0.75" StrokeMiterLimit="1" StrokeLineJoin="Round" Uid="Path_14">
<Path.Fill>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<LinearGradientBrush.Relat
<TransformGroup>
<TranslateTransform X="-0.5" Y="-0.5"/>
<ScaleTransform ScaleY="1" ScaleX="1"/>
<SkewTransform AngleY="0" AngleX="0"/>
<RotateTransform Angle="110"/>
<TranslateTransform X="0.5" Y="0.5"/>
</TransformGroup>
</LinearGradientBrush.Rela
<GradientStop Color="#CC999999" Offset="0.5"/>
<GradientStop Color="#CCFFFFFF" Offset="0.8"/>
<GradientStop Color="#CCFFFFFF" Offset="0.2"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
</Canvas>
</Viewbox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
<TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" TickFrequency="75" Height="10" Placement="Bottom" Grid.Row="1" Uid="TickBar_2" Visibility="Collapsed"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelectionRange
<Setter Property="Visibility" TargetName="PART_Selection
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform"
<Setter.Value>
<ScaleTransform ScaleY="1.05" ScaleX="1.05"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1"/>
<Setter Property="RenderTransform"
<Setter.Value>
<ScaleTransform ScaleY="1.05" ScaleX="1.05"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3"/>
</Trigger>
</ControlTemplate.Triggers
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Slider.Style>
</Slider>
<Image Grid.Column="3" Source="/LandonIP.PWBReade
</Grid>
<Grid Grid.Column="2">
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
<Button x:Name="btnPrint" Command="{x:Static FlowDocumentReader:AppComm
Height="25" Width="70" ToolTip="Print" Margin="5,0,0,0" >
<StackPanel Orientation="Horizontal" >
<Image Source="/LandonIP.PWBReade
Height="24" Width="24"/>
<TextBlock Text="Print" FontSize="12" Margin="2,2,0,0"/>
</StackPanel>
</Button>
<Button x:Name="btnExport" Command="{Binding ElementName=root, Path=Export}" Height="25" Width="70" ToolTip="Export" Margin="8,0,0,0" >
<StackPanel Orientation="Horizontal" >
<Image Source="/LandonIP.PWBReade
<TextBlock Text="Export" FontSize="12" Margin="2,2,0,0"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
<!-- CONTENT !!!-->
<Grid Uid="Grid_33">
<Border x:Name="PART_ContentHost" BorderBrush="{TemplateBind
</Grid>
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="ViewingMode" Value="Page"/>
<Trigger Property="ViewingMode" Value="TwoPage"/>
<Trigger Property="ViewingMode" Value="Scroll">
<!--<Setter Property="Visibility" TargetName="PageCountAndBu
</Trigger>
<Trigger Property="Document" Value="{x:Null}">
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
</Trigger>
<Trigger Property="IsFindEnabled" Value="False">
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
</Trigger>
</ControlTemplate.Triggers
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I wrote OnClick even, I forgot the t, it should be: OnClick event
ASKER
I need to bind to a custom command.. not the 'built in' print...
I need to bind it to a PrintDoc() which each page will have.
How do I do that?
thanks
I need to bind it to a PrintDoc() which each page will have.
How do I do that?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<Button x:Name="btnPrint" Command="{x:Static FlowDocumentReader:AppComm
Height="25" Width="70" ToolTip="Print" Margin="5,0,0,0" >
It has the Command binded to the AppCommands.Print
That should open the Print dialog.
You can't put any OnClick even on a style or control template since those are defined in a different XAML which can be applied to different FlowDocumentReader's located on different windows or user controls...
There is no guarantee that that code-behind will have the ButtonClick written, so it is not possible to use Events.
You can how ever use Commands, since commands use Binding.
If you like to run commands or some methods when some event happens, you can consider using Blend.
Blend 4.0 (I think that also 3.0) gives you the ability to use some of it's DLLs for "Interaction".
In this way you can use Behaviors like CallMethodAction for running Code in your ViewModel / Data Context.