Editing the Wpf ReportViewers ToolBar

4 posts, 1 answers
  1. Boots
    Boots avatar
    81 posts
    Member since:
    Dec 2008

    Posted 29 Aug 2011 Link to this post

    Hello,

    I'm having troubles when i try to edit the ReportViewer's template. Basically when i click on edit template -> edit copy in blend i get the template for the ReportViewer but don't get the template for the ToolBar. I did find this template in the forums but when selecting an export option it's not doing anything. Any ideas what I'm doing wrong?

    <ControlTemplate x:Key="ReportViewerControlTemplate1" TargetType="{x:Type my:ReportViewer}">
               <Grid x:Name="LayoutRoot">
                   <Border BorderBrush="#3FFFFFFF" BorderThickness="1" CornerRadius="6">
                       <Border Margin="0" BorderBrush="Black" BorderThickness="1" CornerRadius="5" Padding="6">
                           <Border.Background>
                               <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                   <GradientStop Color="#FF7E7E7E" Offset="0"/>
                                   <GradientStop Color="#FF484848" Offset="1"/>
                                   <GradientStop Color="#FF303030" Offset="0.1"/>
                               </LinearGradientBrush>
                           </Border.Background>
                           <Grid>
                               <Grid.RowDefinitions>
                                   <RowDefinition Height="Auto"/>
                                   <RowDefinition Height="Auto"/>
                                   <RowDefinition Height="6"/>
                                   <RowDefinition Height="*"/>
                                   <RowDefinition Height="6"/>
                                   <RowDefinition Height="Auto"/>
                               </Grid.RowDefinitions>
                               <telerik:RadToolBar Grid.Row="0">
                                   <telerik:StyleManager.Theme>
                                       <telerik:Office_BlackTheme/>
                                   </telerik:StyleManager.Theme>
                                   <telerik:RadButton Margin="0,2" Padding="2" Command="{Binding RefreshReportCommand}">
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Refresh.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadToolBarSeparator/>
                                   <telerik:RadButton Margin="0,2" Padding="2" Command="{Binding MoveToFirstPageCommand}">
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/FirstPage.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadButton Margin="0,2" Padding="2" Command="{Binding MoveToPreviousPageCommand}">
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/PrevPage.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadToolBarSeparator/>
                                   <TextBox Margin="10,0,0,0" MinWidth="30" VerticalAlignment="Center" IsEnabled="{Binding IsMoveToPageEnabled}" Text="{Binding PageNumber, Mode=TwoWay}" TextAlignment="Center"/>
                                   <TextBlock Margin="2,0,10,0" VerticalAlignment="Center" TextAlignment="Center">
                                       <TextBlock.Text>
                                           <Binding Path="PageCount" ConverterParameter="of {0} pages">
                                               <Binding.Converter>
                                                   <my:FormatedNumberConverter/>
                                               </Binding.Converter>
                                           </Binding>
                                       </TextBlock.Text>
                                   </TextBlock>
                                   <telerik:RadToolBarSeparator/>
                                   <telerik:RadButton Margin="0,2" Padding="2" Command="{Binding MoveToNextPageCommand}">
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/NextPage.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadButton Margin="0,2" Padding="2" Command="{Binding MoveToLastPageCommand}">
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/LastPage.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadToolBarSeparator/>
                                   <telerik:RadButton Margin="0,2" Padding="2" Click="PrintButton_Click" > <!-- Command="{Binding PrintReportCommand}"-->
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Print.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadButton>
                                   <telerik:RadComboBox ItemsSource="{Binding Path=RenderingExtensions}" Margin="1,0" Width="45" Height="24" Padding="2,0" IsEnabled="{Binding IsExportEnabled}">
                                       <telerik:RadComboBox.ItemTemplate>
                                           <DataTemplate>
                                               <TextBlock MinWidth="150" Text="{Binding Description}"/>
                                           </DataTemplate>
                                       </telerik:RadComboBox.ItemTemplate>
                                       <telerik:RadComboBox.EmptySelectionBoxTemplate>
                                           <DataTemplate>
                                               <Image HorizontalAlignment="Left" Width="16" Height="16" Visibility="Visible">
                                                   <Image.Source>
                                                       <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Export.png"/>
                                                   </Image.Source>
                                               </Image>
                                           </DataTemplate>
                                       </telerik:RadComboBox.EmptySelectionBoxTemplate>
                                       <telerik:RadComboBox.SelectionBoxTemplate>
                                           <DataTemplate>
                                               <Image HorizontalAlignment="Left" Width="16" Height="16" Visibility="Visible">
                                                   <Image.Source>
                                                       <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Export.png"/>
                                                   </Image.Source>
                                               </Image>
                                           </DataTemplate>
                                       </telerik:RadComboBox.SelectionBoxTemplate>
                                   </telerik:RadComboBox>
                                   <telerik:RadToolBarSeparator/>
                                   <telerik:RadToggleButton Margin="0,2" Padding="2" IsChecked="{Binding IsDocumentMapVisible, Mode=TwoWay}">
                                       <telerik:RadToggleButton.Visibility>
                                           <Binding Path="HasDocumentMap">
                                               <Binding.Converter>
                                                   <my:VisibilityConverter/>
                                               </Binding.Converter>
                                           </Binding>
                                       </telerik:RadToggleButton.Visibility>
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/DocumentMap.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadToggleButton>
                                   <telerik:RadToggleButton Margin="0,2" Padding="2" IsChecked="{Binding IsParametersAreaVisible, Mode=TwoWay}">
                                       <telerik:RadToggleButton.Visibility>
                                           <Binding Path="HasParameters">
                                               <Binding.Converter>
                                                   <my:VisibilityConverter/>
                                               </Binding.Converter>
                                           </Binding>
                                       </telerik:RadToggleButton.Visibility>
                                       <Image Width="16" Height="16">
                                           <Image.Source>
                                               <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Parameters.png"/>
                                           </Image.Source>
                                       </Image>
                                   </telerik:RadToggleButton>
                               </telerik:RadToolBar>
                               <Border x:Name="ParametersAreaPane" Grid.Row="1">
                                   <Border.Visibility>
                                       <Binding Path="IsParametersAreaVisible">
                                           <Binding.Converter>
                                               <my:VisibilityConverter/>
                                           </Binding.Converter>
                                       </Binding>
                                   </Border.Visibility>
                                   <Grid>
                                       <Grid>
                                           <Grid.ColumnDefinitions>
                                               <ColumnDefinition Width="*"/>
                                               <ColumnDefinition Width="Auto"/>
                                           </Grid.ColumnDefinitions>
                                           <Grid Grid.Column="0">
                                               <my:ReportParametersControl Foreground="White">
                                                   <my:ReportParametersControl.ParameterTemplateSelector>
                                                       <my:ReportParameterEditorTemplateSelector>
                                                           <my:ReportParameterEditorTemplateSelector.Templates>
                                                               <DataTemplate>
                                                                   <my:ParameterContentControl AvailableValues="False" Multivalue="False" Type="System.Boolean">
                                                                       <my:ParameterContentControl.Style>
                                                                           <Style TargetType="{x:Type ContentControl}">
                                                                               <Setter Property="Template">
                                                                                   <Setter.Value>
                                                                                       <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                                           <Grid Margin="5" Height="30">
                                                                                               <Grid.ColumnDefinitions>
                                                                                                   <ColumnDefinition MinWidth="100" Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                               </Grid.ColumnDefinitions>
                                                                                               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Foreground="White" Text="{Binding Text}" TextWrapping="Wrap"/>
                                                                                               <ContentPresenter Margin="5,0" VerticalAlignment="Center" Grid.Column="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                               <CheckBox VerticalAlignment="Center" Content="Null" Foreground="White" Grid.Column="2" IsChecked="{Binding IsNull, Mode=TwoWay}">
                                                                                                   <CheckBox.Visibility>
                                                                                                       <Binding Path="AllowNull">
                                                                                                           <Binding.Converter>
                                                                                                               <my:VisibilityConverter/>
                                                                                                           </Binding.Converter>
                                                                                                       </Binding>
                                                                                                   </CheckBox.Visibility>
                                                                                               </CheckBox>
                                                                                           </Grid>
                                                                                       </ControlTemplate>
                                                                                   </Setter.Value>
                                                                               </Setter>
                                                                           </Style>
                                                                       </my:ParameterContentControl.Style>
                                                                       <CheckBox/>
                                                                   </my:ParameterContentControl>
                                                               </DataTemplate>
                                                               <DataTemplate>
                                                                   <my:ParameterContentControl AvailableValues="True" Multivalue="True" Type="{x:Null}">
                                                                       <my:ParameterContentControl.Style>
                                                                           <Style TargetType="{x:Type ContentControl}">
                                                                               <Setter Property="Template">
                                                                                   <Setter.Value>
                                                                                       <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                                           <Grid Margin="5" Height="30">
                                                                                               <Grid.ColumnDefinitions>
                                                                                                   <ColumnDefinition MinWidth="100" Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                               </Grid.ColumnDefinitions>
                                                                                               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Foreground="White" Text="{Binding Text}" TextWrapping="Wrap"/>
                                                                                               <ContentPresenter Margin="5,0" VerticalAlignment="Center" Grid.Column="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                               <CheckBox VerticalAlignment="Center" Content="Null" Foreground="White" Grid.Column="2" IsChecked="{Binding IsNull, Mode=TwoWay}">
                                                                                                   <CheckBox.Visibility>
                                                                                                       <Binding Path="AllowNull">
                                                                                                           <Binding.Converter>
                                                                                                               <my:VisibilityConverter/>
                                                                                                           </Binding.Converter>
                                                                                                       </Binding>
                                                                                                   </CheckBox.Visibility>
                                                                                               </CheckBox>
                                                                                           </Grid>
                                                                                       </ControlTemplate>
                                                                                   </Setter.Value>
                                                                               </Setter>
                                                                           </Style>
                                                                       </my:ParameterContentControl.Style>
                                                                       <telerik:RadComboBox Width="200" IsDropDownOpen="{Binding IsDropDownOpen, Mode=TwoWay}">
                                                                           <telerik:RadComboBox.SelectionBoxTemplate>
                                                                               <DataTemplate>
                                                                                   <TextBlock HorizontalAlignment="Stretch">
                                                                                       <TextBlock.Text>
                                                                                           <Binding Path="Owner.Value" Mode="OneWay">
                                                                                               <Binding.Converter>
                                                                                                   <my:MultivalueParameterConverter/>
                                                                                               </Binding.Converter>
                                                                                           </Binding>
                                                                                       </TextBlock.Text>
                                                                                   </TextBlock>
                                                                               </DataTemplate>
                                                                           </telerik:RadComboBox.SelectionBoxTemplate>
                                                                           <telerik:RadComboBox.ItemTemplate>
                                                                               <DataTemplate>
                                                                                   <CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected, Mode=TwoWay}"/>
                                                                               </DataTemplate>
                                                                           </telerik:RadComboBox.ItemTemplate>
                                                                           <telerik:StyleManager.Theme>
                                                                               <telerik:Office_BlackTheme/>
                                                                           </telerik:StyleManager.Theme>
                                                                       </telerik:RadComboBox>
                                                                   </my:ParameterContentControl>
                                                               </DataTemplate>
                                                               <DataTemplate>
                                                                   <my:ParameterContentControl AvailableValues="True" Multivalue="False" Type="{x:Null}">
                                                                       <my:ParameterContentControl.Style>
                                                                           <Style TargetType="{x:Type ContentControl}">
                                                                               <Setter Property="Template">
                                                                                   <Setter.Value>
                                                                                       <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                                           <Grid Margin="5" Height="30">
                                                                                               <Grid.ColumnDefinitions>
                                                                                                   <ColumnDefinition MinWidth="100" Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                               </Grid.ColumnDefinitions>
                                                                                               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Foreground="White" Text="{Binding Text}" TextWrapping="Wrap"/>
                                                                                               <ContentPresenter Margin="5,0" VerticalAlignment="Center" Grid.Column="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                               <CheckBox VerticalAlignment="Center" Content="Null" Foreground="White" Grid.Column="2" IsChecked="{Binding IsNull, Mode=TwoWay}">
                                                                                                   <CheckBox.Visibility>
                                                                                                       <Binding Path="AllowNull">
                                                                                                           <Binding.Converter>
                                                                                                               <my:VisibilityConverter/>
                                                                                                           </Binding.Converter>
                                                                                                       </Binding>
                                                                                                   </CheckBox.Visibility>
                                                                                               </CheckBox>
                                                                                           </Grid>
                                                                                       </ControlTemplate>
                                                                                   </Setter.Value>
                                                                               </Setter>
                                                                           </Style>
                                                                       </my:ParameterContentControl.Style>
                                                                       <telerik:RadComboBox Width="200">
                                                                           <telerik:StyleManager.Theme>
                                                                               <telerik:Office_BlackTheme/>
                                                                           </telerik:StyleManager.Theme>
                                                                           <telerik:RadComboBox.ItemTemplate>
                                                                               <DataTemplate>
                                                                                   <TextBlock Text="{Binding Name}"/>
                                                                               </DataTemplate>
                                                                           </telerik:RadComboBox.ItemTemplate>
                                                                       </telerik:RadComboBox>
                                                                   </my:ParameterContentControl>
                                                               </DataTemplate>
                                                               <DataTemplate>
                                                                   <my:ParameterContentControl AvailableValues="False" Multivalue="False" Type="System.DateTime">
                                                                       <my:ParameterContentControl.Style>
                                                                           <Style TargetType="{x:Type ContentControl}">
                                                                               <Setter Property="Template">
                                                                                   <Setter.Value>
                                                                                       <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                                           <Grid Margin="5" Height="30">
                                                                                               <Grid.ColumnDefinitions>
                                                                                                   <ColumnDefinition MinWidth="100" Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                               </Grid.ColumnDefinitions>
                                                                                               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Foreground="White" Text="{Binding Text}" TextWrapping="Wrap"/>
                                                                                               <ContentPresenter Margin="5,0" VerticalAlignment="Center" Grid.Column="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                               <CheckBox VerticalAlignment="Center" Content="Null" Foreground="White" Grid.Column="2" IsChecked="{Binding IsNull, Mode=TwoWay}">
                                                                                                   <CheckBox.Visibility>
                                                                                                       <Binding Path="AllowNull">
                                                                                                           <Binding.Converter>
                                                                                                               <my:VisibilityConverter/>
                                                                                                           </Binding.Converter>
                                                                                                       </Binding>
                                                                                                   </CheckBox.Visibility>
                                                                                               </CheckBox>
                                                                                           </Grid>
                                                                                       </ControlTemplate>
                                                                                   </Setter.Value>
                                                                               </Setter>
                                                                           </Style>
                                                                       </my:ParameterContentControl.Style>
                                                                       <telerik:RadDatePicker Width="200" IsTabStop="False" DisplayDate="2010-05-01" SelectedDate="{Binding Value, Mode=TwoWay}">
                                                                           <telerik:StyleManager.Theme>
                                                                               <telerik:Office_BlackTheme/>
                                                                           </telerik:StyleManager.Theme>
                                                                       </telerik:RadDatePicker>
                                                                   </my:ParameterContentControl>
                                                               </DataTemplate>
                                                               <DataTemplate>
                                                                   <my:ParameterContentControl AvailableValues="False" Multivalue="False" Type="{x:Null}">
                                                                       <my:ParameterContentControl.Style>
                                                                           <Style TargetType="{x:Type ContentControl}">
                                                                               <Setter Property="Template">
                                                                                   <Setter.Value>
                                                                                       <ControlTemplate TargetType="{x:Type ContentControl}">
                                                                                           <Grid Margin="5" Height="30">
                                                                                               <Grid.ColumnDefinitions>
                                                                                                   <ColumnDefinition MinWidth="100" Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                                   <ColumnDefinition Width="Auto"/>
                                                                                               </Grid.ColumnDefinitions>
                                                                                               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Foreground="White" Text="{Binding Text}" TextWrapping="Wrap"/>
                                                                                               <ContentPresenter Margin="5,0" VerticalAlignment="Center" Grid.Column="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                               <CheckBox VerticalAlignment="Center" Content="Null" Foreground="White" Grid.Column="2" IsChecked="{Binding IsNull, Mode=TwoWay}">
                                                                                                   <CheckBox.Visibility>
                                                                                                       <Binding Path="AllowNull">
                                                                                                           <Binding.Converter>
                                                                                                               <my:VisibilityConverter/>
                                                                                                           </Binding.Converter>
                                                                                                       </Binding>
                                                                                                   </CheckBox.Visibility>
                                                                                               </CheckBox>
                                                                                           </Grid>
                                                                                       </ControlTemplate>
                                                                                   </Setter.Value>
                                                                               </Setter>
                                                                           </Style>
                                                                       </my:ParameterContentControl.Style>
                                                                       <TextBox Width="200" Text="{Binding Value, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"/>
                                                                   </my:ParameterContentControl>
                                                               </DataTemplate>
                                                           </my:ReportParameterEditorTemplateSelector.Templates>
                                                       </my:ReportParameterEditorTemplateSelector>
                                                   </my:ReportParametersControl.ParameterTemplateSelector>
                                                   <my:ReportParametersControl.ItemsPanel>
                                                       <ItemsPanelTemplate>
                                                           <Telerik_Windows_Controls_Primitives:RadUniformGrid IsItemsHost="True" Columns="2"/>
                                                       </ItemsPanelTemplate>
                                                   </my:ReportParametersControl.ItemsPanel>
                                               </my:ReportParametersControl>
                                           </Grid>
                                           <Grid HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Column="1">
                                               <telerik:RadButton Margin="3" Content="Preview" Padding="10,3" Command="{Binding PreviewReportCommand}">
                                                   <telerik:StyleManager.Theme>
                                                       <telerik:Office_BlackTheme/>
                                                   </telerik:StyleManager.Theme>
                                               </telerik:RadButton>
                                           </Grid>
                                       </Grid>
                                       <my:DialogBox x:Name="UpdateParametersDialog">
                                           <my:DialogBox.Visibility>
                                               <Binding Path="IsUpdatingParameters">
                                                   <Binding.Converter>
                                                       <my:VisibilityConverter/>
                                                   </Binding.Converter>
                                               </Binding>
                                           </my:DialogBox.Visibility>
                                           <Grid Margin="20">
                                               <Grid.RowDefinitions>
                                                   <RowDefinition/>
                                                   <RowDefinition Height="Auto"/>
                                               </Grid.RowDefinitions>
                                               <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding UpdateParametersProgress}"/>
                                               <telerik:RadProgressBar Grid.Row="1" Maximum="100">
                                                   <telerik:StyleManager.Theme>
                                                       <telerik:Office_BlackTheme/>
                                                   </telerik:StyleManager.Theme>
                                                   <telerik:RadProgressBar.Style>
                                                       <Style TargetType="{x:Type telerik:RadProgressBar}">
                                                           <Setter Property="IsIndeterminate" Value="True"/>
                                                           <Setter Property="Height" Value="10"/>
                                                           <Setter Property="Margin" Value="0,10,0,0"/>
                                                           <Setter Property="IsTabStop" Value="False"/>
                                                       </Style>
                                                   </telerik:RadProgressBar.Style>
                                               </telerik:RadProgressBar>
                                           </Grid>
                                       </my:DialogBox>
                                   </Grid>
                               </Border>
                               <Grid Grid.Row="3">
                                   <Grid.ColumnDefinitions>
                                       <ColumnDefinition Width="Auto"/>
                                       <ColumnDefinition Width="*"/>
                                   </Grid.ColumnDefinitions>
                                   <Border x:Name="DocumentMapPane" Width="200" Grid.Column="0">
                                       <Border.Visibility>
                                           <Binding Path="IsDocumentMapVisible">
                                               <Binding.Converter>
                                                   <my:VisibilityConverter/>
                                               </Binding.Converter>
                                           </Binding>
                                       </Border.Visibility>
                                       <Border Margin="0,0,6,0" Grid.Column="2" BorderBrush="#66FFFFFF" BorderThickness="1" CornerRadius="4">
                                           <Border Margin="0" Background="White" BorderBrush="Black" BorderThickness="1" CornerRadius="3">
                                               <telerik:RadTreeView x:Name="DocumentMapTreeView" Background="White" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" IsVirtualizing="False" TextDropAfter="Drop after " TextDropBefore="Drop before " TextDropIn="Drop in " TextDropRoot="Drop as root">
                                                   <telerik:RadTreeView.ItemTemplate>
                                                       <HierarchicalDataTemplate AlternationCount="0" ItemBindingGroup="{x:Null}" ItemContainerStyle="{x:Null}" ItemContainerStyleSelector="{x:Null}" ItemStringFormat="{x:Null}" ItemTemplate="{x:Null}" ItemTemplateSelector="{x:Null}" ItemsSource="{Binding Children}">
                                                           <TextBlock Text="{Binding Label}"/>
                                                       </HierarchicalDataTemplate>
                                                   </telerik:RadTreeView.ItemTemplate>
                                                   <telerik:RadTreeView.Style>
                                                       <Style TargetType="{x:Type telerik:RadTreeView}">
                                                           <Setter Property="IsEnabled" Value="{Binding IsMoveToPageEnabled}"/>
                                                           <Setter Property="SelectedItem" Value="{Binding SelectedDocumentMapNode, Mode=TwoWay}"/>
                                                           <Setter Property="ItemsSource" Value="{Binding DocumentMapNodes}"/>
                                                       </Style>
                                                   </telerik:RadTreeView.Style>
                                                   <telerik:StyleManager.Theme>
                                                       <telerik:Office_BlackTheme/>
                                                   </telerik:StyleManager.Theme>
                                               </telerik:RadTreeView>
                                           </Border>
                                       </Border>
                                   </Border>
                                   <Border Grid.Column="2" BorderBrush="#66FFFFFF" BorderThickness="1" CornerRadius="4">
                                       <Border Margin="0" Background="White" BorderBrush="Black" BorderThickness="1" CornerRadius="3">
                                           <Grid>
                                               <ScrollViewer x:Name="PageScrollViewer" BorderThickness="0" Visibility="Visible" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible">
                                                   <Border x:Name="PageBorder" Margin="10" Width="{Binding PageWidth}" Height="{Binding PageHeight}" Background="White" BorderBrush="DarkGray" BorderThickness="1">
                                                       <Telerik_Windows_Controls_Primitives:LayoutTransformControl x:Name="PageContainer" Content="{Binding PageRoot}" IsTabStop="False" LayoutTransform="{Binding PageTransform}"/>
                                                   </Border>
                                               </ScrollViewer>
                                               <my:DialogBox x:Name="ViewerProgressMessage">
                                                   <my:DialogBox.Visibility>
                                                       <Binding Path="IsInProgress">
                                                           <Binding.Converter>
                                                               <my:VisibilityConverter/>
                                                           </Binding.Converter>
                                                       </Binding>
                                                   </my:DialogBox.Visibility>
                                                   <Grid Margin="20">
                                                       <Grid.RowDefinitions>
                                                           <RowDefinition/>
                                                           <RowDefinition Height="Auto"/>
                                                       </Grid.RowDefinitions>
                                                       <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding ProgressMessage}"/>
                                                       <telerik:RadProgressBar Grid.Row="1" Maximum="100">
                                                           <telerik:StyleManager.Theme>
                                                               <telerik:Office_BlackTheme/>
                                                           </telerik:StyleManager.Theme>
                                                           <telerik:RadProgressBar.Style>
                                                               <Style TargetType="{x:Type telerik:RadProgressBar}">
                                                                   <Setter Property="IsIndeterminate" Value="True"/>
                                                                   <Setter Property="Height" Value="10"/>
                                                                   <Setter Property="Margin" Value="0,10,0,0"/>
                                                                   <Setter Property="IsTabStop" Value="False"/>
                                                               </Style>
                                                           </telerik:RadProgressBar.Style>
                                                       </telerik:RadProgressBar>
                                                   </Grid>
                                               </my:DialogBox>
                                               <TextBox x:Name="ViewerError" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White" BorderThickness="0" FontFamily="Verdana" Foreground="Gray" Padding="20" Text="{Binding Error}" TextAlignment="Center" TextWrapping="Wrap" IsReadOnly="True">
                                                   <TextBox.Visibility>
                                                       <Binding Path="HasError">
                                                           <Binding.Converter>
                                                               <my:VisibilityConverter/>
                                                           </Binding.Converter>
                                                       </Binding>
                                                   </TextBox.Visibility>
                                               </TextBox>
                                               <my:DialogBox x:Name="ExportDialog">
                                                   <my:DialogBox.Visibility>
                                                       <Binding Path="ShowExportDialog">
                                                           <Binding.Converter>
                                                               <my:VisibilityConverter/>
                                                           </Binding.Converter>
                                                       </Binding>
                                                   </my:DialogBox.Visibility>
                                                   <Grid Width="300" Height="120">
                                                       <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                                           <Grid.RowDefinitions>
                                                               <RowDefinition Height="70"/>
                                                               <RowDefinition Height="50"/>
                                                           </Grid.RowDefinitions>
                                                           <StackPanel VerticalAlignment="Bottom" Grid.Row="0" Orientation="Vertical">
                                                               <TextBlock HorizontalAlignment="Center" FontWeight="Bold" Text="{Binding ExportProgress}"/>
                                                               <telerik:RadProgressBar x:Name="ExportProgressBar" HorizontalAlignment="Center" Width="260" Maximum="100">
                                                                   <telerik:StyleManager.Theme>
                                                                       <telerik:Office_BlackTheme/>
                                                                   </telerik:StyleManager.Theme>
                                                                   <telerik:RadProgressBar.Style>
                                                                       <Style TargetType="{x:Type telerik:RadProgressBar}">
                                                                           <Setter Property="IsIndeterminate" Value="True"/>
                                                                           <Setter Property="Height" Value="10"/>
                                                                           <Setter Property="Margin" Value="0,10,0,0"/>
                                                                           <Setter Property="IsTabStop" Value="False"/>
                                                                       </Style>
                                                                   </telerik:RadProgressBar.Style>
                                                               </telerik:RadProgressBar>
                                                           </StackPanel>
                                                           <telerik:RadButton VerticalAlignment="Center" Width="100" Content="Cancel" Grid.Row="2" Command="{Binding CancelExportCommand}">
                                                               <telerik:StyleManager.Theme>
                                                                   <telerik:Office_BlackTheme/>
                                                               </telerik:StyleManager.Theme>
                                                           </telerik:RadButton>
                                                       </Grid>
                                                   </Grid>
                                               </my:DialogBox>
                                           </Grid>
                                       </Border>
                                   </Border>
                               </Grid>
                               <Grid Grid.Row="5">
                                   <Grid.ColumnDefinitions>
                                       <ColumnDefinition Width="*"/>
                                       <ColumnDefinition Width="Auto"/>
                                   </Grid.ColumnDefinitions>
                                   <StackPanel VerticalAlignment="Center" Grid.Column="1" Orientation="Horizontal">
                                       <telerik:RadSlider VerticalAlignment="Center" Width="200" IsEnabled="True" Maximum="100" Minimum="-100" SmallChange="10" EnableSideTicks="True" HandlesVisibility="Visible">
                                           <telerik:RadSlider.Value>
                                               <Binding Path="Zoom" Mode="TwoWay">
                                                   <Binding.Converter>
                                                       <my:ScaleFactorConverter/>
                                                   </Binding.Converter>
                                               </Binding>
                                           </telerik:RadSlider.Value>
                                           <telerik:StyleManager.Theme>
                                               <telerik:Office_BlackTheme/>
                                           </telerik:StyleManager.Theme>
                                       </telerik:RadSlider>
                                       <telerik:RadComboBox IsTabStop="False">
                                           <telerik:StyleManager.Theme>
                                               <telerik:Office_BlackTheme/>
                                           </telerik:StyleManager.Theme>
                                           <telerik:RadComboBox.Style>
                                               <Style TargetType="{x:Type telerik:RadComboBox}">
                                                   <Setter Property="Margin" Value="10,0,3,0"/>
                                                   <Setter Property="Width" Value="70"/>
                                                   <Setter Property="HorizontalAlignment" Value="Center"/>
                                                   <Setter Property="VerticalAlignment" Value="Center"/>
                                                   <Setter Property="IsEditable" Value="True"/>
                                                   <Setter Property="IsTextSearchEnabled" Value="False"/>
                                                   <Setter Property="MaxDropDownHeight" Value="300"/>
                                                   <Setter Property="ItemsSource">
                                                       <Setter.Value>
                                                           <Binding Path="AvailableZoomValues">
                                                               <Binding.Converter>
                                                                   <my:ZoomConverter/>
                                                               </Binding.Converter>
                                                           </Binding>
                                                       </Setter.Value>
                                                   </Setter>
                                                   <Setter Property="Text">
                                                       <Setter.Value>
                                                           <Binding Path="Zoom" Mode="TwoWay">
                                                               <Binding.Converter>
                                                                   <my:ZoomConverter/>
                                                               </Binding.Converter>
                                                           </Binding>
                                                       </Setter.Value>
                                                   </Setter>
                                               </Style>
                                           </telerik:RadComboBox.Style>
                                       </telerik:RadComboBox>
                                   </StackPanel>
                               </Grid>
                           </Grid>
                       </Border>
                   </Border>
               </Grid>
           </ControlTemplate>

    Thanks much,
    ~Boots
  2. Answer
    Peter
    Admin
    Peter avatar
    1611 posts

    Posted 01 Sep 2011 Link to this post

    Hi Boots,

    Sometimes Blend can't reflect correctly the report viewer and in your case the exporting RadComboBox is missing some settings. Check out the following code snippet that shows the correct XAML for the Export functionality:

    <telerik:RadComboBox Height="24" IsEnabled="{Binding IsExportEnabled}" ItemsSource="{Binding RenderingExtensions}" SelectedItem="{Binding SelectedRenderingExtension, Mode=TwoWay}" Margin="1,0" Padding="2,0" Width="45" MaxDropDownHeight="300">
                                                    <telerik:RadComboBox.EmptySelectionBoxTemplate>
                                                        <DataTemplate>
                                                            <Image HorizontalAlignment="Left" Height="16" Visibility="Visible" Width="16">
                                                                <Image.Source>
                                                                    <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Export.png"/>
                                                                </Image.Source>
                                                            </Image>
                                                        </DataTemplate>
                                                    </telerik:RadComboBox.EmptySelectionBoxTemplate>
                                                    <telerik:RadComboBox.ItemTemplate>
                                                        <DataTemplate>
                                                            <TextBlock MinWidth="150" Text="{Binding Description}"/>
                                                        </DataTemplate>
                                                    </telerik:RadComboBox.ItemTemplate>
                                                    <telerik:RadComboBox.SelectionBoxTemplate>
                                                        <DataTemplate>
                                                            <Image HorizontalAlignment="Left" Height="16" Visibility="Visible" Width="16">
                                                                <Image.Source>
                                                                    <BitmapImage UriSource="pack://application:,,,/Telerik.ReportViewer.Wpf;component/images/Export.png"/>
                                                                </Image.Source>
                                                            </Image>
                                                        </DataTemplate>
                                                    </telerik:RadComboBox.SelectionBoxTemplate>
                                                </telerik:RadComboBox>
    I have attached a sample demo WPF application to demonstrate a modified WPF report viewer template.

    All the best,
    Peter
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Boots
    Boots avatar
    81 posts
    Member since:
    Dec 2008

    Posted 01 Sep 2011 Link to this post

    Hi Peter,

    Thanks for getting back to me. Your solution worked like a charm.

    Thanks Again,
    ~Boots
  5. Ristogod
    Ristogod avatar
    63 posts
    Member since:
    Aug 2008

    Posted 25 Jan 2012 Link to this post

    I've been trying to find the Template for the Wpf viewer's transparent theme now for quite some time. Unfortunately, I can't find anything. Using Blend to extract the template just gives me an empty shell that displays nothing and has no functionality.
Back to Top