Telerik Forums
UI for WPF Forum
2 answers
148 views
Hello,

I am trying to print a screenshot of a WPF window that contains several instances of RadCharts. When we do this, the frames that the charts are in resize, but the charts to not alter the visual to fit the new dimensions. For an example of this, you can see this in the XPS document that I uploaded.

Is there a way to make the RadChart look correct during printing? The container the chart resides in is just a user control with a border and a grid inside of it. The contents of the control always seem to work fine when there are other elements, just every time the RadChart never resizes. Any help with this issue is appreciated.
Scott Brian
Top achievements
Rank 1
 answered on 07 Mar 2012
8 answers
334 views
I am attempting to create a linear gauge that reflects the same properties of an older gauge that I have used in the past.  I have both the new and old gauges displayed in the attached screenshot.  What I need to know is how can I add a "Value Label" to my gauge (WPF) so that it will consistently display above the Marker as the Marker changes in value.  Thanks for any help that can be offered.

I am using version 2011.2.712.35 of the WPF control set.

 James
James
Top achievements
Rank 1
 answered on 07 Mar 2012
31 answers
831 views

                I tried to save chart as image as shown in below code,got error "The parameter value must be greater than zero.Parameter name: pixelWidth". Here my requrement is , Generating chart programatically and saving the same to JPEG in specified folder path. Anyone help me in doing this?

SeriesMapping sm1 = new SeriesMapping();
sm1.SeriesDefinition =
new LineSeriesDefinition();
sm1.LegendLabel =
"Line Series 1";
sm1.CollectionIndex = 0;
ItemMapping im1 = new ItemMapping();
im1.DataPointMember =
DataPointMember.YValue;
sm1.ItemMappings.Add(im1);
SeriesMapping sm2 = new SeriesMapping();
sm2.SeriesDefinition =
new LineSeriesDefinition();
sm2.LegendLabel =
"Line Series 2";
sm2.CollectionIndex = 1;
ItemMapping im2 = new ItemMapping();
im2.DataPointMember =
DataPointMember.YValue;
sm2.ItemMappings.Add(im2);
var itemsSource = new List<double>[] { new List<double> { 22, 12, 66, 76 }, new List<double> { 76, 45, 53, 43 } };
this.RadChart1.SeriesMappings.Add(sm1);
this.RadChart1.SeriesMappings.Add(sm2);
this.RadChart1.ItemsSource = itemsSource;

 

RadChart1.ExportToImage(

 

@"d:\remove\abc.png");

 

grid.Children.Add(RadChart1);


I tried to change ExportToImage method as follows, but there is no class named 'PngBitmapEncoder' under "Telerik.Windows.Media.Imaging" namespace in WPF related DLLs provided by Telerik, but this is working fine in Silverlight related DLLs provided by Telerik. Can anyone help me here to save chat as image in JPEG format.

Stream fileStream = File.Create(@"d:\ss\ss.png") ;

RadChart1.ExportToImage(fileStream, new Telerik.Windows.Media.Imaging.PngBitmapEncoder());

fileStream.Close();

Nicholas
Top achievements
Rank 2
 answered on 07 Mar 2012
9 answers
276 views
Hi,
 I'm using Telerik V2011.3.1220.35 and. I create some aggregate functions dynamically to my grid. The sum/average functions cause my application to crash. To see a concrete situation, just comment or uncomment the indicated lines to see the application working or crashing :)

PS: Also, look at the First/Last aggregate functions UI result !!!


XAML
*******************************************
<Window x:Class="WpfApplication3.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="Window1" Height="300" Width="300" Loaded="Window_Loaded" WindowState="Maximized">
    <Grid>
        <telerik:RadGridView Name="gridViewTest" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" ShowColumnFooters="True"/>
    </Grid>
</Window>
*******************************************
C#
*******************************************


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Telerik.Windows.Controls;
using Telerik.Windows.Data;

namespace WpfApplication3
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            List<Person> allPersons = new List<Person>();

            createGridColumns();

            allPersons.Add(new Person() { LastName = "Doe", FirstName = "John", Number1 = 1, Number2 = 2, Number3 = 3 });
            allPersons.Add(new Person() { LastName = "Fraser", FirstName = "Joe", Number1 = 4, Number2 = 2, Number3 = 6 });
            allPersons.Add(new Person() { LastName = "Alban", FirstName = "Ricardo", Number1 = 7, Number2 = 8, Number3 = 9 });

            gridViewTest.ItemsSource = allPersons;
        }

        private void createGridColumns()
        {
            GridViewDataColumn col1 = new GridViewDataColumn();
            GridViewDataColumn col2 = new GridViewDataColumn();
            GridViewDataColumn col3 = new GridViewDataColumn();
            GridViewDataColumn col4 = new GridViewDataColumn();
            GridViewDataColumn col5 = new GridViewDataColumn();

            col1.Header = "LastName";
            col1.UniqueName = "col1";
            col1.DataMemberBinding = new Binding("LastName");
            col1.AggregateFunctions.Add(new CountFunction() { Caption = "Count: " });

            col2.Header = "FirstName";
            col2.UniqueName = "col2";
            col2.DataMemberBinding = new Binding("FirstName");
            col2.AggregateFunctions.Add(new FirstFunction() { Caption = "First: " });
            col2.AggregateFunctions.Add(new LastFunction() { Caption = "Last: " });
            col2.AggregateFunctions.Add(new MinFunction() { Caption = "Min: " });
            col2.AggregateFunctions.Add(new MaxFunction() { Caption = "Max: " });

            col3.Header = "Number1";
            col3.UniqueName = "col3";
            col3.DataFormatString = "C2";
            col3.DataMemberBinding = new Binding("Number1");
            col3.AggregateFunctions.Add(new MinFunction() { Caption = "Min: " });
            col3.AggregateFunctions.Add(new MaxFunction() { Caption = "Max: " });

            col4.Header = "Number2";
            col4.UniqueName = "col4";
            col4.DataFormatString = "C2";
            col4.DataMemberBinding = new Binding("Number2");
            col4.AggregateFunctions.Add(new AverageFunction() { Caption = "Avg: ", SourceFieldType=typeof(decimal) }); // *** Put this line in comment to have a working app ***

            col5.Header = "Number3";
            col5.UniqueName = "col5";
            col5.DataFormatString = "C2";
            col5.DataMemberBinding = new Binding("Number3");
            col5.AggregateFunctions.Add(new SumFunction() { Caption = "Sum: ", SourceFieldType = typeof(decimal) }); // *** Put this line in comment to have a working app ***

            gridViewTest.Columns.Add(col1);
            gridViewTest.Columns.Add(col2);
            gridViewTest.Columns.Add(col3);
            gridViewTest.Columns.Add(col4);
            gridViewTest.Columns.Add(col5);
        }
    }

    public class Person
    {
        public object LastName { get; set; }
        public object FirstName { get; set; }
        public object Number1 { get; set; }
        public object Number2 { get; set; }
        public object Number3 { get; set; }
    }
}

*******************************************


Thank's
Dimitrina
Telerik team
 answered on 07 Mar 2012
3 answers
231 views
Hello
    I'm using RadRibbonView in Windows XP, when the Application menu's height exceeds the height of the ribbon, and is drawn above another control, it flickers. I've had the same problem with RadWindow and it was solved with the AllowTransparency Property.
Is there a similar property for the ribbon view?
Viktor Tsvetkov
Telerik team
 answered on 07 Mar 2012
2 answers
135 views
Hi all,

I am using a treeview bound to a hierarchy of ObservableCollections, and the bindings appear fine (including to a dependency property IsExpanded on the objects, and a pdependency property SelectedNode on the hierarchy as a whole) apart from one issue. My user can select a node and a control that fires this method:

public void NewConsolidation(object args)
        {
            SelectedNode.IsExpanded = true;
            var newNode = _hierarchy.AddNode(SelectedNode, "Another Child"); <-- inserts a node
            SelectedNode = newNode;
            SelectedNode.ParentNode.IsExpanded = true;
            SelectedNode.ParentNode.NodeName += "(has children)";
        }

With more than one node, collapsed, I see

+   Root Node <-- selected
 
go to

-  Root Node (has children)
     First Child
     Another Child <-- selected

but with only the root:

Root Node <-- selected 

goes to

+ Root Node (has children)

- that is, setting IsExpanded makes no difference if the node in question has never had children and been opened. I can see the binding is working, though, because the name change takes effect. I understand this is related to the treeview items not yet being generated - so how can I force them to be generated for this parent?
Julia
Top achievements
Rank 1
 answered on 07 Mar 2012
1 answer
162 views
application crashes on pressing the access key for ribbontab with following error.
System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.RibbonView
  StackTrace:
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.<>c__DisplayClass16.<ShowTips>b__8()
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
     
Miro Miroslavov
Telerik team
 answered on 07 Mar 2012
2 answers
182 views
Hi

I am using a Telerik radcombobox in a ItemsControl like below. The itemscontrol is populated with some data, and I want the combobox to be default selected to one of the fields in the data. Why doesn't this work?


<Window.Resources>
   <CollectionViewSource x:Key="orderViewSource" />
</Window.Resources>
 
<Grid>
   <ItemsControl x:Name="rptOrders" ItemsSource="{Binding Source={StaticResource orderViewSource}}">
      <ItemsControl.ItemTemplate>
         <DataTemplate>
            <Grid>
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="160px" />
                  <ColumnDefinition Width="Auto" />
               </Grid.ColumnDefinitions>
               <Label Content="{Binding Path=Name}" Grid.Column="0" VerticalAlignment="Center"></Label>
               <telerik:RadComboBox x:Name="rcbOrder" Grid.Column="1" SelectedItem="{Binding Path=Order}">
                  <telerik:RadComboBoxItem Content="Extra Hot" />
                  <telerik:RadComboBoxItem Content="Hot" />
                  <telerik:RadComboBoxItem Content="Mild" />
               </telerik:RadComboBox>
            </Grid>
         </DataTemplate>
      </ItemsControl.ItemTemplate>
   </ItemsControl>
</Grid>


Data:
((CollectionViewSource)(FindResource("orderViewSource"))).Source = Data.StaffOrders;
 
public class Data
{
   public static ObservableCollection<StaffMember> StaffOrders { get { return //loaddata; } }
   public class StaffMember
   {
      public Int32 StaffID { get; set; }
      public String Name { get; set; }
      public String Email { get; set; }
      public String Order { get; set; }
   }
}


Jeremy
Top achievements
Rank 1
 answered on 07 Mar 2012
2 answers
215 views
Hello,

I think I've found a bug with applying a Telerik style to a ListBox - with the style applied, ListBox items appear as though the ListBox had HorizontalContentAlignment="Left", even when I specify HorizontalContentAlignment="Stretch" .

I've made a little test project to demonstrate, and attached a screen shot of what the app looks like. The only bit omitted is the code-behind - in the window's constructor I add a single empty string to each listbox's items.

You can see that the border on the un-styled listbox extends all the way across the list box, but the border for the telerik styled version is left aligned. Does anyone know why this might be occuring/if there is a workaround I could use?

<Window x:Class="RadControlsWpfApp1.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style TargetType="ListBox" x:Key="TelerikListBoxStyle" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_BlueTheme, ElementType=ListBox}}"/>
    </Window.Resources>
 
    <StackPanel Orientation="Vertical">
        <ListBox Style="{StaticResource TelerikListBoxStyle}" x:Name="telerikStyledListBox" HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Label Content="telerik style" BorderThickness="1" BorderBrush="Black"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
 
        <ListBox x:Name="listBox" HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Label Content="standard style" BorderThickness="1" BorderBrush="Black"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </StackPanel>
</Window>


Regards,
James.
James
Top achievements
Rank 1
 answered on 06 Mar 2012
4 answers
127 views
If you zoom in to a tiny scale using the pan & zoom behaviour, the control will throw an exception and crash completely.  This is clearly not desired.

Will this be fixed shortly?
Gareth McNicol
Top achievements
Rank 1
 answered on 06 Mar 2012
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
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?