Telerik Forums
UI for WPF Forum
3 answers
1.5K+ views
What are all the ways to programmatically get cell value? 
Dinko | Tech Support Engineer
Telerik team
 answered on 13 Aug 2019
3 answers
417 views

Hello,

I'm trying to exclude some (but not all) RadGridView columns' information from being persisted using PersistenceManager.

For example, in the below grid, how would I exclude column Info's properties from being persisted based on the column's Header name (assume I've defined CustomPropertyProvider for the grid to persist properties like Width, Header, etc.)?

<telerik:RadGridView x:Name="TestGrid"
                     telerik:PersistenceManager.StorageId="TestGrid"
                     AutoGenerateColumns="False">
   <telerik:RadGridView.Columns>
      <telerik:GridViewDataColumn Header="Info" DataMemberBinding="{Binding Info}"/>
      <telerik:GridViewDataColumn Header="Data" DataMemberBinding="{Binding Data}"/>
   </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

I could use SerializationOptions but I'm not sure what I'd put in the "Expression" field to exclude column "Info" (see below):
<telerik:PersistenceManager.SerializationOptions>
   <telerik:SerializationMetadataCollection>
      <telerik:PropertyNameMetadata Condition="Except" Expression="??" SearchType="PropertyName" />
   </telerik:SerializationMetadataCollection>
</telerik:PersistenceManager.SerializationOptions>

 

Drago
Telerik team
 answered on 13 Aug 2019
1 answer
100 views

When trying to paste a row from an Excel Sheet with 11 columns, the PastingCellClipboardContent event is only launched 10 times.

Is there any way to force the event to be launched as many times as copied range existing columns (11) ?

Regards

   AVG Solutions
Dinko | Tech Support Engineer
Telerik team
 answered on 13 Aug 2019
3 answers
1.6K+ views

I have a radcombobox with AllowMultipleSelection set to true.

When loading a window I want to set the selected items in that combo box from values obtained from a database. But I can't seem to see how the values can be set if I set the ItemsSource to a string[]

 

As an example

      string[] items = new string[] {"1", "2" "3", "4"};
      OptionCombo.ItemsSource = items;

 

Then I want to set "2" and "4" to selected.

 

Thanks

Craig
Top achievements
Rank 1
 answered on 12 Aug 2019
1 answer
164 views

From the picture below you can see that the percent sign is cropped. but it isn't on the rest

ClipToPlotArea="False"

Also how to achieve the chart in the second image. (The age pyramide with the age in the middle)

Thanks

Dinko | Tech Support Engineer
Telerik team
 answered on 12 Aug 2019
2 answers
419 views

Hi,
The rotation property of the page object causes me problems.
I want to rotate a specific page in the RadFixedDocument, so i index the right page and rotate it 90 degree and after that i call OnPropertyChanged to update the PdfDocument property.
But when the page was rotated(in the debug mode the value has been changed) the radpdfviewer doesn't display the rotation.

Where could the error be located?
Many thanks in advance for youre suggestions.

MainWindow.xaml.cs:

01.using System;
02.using System.IO;
03.using System.Linq;
04.using System.Windows;
05.using System.Windows.Input;
06.using Telerik.Windows.Documents.Fixed;
07.using Telerik.Windows.Documents.Fixed.FormatProviders;
08.using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;
09.using Telerik.Windows.Documents.Fixed.Model;
10.using Telerik.Windows.Documents.UI;
11.using Rotation = Telerik.Windows.Documents.Fixed.Model.Data.Rotation;
12. 
13.namespace TelerikWpfApp1
14.{
15.    /// <summary>
16.    /// Interaction logic for MainWindow.xaml
17.    /// </summary>
18.    public partial class MainWindow : Window
19.    {
20.        private PdfViewModel _pdfViewModel;
21.        public MainWindow()
22.        {
23.            InitializeComponent();
24.            _pdfViewModel = new PdfViewModel();
25.            DataContext = _pdfViewModel;
26.        }
27. 
28.        private void RotateSpecificPage(object sender, RoutedEventArgs e)
29.        {
30.            _pdfViewModel.RotateSpecificPage();
31.        }
32. 
33.        private void DeleteSpecificPage(object sender, RoutedEventArgs e)
34.        {
35.            _pdfViewModel.DeleteSpecificPage();
36.        }
37.    }
38.}

MainWindow.xaml:

01.<Window
02.                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
03.                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
04.                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
05.                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
06.                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
07.                xmlns:converters="clr-namespace:Telerik.Windows.Documents.Converters;assembly=Telerik.Windows.Controls.FixedDocumentViewers"
08.                xmlns:telerikWpfApp1="clr-namespace:TelerikWpfApp1"
09.                mc:Ignorable="d"
10.                x:Class="TelerikWpfApp1.MainWindow"
11.                Title="MainWindow" Height="Auto" Width="Auto">
12.    <Grid>
13.        <Grid>
14.            <Grid.RowDefinitions>
15.                <RowDefinition Height="Auto" />
16.                <RowDefinition Height="Auto" />
17.                <RowDefinition Height="*" />
18.            </Grid.RowDefinitions>
19.            <Button Grid.Row="0" Click="RotateSpecificPage">RotatePage</Button>
20.            <Button Grid.Row="1" Click="DeleteSpecificPage">DeletePage</Button>
21.            <telerik:RadPdfViewer Grid.Row="2" x:Name="PdfViewer" Document="{Binding Path=PdfDocument, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"/>
22.        </Grid>
23.    </Grid>
24.</Window>

PdfViewModel.cs:

01.using System;
02.using System.Collections.Generic;
03.using System.ComponentModel;
04.using System.IO;
05.using System.Linq;
06.using System.Runtime.CompilerServices;
07.using System.Text;
08.using System.Threading.Tasks;
09.using System.Windows;
10.using System.Windows.Input;
11.using Telerik.Windows.Documents.Fixed.FormatProviders;
12.using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;
13.using Telerik.Windows.Documents.Fixed.Model;
14.using Telerik.Windows.Documents.Fixed.Model.Data;
15.using TelerikWpfApp1.Annotations;
16. 
17.namespace TelerikWpfApp1
18.{
19.    public class PdfViewModel : INotifyPropertyChanged
20.    {
21.        private string _path = @"test.pdf";
22.        private RadFixedDocument _pdfDocument;
23.        private const int PageNumber = 0;
24. 
25.        public PdfViewModel()
26.        {
27.            PdfDocument = ReadPdf(_pathOne);
28.        }
29.        public RadFixedDocument PdfDocument
30.        {
31.            get => _pdfDocument;
32.            set
33.            {
34.                if (!Equals(value, null))
35.                {
36.                    _pdfDocument = value;
37.                    OnPropertyChanged();
38.                }
39.            }
40.        }
41. 
42.        private RadFixedDocument ReadPdf(string path)
43.        {
44.            using (var stream = File.OpenRead(path))
45.            {
46.                return new PdfFormatProvider(stream, FormatProviderSettings.ReadAllAtOnce).Import();
47.            }
48.        }
49. 
50.        public void RotateSpecificPage()
51.        {
52.            Console.WriteLine(@"Page has been rotated");
53.            if (!Equals(PdfDocument, null))
54.            {
55.                PdfDocument.Pages[PageNumber].Rotation = Rotation.Rotate90;
56.                OnPropertyChanged(nameof(PdfDocument));
57.            }
58.        }
59. 
60.        public void DeleteSpecificPage()
61.        {
62.            Console.WriteLine(@"Page has been deleted");
63.            if (!Equals(PdfDocument, null) && PdfDocument.Pages.Count > 1)
64.            {
65.                PdfDocument.Pages.RemoveAt(PageNumber);
66.                OnPropertyChanged(nameof(PdfDocument));
67.            }
68.        }
69. 
70.        public event PropertyChangedEventHandler PropertyChanged;
71. 
72.        [NotifyPropertyChangedInvocator]
73.        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
74.        {
75.            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
76.        }
77.    }
78.}
Andri
Top achievements
Rank 1
 answered on 09 Aug 2019
3 answers
391 views

I am trying to use the RadSlider to allow the user to choose the number of Millimeters on an interface, I don't need fractions at all, but I can't figure out how to get the RadSlider to snap to whole numbers when they drag the slider.  If anyone has an example of how to do this it would be much appreciated.

thanks!

Joshua
Top achievements
Rank 2
 answered on 08 Aug 2019
2 answers
120 views

Hi

I have a function that changes two properties. Using MVVM.

  1.     FilterDescriptors => that updates the GridView.FilterDescriptors by a DepedencyProperty
  2.     ScrollItem => that uses GridView.ScrollIntoViewAsync by a DepedencyProperty

Both working fine if i set a property one at a time. If i run them in same function the order is still right of calling the DependencyProperties.
Although the ScrollIntoViewAsync gives a ScrollFailedCallback in this scenario and it is not scrolled to the item.

My guess is that the items are still filtered, hence it cannot be scrolled to the desired item.

 

Any ideas to solve this?
Thank you in advance

 

Mats
Top achievements
Rank 1
 answered on 08 Aug 2019
1 answer
125 views

Hi,

I have some dropdown cells in the grid and the filter for those columns is showing the dropdown values, how do I make the editor checkbox labels display the dropdown displaymember instead? Is there a sample project somewhere demonstrating this?

Thanks,
Maurice

Maurice
Top achievements
Rank 1
 answered on 07 Aug 2019
3 answers
593 views

Hi,

I've been reading as much as I can on how to theme controls.

In particular, I wanted to react to this article:
https://www.telerik.com/blogs/xaml-theming-implicit-styles-versus-stylemanager

One of the cons that isn't mentioned for implicit styles, is that when you want to create a new style, you have to use BasedOn, otherwise nothing will be rendered.
That is not what happens for regular WPF controls, because they still have their default (or theme) style applied. A custom style then only extend the default style, and if you want to disregard it altogether, you can set OverridesDefaultStyle to True.

I have 2 questions:

1. "Implicit styles for Telerik controls can’t be used if the application theme is set to other than the default Office_Black theme." => That is not something that I have observed. Using the 2019.2.510 Xaml packages, whichever theme I set is still honored when I create custom implicit styles. For example if I write this:
<Style TargetType="telerik:RadButton">
    <Setter Property="FontWeight" Value="Bold" />
</Style>
Then the buttons will have a Bold text and still apply the rest of my current theme set by StyleManager, whether it's Office_Black, Office2016, Green or anything else.
Could you explain what you meant, or if it is outdated and implicit styles are now supported with StyleManager?

2. Why was support for the built-in WPF mechanism for theming not adopted? If in the AssemblyInfo.cs if your NoXaml assemblies you set ExternalAssembly for the first parameter of ThemeInfo, then it would be possible for your customers to create a Generic assembly (e.g. Telerik.Windows.Controls.Generic) that contains the Themes/Generic.xaml that merges whichever theme they choose, and even further customize the theme. And/or for customers who don't want to customize the themes, you could directly provide those Generic theme assemblies in packages for each theme. Therefore, you'd have the best of both worlds as to apply the theme, customers would only need to reference the appropriate Generic assembly, and they'd have implicit styling support without having to specify BasedOn on all their custom styles.

Thanks in advance for any clarification

Vicky
Telerik team
 answered on 07 Aug 2019
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?