Telerik Forums
UI for WPF Forum
1 answer
111 views
Is it possible to have a custom item inside a linear scale span a certain range of values?

When you use the attached property ScaleObject.Value, it centers the item at the specified value. However, I would like to have the left end of the item (e.g. an rectangle or border) at one value and the right end at another.

Thank you.
Andrey
Telerik team
 answered on 10 Oct 2013
0 answers
168 views
Hi I'm using 2013.2.

Currently I'm using 2 RadGridView:
1st MainGridView and 2nd SelectedGridView.

The 1st is the main UI control, and 2nd is just for getting the AggregationResults of the selected rows in the 1st RadGridView.
So basically the 2nd is not on the UI.

I am trying to make the 2nd grid has the same columns with AggregationFunctions as the 1st grid has.
So I hope to have an easy way of Cloning the column dependency object instance from the 1st grid and add them into the 2nd grid, hence, I could easily get the AggregationResults of the selected rows of the 1st grid.

Thanks
ttest
Top achievements
Rank 1
 asked on 10 Oct 2013
2 answers
561 views
Hi, 

I am trying to configure the legend items shown in a RadLegend control associated to a RadPieChart.

This is how I load the data:

<Window
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="594.024" Width="902.888">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
         
        <telerik:RadPieChart Name="PieChartDemo" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="543" Width="428"/>
 
        <telerik:RadLegend x:Name="PieLegend"
                                   Grid.Column="1" Items="{Binding LegendItems, ElementName=PieChartDemo}"/>
         
    </Grid>
</Window>

public MainWindow()
        {
            InitializeComponent();
            FillPieChart();
        }
 
        void FillPieChart()
        {
            DataTable dtData = new DataTable("DATA");
 
            dtData.Columns.Add(new DataColumn("Name", typeof(string)));
            dtData.Columns.Add(new DataColumn("Value", typeof(double)));
 
            dtData.Rows.Add(new object[] { "Scrap", 5429287.5 });
            dtData.Rows.Add(new object[] { "KWH", 713631 });
            dtData.Rows.Add(new object[] { "Electrode", 327349 });
            dtData.Rows.Add(new object[] { "Alloys", 2372722.3 });
            dtData.Rows.Add(new object[] { "Fluxes", 317157.65 });
            dtData.Rows.Add(new object[] { "Labor", 300084.1 });
 
            PieChartDemo.Palette = ChartPalettes.Arctic;
 
            PieSeries pieSer = new PieSeries();
            pieSer.ShowLabels = true;
 
            foreach (DataRow drCost in dtData.Rows)
            {
                pieSer.DataPoints.Add(new PieDataPoint()
                {
                    Value = double.Parse(drCost["Value"].ToString()),
                    Label = string.Format("{0}\n{1:N} K", drCost["Name"].ToString(), double.Parse(drCost["Value"].ToString()) / 1000.00)
                }
                                    );
            }
 
            pieSer.LabelDefinitions.Add(new ChartSeriesLabelDefinition() { Margin = new Thickness(-5, 0, 0, 0) });
            pieSer.AngleRange = new AngleRange(270, 360);
 
            pieSer.LegendSettings = new DataPointLegendSettings();
 
            PieChartDemo.Series.Clear();
            PieChartDemo.Series.Add(pieSer);
        }


I am creating a PieSeries and adding some PieDataPoint. For each data point I add the value and the label, and I think the RadLegend takes this label to show its items. Am I correct?

In the beginning I wasn't using the RadLegend so I was showing the name and the value in the chart, assigning both values to Label:

pieSer.DataPoints.Add(new PieDataPoint()
               {
                   Value = double.Parse(drCost["Value"].ToString()),
                   Label = string.Format("{0}\n{1:N} K", drCost["Name"].ToString(), double.Parse(drCost["Value"].ToString()) / 1000.00)
               }

And then I added the RadLegend Control and it shows the same values.

How can I configure the RadLegend control to show only the names if I change the Label shown in the RadPieChart to show only the values?




Alberto
Top achievements
Rank 1
 answered on 09 Oct 2013
1 answer
354 views
I have followed the example below and scoured the internet for 2 days trying to get my combobox to work correctly, and I still cannot get it to select the correct item when the form opens. http://www.telerik.com/help/silverlight/raddatafor-edit-lookup-values-with-radcombobox.html

I have two classes (generated by the Openaccess ORM), one of which contains information about musicians (name, id, genre etc) and a second class that contains information about the type of musician (band, festival, performing arts etc). I have successfully added a couple of simple textbox controls to the form that display the artist name and some other basic information, and now I am trying to pick the artist type from a combo box.

I can successfully populate the combobox from the ORM model "ArtistType" class,  but no matter what I do it always opens either with the first item selected (regardless of the actual underlying value) or nothing selected at all. If I break the code in the combobox_Loaded event, I can see the values, but they are never reflected in the combobox.

How can I databind a simple numeric value in a primary table to a list of items in a second table to be displayed as a picklist in a combox?
Dan
Top achievements
Rank 1
 answered on 09 Oct 2013
2 answers
228 views
Some people on here are probably familiar with this blog entry about Merging Telerik's Assemblies into an WPF executable. We actually decided to take a completely different spin and wanted to just merge the Telerik assemblies only leaving all our others untouched (our program as a plug-gable module architecture so we can't merge ALL assemblies). I'm not sure if any one else would be interested in this but I wanted to post it anyway just to get it out there that it is possible. 

MSBuild AfterResolveReferences:
<Target Name="AfterResolveReferences">
  <ItemGroup>
    <EmbeddedResource Include="@(ReferenceCopyLocalPaths)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(ReferenceCopyLocalPaths.Filename), 'Telerik')) And '%(ReferenceCopyLocalPaths.Extension)' == '.dll'">
      <LogicalName>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
</Target>

Program.cs:
namespace WpfApplication1
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
 
    public class Program
    {
        [STAThreadAttribute]
        public static void Main()
        {
            var assemblies = new Dictionary<string, Assembly>();
            var executingAssembly = Assembly.GetExecutingAssembly();
            var resources = executingAssembly.GetManifestResourceNames().Where(n => n.StartsWith("Telerik")).Where(n => n.EndsWith(".dll"));
 
            foreach (string resource in resources)
            {
                using (var stream = executingAssembly.GetManifestResourceStream(resource))
                {
                    if (stream == null)
                        continue;
 
                    var bytes = new byte[stream.Length];
                    stream.Read(bytes, 0, bytes.Length);
                    try
                    {
                        assemblies.Add(resource, Assembly.Load(bytes));
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.Print(string.Format("Failed to load: {0}, Exception: {1}", resource, ex.Message));
                    }
                }
            }
 
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
            {
                var assemblyName = new AssemblyName(e.Name);
 
                var path = string.Format("{0}.dll", assemblyName.Name);
 
                if (assemblies.ContainsKey(path))
                {
                    return assemblies[path];
                }
 
                return null;
            };
 
            App.Main();
        }
    }
}

We also did an additional spin with a PostBuildEvent of deleting the Telerik files after the build.

PostBuildEvent:
  <PropertyGroup>
    <PostBuildEvent>del /F /Q "$(TargetDir)Telerik*"
rmdir /S /Q "$(TargetDir)de"
rmdir /S /Q "$(TargetDir)es"
rmdir /S /Q "$(TargetDir)fr"
rmdir /S /Q "$(TargetDir)it"
rmdir /S /Q "$(TargetDir)nl"
rmdir /S /Q "$(TargetDir)tr"</PostBuildEvent>
  </PropertyGroup>

I hope someone else finds this useful as we did.
Alan
Top achievements
Rank 1
 answered on 09 Oct 2013
0 answers
124 views

I want a hex column both in display and edit mode, i.e. WYSIWYG.

Such as:  010, ABC, FE0, b
ut failure in edit mode.



<telerik:GridViewMaskedInputColumn
          DataMemberBinding="{Binding Address}"
          Header="Hardware Address"
          DataFormatString="{}{0:X3}"
          MaskType="Numeric"
          Mask="d3">                   
</telerik:GridViewMaskedInputColumn>
 
private ushort _address;
public ushort Address
{
    get { return _address; }
    set
    {
        if (value != _address)
        {
            _address = value;
            OnPropertyChanged("Address");
        }
     }
}




Yu
Top achievements
Rank 1
 asked on 09 Oct 2013
3 answers
351 views

In WPF Help System(2013 Q2)



Controls-->RadTreeView-->How To-->Get Previous, Next, Parent and Sibling Node of a Specific TreeView Item-->Accessing the ParentItem and RootItem



ObservableCollection<Object> selectedItems = treeView.SelectedItems;

RadTreeViewItem item = selectedItems[ 0 ] as RadTreeViewItem;



Maybe not cast successfully. Should be?



RadTreeViewItem item = treeView.SelectedContainer ;



In RadTreeView class(Pay a attention to both *item and *contrainer type):

public RadTreeViewItem SelectedContainer { get; private set; }

public Object SelectedItem { get; set; }



But in RadTreeView class:

public Object Item { get; internal set; }

public RadTreeViewItem NextItem { get; }

public RadTreeViewItem ParentItem { get; internal set; }

public RadTreeViewItem PreviousItem { get; }



I think it should be:

public Object Item { get; internal set; }

public Object NextItem { get; }

public Object ParentItem { get; internal set; }

public Object PreviousItem { get; }



public RadTreeViewItem NextContainer { get; }

public RadTreeViewItem ParentContainer { get; internal set; }

public RadTreeViewItem PreviousContainer { get; }



In both RadTreeView and RadTreeViewItem, Item and its Container should be clearly different.

Thanks!


Hristo
Telerik team
 answered on 09 Oct 2013
1 answer
112 views
HI All,

        I need an idea how to implement the below one.
        
            I have two RadDockPanels in a usercontrol,where one dock panel has another usercontrol which consists of telerik rad gridview as a child element and another as the graph related to the data in the grid view.

The requirement is there is one control whether a button or toggle when we click on it only dock panel 1 with grid view expanded should be appeared in the screen and the other dock panel should get collapsed and a button to reset it else if it is a toggle when we again click on it,it should get reset.

I am short of ideas,could any one help me out in this soon,

Thanks,
Ramya
Kalin
Telerik team
 answered on 09 Oct 2013
1 answer
179 views
A little while ago, we changed the rtf editor used in our application from another third party editor to the telerik RichTextBox editor.  However, I have recently found that Rtf docs created in the previous editor contain list styles that Telerik is unable to handle correctly.  In some cases it just won't display them properly, and in worse case it will crash my application.

The following document causes the editor to crash my application:

{\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Times New Roman;}{\f1\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\headery254\footery254\endnhere\sectdefaultcl{\*\generator WPTools_5.18;}{\*\listtable{\list\listtemplateid1
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc1{\leveltext\'02\'00.;}{\levelnumbers\'01;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc3{\leveltext\'02\'01.;}{\levelnumbers\'01;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc0{\leveltext\'02\'02.;}{\levelnumbers\'01;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc4{\leveltext\'02\'03);}{\levelnumbers\'01;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc2{\leveltext\'03(\'04);}{\levelnumbers\'02;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc4{\leveltext\'03(\'05);}{\levelnumbers\'02;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc0{\leveltext\'03(\'06);}{\levelnumbers\'02;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc0{\leveltext\'03(\'07);}{\levelnumbers\'02;}}
{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent360\levelnfc0{\leveltext\'03(\'08);}{\levelnumbers\'02;}}
\listid1}}{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}{\plain\fs24 test @ test 123 /\par
\pard\plain\plain\fs24\par
\plain\fs24 test \'E0 test \par
\pard\plain\plain\fs24\par
\pard\plain\plain\fs24\par
\ls1\ilvl-1{\listtext\fs24 (1)\tab}\plain\fs24\line test   Resume\par
}}


When this document is loaded, using version 2012.3.1129.40 of the telerik wpf components, I initially get the following exception:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Telerik.Windows.Documents.Model.Paragraph.get_LeftIndent()
   at Telerik.Windows.Documents.Model.Paragraph.get_LeftMargin()
   at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverrideInternal(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverride(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverrideInternal(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize)
   at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize)
   at Telerik.Windows.Documents.Model.RadDocument.Measure(SizeF measureSize)
   at Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   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)

The application will continue throwing exceptions until either it crashes or I have to kill it.  I've tried loading this document using the Demo control included in the Q2 2013 SP1 demos, and while it doesn't crash it won't load the document giving a modal dialog saying "The file cannot be opened".  If I manually strip out the \*\listtable section, the telerik editor will be able to load the document without problem, but the list will no longer be numbered as expected. MS Word & WordPad will display this document without any issue.

I have an immediate solution to this problem, using another rtf library to resave without list styling, but it would be ideal if I didn't have to do that, as it changes the styles of the lists in any of these documents.
Alex
Telerik team
 answered on 09 Oct 2013
7 answers
558 views
Hi,
i have multiple y-axis in my graph which is being plotted dynamically and name associated with it comes on the basis of selection done in dropdown list.my project follows MVVM architecture. x-axis represents time.so i need to generate all y values for particular time and then add the lineseries to the Series dynamically. problem is that graph is being plotted but could not be seen.
       
private void LoadData()
        {
            rnd = new Random();
            GraphDatas = new ObservableCollection<GraphData>();
            GraphData gd = null;
            Linearaxis = new List<LinearAxis>();
            for (int x = 0; x < 35; x++)
            {
                foreach (WeldDataMapping _weldDataMapping in _arrayOfWeldDataMapping.Where(ab => ab.IsSelected))
                {
                    GraphDatas = new ObservableCollection<GraphData>();
                    gd = new GraphData();
                    gd.XValue = x;

                    gd.YValue = rnd.NextDouble() * 100 ;
                    GraphDatas.Add(gd);


                    LineSeries line = new LineSeries();
                    Brush objBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(_weldDataMapping.WeldDataColor));
                    if (!Linearaxis.Any(ab => ab.Title.ToString() == _weldDataMapping.WeldDataName))
                    {

                        LinearAxis yaxis = new LinearAxis { Title = _weldDataMapping.WeldDataName, Foreground = objBrush, LineStroke = objBrush, FontSize = 15 };
                        line.VerticalAxis = yaxis;
                        Linearaxis.Add(yaxis);
                        line.Name = _weldDataMapping.WeldDataName;
                        line.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(_weldDataMapping.WeldDataColor));
                        line.DisplayName = _weldDataMapping.WeldDataName;
                        line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "XValue" };
                        line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "YValue" };
                        line.ItemsSource = GraphDatas;
                        //adds the lineseries to the graph.
                        _graphView.xCartesianGraph.Series.Add(line);
                    }

                    else
                    {

                        line.VerticalAxis = Linearaxis.FirstOrDefault(ab => ab.Title.ToString() == _weldDataMapping.WeldDataName);
                        line.Name = _weldDataMapping.WeldDataName;
                        line.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(_weldDataMapping.WeldDataColor));
                        line.DisplayName = _weldDataMapping.WeldDataName;
                        line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "XValue" };
                        line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "YValue" };
                        line.ItemsSource = GraphDatas;
                        //adds the lineseries to the graph.
                        _graphView.xCartesianGraph.Series.Add(line);
                    }
                    

                }
            }
        }

please provide me the solution asap.
Senthil kumar
Top achievements
Rank 1
 answered on 09 Oct 2013
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?