I have a PDF file that's been imported into a MemoryStream object and now I need to display it using the Telerik UI for WPF pdfViewer control. The existing documentation says that you can create a PdfDocumentSource object and bind the pdfViewer.DocumentSource to that. However, either PdfDocumentSource no longer exists, or I can't figure out what the correct Namespace is.
I'm using TelerikUI for WPF v2024 Q2. However changelogs for 2020 (https://docs.telerik.com/devtools/wpf/controls/radpdfviewer/changes-and-backward-compatibility/backward-compatibility) say that:
Changed
Obsolete constructors of Telerik.Windows.Documents.Fixed.PdfDocumentSource:
PdfDocumentSource(Uri uri, FormatProviderSettings settings)
PdfDocumentSource(Stream stream, FormatProviderSettings settings)
What to do now
Use the overloads that accept Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImportSettings instead.
I've also read that there is some kind of merge going on trying to replace the previous PDF code with Telerik.Windows.Documents.Fixed . In any case, I can't seem to figure out how to go from a MemoryStream to something that the pdfViewer.DocumentSource likes.
Can anyone help with a very basic code sample to take a PDF as a memorystream and create something that pdfView.DocumentSource will accept? Thank you!
Hey guys! We are considering using RadGridView in our apps, but we have figure out next things:
1. Is it possible to always keep a row in Non edit mode? In other words a user should double click on cells every time when he wants to edit a cell despite the selected row.
2. Is it possible to keep RadCheckBoxColumn is the edit mode? In this case a user should check or uncheck a checkbox by single click.
3. Is it possible to go next row by Enter key and if it's the last row a new row should be added?
4. Does RadGridView have a functionality to select a column by clicking on the column header?
RadAutoCompleteBox
control in a WPF application and need assistance with configuring it to search for items based on the Name
property, but display the values from the Key
property.
Hi. Curently I faced with an issue that I cannot correctly hide tab if I have only one RadPane in the window.
What I am trying to to is the following: I wish to have PaneHeader if I have only one RadPane in the group and hide it and show tabs if more thatn one RadPane. Also I want to completely hide everything if this RadPane is inside ToolWindow. (Similar to Bottom template, but with differ that tabs are on top)
What I have currently:
It works when I undock it to ToolWIndow, but fails when I dock it again in the right/left parts of the docking control. Seems binding in the trigger simply does not work.
I am attaching my TopRadPane group Template. Please, point me what I am doing wrong:
<ControlTemplate x:Key="RadPaneGroupTopControlTemplate" TargetType="telerikDocking:RadPaneGroup">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<dock:RadGridResizer x:Name="DockResizer" Placement="Left" ShowsPreview="True" Visibility="Collapsed"/>
<Border
x:Name="HeaderTabs"
Grid.Column="1">
<Grid x:Name="ItemsContainer" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ItemsPresenter x:Name="ItemsPresenterElement" Margin="0"/>
<telerik:RadButton x:Name="CloseButton"
Grid.Column="1"
Command="telerikDocking:RadDockingCommands.Close"
Style="{StaticResource RadButtonDocumentCloseStyle}"
Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
<Border.Style>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=IsInToolWindow}" Value="true" />
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=IsSingleItem}" Value="true" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Collapsed" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<dock:PaneHeader Grid.Column="1"
x:Name="HeaderElement"
SelectedPane="{TemplateBinding SelectedPane}"
Visibility="Collapsed">
<!-- <dock:PaneHeader.Style> -->
<!-- <Style TargetType="dock:PaneHeader" BasedOn="{StaticResource PaneHeaderStyle}"> -->
<!-- <Setter Property="Visibility" Value="Collapsed"/> -->
<!-- <Style.Triggers> -->
<!-- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=., Converter={StaticResource HeaderVisibilityConverter}}" Value="True"> -->
<!-- <Setter Property="Visibility" Value="Visible"/> -->
<!-- </DataTrigger> -->
<!-- </Style.Triggers> -->
<!-- </Style> -->
<!-- </dock:PaneHeader.Style> -->
</dock:PaneHeader>
<Border x:Name="BorderVisual"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="1"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"/>
<Border x:Name="AccentBorderVisual"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="1"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(helpers:ThemeHelper.CheckedBrush)}"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedPane.IsActive, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Grid Grid.Row="1" Grid.Column="1">
<ContentPresenter x:Name="ContentElement"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsContentPreserved, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
ContentTemplate="{TemplateBinding SelectedContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Margin="{TemplateBinding Padding}"/>
<Grid x:Name="ContentElementsPanel" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsContentPreserved, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="SplitterPosition">
<Trigger.Value>
<Dock>Left</Dock>
</Trigger.Value>
<Setter TargetName="DockResizer" Property="Visibility" Value="Visible"/>
<Setter TargetName="DockResizer" Property="Grid.RowSpan" Value="3"/>
<Setter TargetName="DockResizer" Property="Placement" Value="Left"/>
<Setter TargetName="DockResizer" Property="MinWidth" Value="10"/>
</Trigger>
<Trigger Property="SplitterPosition">
<Trigger.Value>
<Dock>Top</Dock>
</Trigger.Value>
<Setter TargetName="DockResizer" Property="Visibility" Value="Visible"/>
<Setter TargetName="DockResizer" Property="Grid.ColumnSpan" Value="2"/>
<Setter TargetName="DockResizer" Property="Placement" Value="Top"/>
<Setter TargetName="DockResizer" Property="MinHeight" Value="10"/>
<Setter TargetName="DockResizer" Property="VerticalAlignment" Value="Top"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="ContentElement" Property="Opacity" Value="{telerik:Office2019Resource ResourceKey=DisabledOpacity}"/>
<Setter Property="Foreground" Value="{telerik1:Office2019Resource ResourceKey=DisabledForegroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
I have a list of <Data>, which I use to bind to a VirtualGrid
Data:
-Value [InnerData]:
-- Name [string]
-- Description [string]
I use CellTemplateNeeded event handler to select a DataTemplate for the columns :
private void RadVirtualGrid_CellTemplateNeeded(object sender, CellTemplateEventArgs e)
{
e.DataTemplate = this.Resources["Template"] as DataTemplate;
}
<DataTemplate x:Key="Template">
<StackPanel>
<Label Content="{Binding Name}" />
<Label Content="{Binding Description}" />
</StackPanel>
</DataTemplate>
And then I use CellValueNeeded to set the Value:
private void RadVirtualGrid_CellValueNeeded(object sender, CellValueEventArgs e)
{
e.Value = viewModel.List[e.RowIndex].Value;
}
So, basically I want to be able to "bind" an object to the Value of the Column.
Then, I want to display multiple properties of the object in the DataTemplate.
It works fine with string data, for e.g.:
e.Value = viewModel.List[e.RowIndex].Value.Name
<Label Content="{Binding }" />
It doesn't work with objects:
e.Value = viewModel.List[e.RowIndex].Value
<Label Content="{Binding Name}" />
A workaround was to "bind" to a string which contains both properties, $"{name}--#--{description}", then use a converter to get the name and description and display it.
But, I want to be able to pass an object, as I might need to display multiple properties.
Is there a limitation here? Can you recommend a better way to do it?
Thanks
In my project, there is radrichtextbox. I am trying to change fontfamily and basealignment of the text present inside the radrichtextbox whenever that radrichtextbox loads using below code.
radRichTextBox.FontFamily = new System.Windows.Media.FontFamily("Symbol");
radRichTextBox.ChangeBaselineAlignment(Telerik.Windows.Documents.Model.BaselineAlignment.Subscript);
But I see no change in the text. Am I missing something?
Hi,
I'm using a RadMultiColumnComboBox and can't seem to be able to set the validation error template to Tooltip using:
telerik:ValidationErrorTemplateHelper.DisplayMode="ToolTip"
It always set the validation message on the right of the control, and in my case it's being clipped by the windows limits.
This usually works great on all other controls.
Thank you for your help
I'm getting a null reference exception when closing one of the pane and could not figure out why it is null in the RemovePane(RadPane pane) method.
We have override to that method,
protected override void RemovePane(RadPane pane)
{
if(pane.Header.ToString().ToLower()=="digital" || pane.Header.ToString().ToLower() == "analog")
SaveDebugPaneLayout(pane);
pane.DataContext = null;
pane.Content = null;
pane.ClearValue(RadDocking.SerializationTagProperty);
pane.RemoveFromParent();
}
And also the CreatePaneForItem method,
protected override RadPane CreatePaneForItem(object item)
{
var viewModel = item as DebugPaneViewModel;
if (viewModel != null)
{
var pane = viewModel.IsDocument ? new RadDocumentPane() : new RadPane();
pane.DataContext = item;
if (viewModel.ContentType != null)
{
if (viewModel.GetType().ToString().EndsWith("EditorViewModel"))
{
if (pane.Content == null)
{
dynamic obj = Activator.CreateInstance(viewModel.ContentType);
pane.Content = obj;
obj.DataContext = viewModel;
}
}
else
{
pane.Content = Activator.CreateInstance(viewModel.ContentType);
}
}
RadDocking.SetSerializationTag(pane, viewModel.ID);
return pane;
}
return base.CreatePaneForItem(item);
}
I am using the RadAutoCompleteBox as follows. I would like to display all Products when pressing the "Keyboard Down Arrow" on the RadAutoCompleteBox. Is this possible?
<telerik:RadAutoCompleteBox Height="23" Width="180" Background="#FFEDF4AB" Margin="3,0,0,0"
ItemsSource="{Binding Products}"
SelectedItem="{Binding SelectedProductItem, Mode=TwoWay}"
SelectionMode="Single"
TextSearchMode="StartsWith"
SearchText="{Binding Name, Mode=TwoWay}"
TextSearchPath="Name"
DisplayMemberPath="Name"
AutoCompleteMode="Suggest" >
<telerik:RadAutoCompleteBox.DropDownItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Black" Width="200" />
</StackPanel>
</DataTemplate>
</telerik:RadAutoCompleteBox.DropDownItemTemplate>
<Behaviors:Interaction.Triggers>
<Behaviors:EventTrigger EventName="SelectionChanged">
<Behaviors:InvokeCommandAction Command="{Binding SelectProductCommand}" />
</Behaviors:EventTrigger>
</Behaviors:Interaction.Triggers>
</telerik:RadAutoCompleteBox>
Hello,
is there a way to style the RadToolBarOverflowPanel? Or add a template for its items?
I would like to display the button on the left side and show the tooltip next to it.
Any help would be appreciated.
Best regards :)