Telerik Forums
UI for WPF Forum
2 answers
177 views
hi there,

I'm fairly new to Telerik and WPF so I was wondering if someone could help me with a few questions.
My questions are related mainly to RadScheduleView Drag and Drop behavior and also the ability to show a RadContextMenu in a specific area of the radscheduleview control. I have included a sample project and the screenshot below.

1. If I drag a GridViewRow to a schedule view, is it possible to delete that row from my grid after it is dragged to the RadScheduleView ?
2. Is it possible to drag a GridViewRow and drag that row to the GroupHeader and then add a new resource ?
How can I do that?
3. Why does my custom ScheduleViewDragDropBehavior keep calling ConvertDraggedData
even if DragComplete is not actually reached in the OnDragInfo draghandler of my RadGridView ?
4. How can I setup my RadContextMenu to only show up in the GroupHeader to the left (I'm using Timeline View)?
Is it possible to hide ContextMenu when I right click the TimeViewDefinition area ?

SampleProject
AppScreenshot
Elneilo
Top achievements
Rank 1
 answered on 08 Aug 2011
2 answers
143 views
Looking for input on what others do. I've implemented a custom provider. I create a large image in memory and then slice it into tiles. This works until the image is too big and I run out of memory. Surely there is a better way to do this. Ideally I would like something that creates the tiles directly to disk. Another 'problem' is that I'm doing things like 'DrawPolygon' onto my image so I don't have knowledge of exactly which pixels are being colored, otherwise I could easily figure which pixels to write to. Appreciate any help. Thanks.
Jason D
Top achievements
Rank 1
Veteran
 answered on 08 Aug 2011
2 answers
154 views
I want to bind a chart to a table in sql server, is that possible in wpf for windows application?

Thanks in advance
Evgenia
Telerik team
 answered on 08 Aug 2011
1 answer
128 views
When the user adds a new row to the GridView and then cancels the inserting process the event 'RowEditEnded' is called with "e.EditOperationType == Insert" and  "e.EditAction == Cancel".

Is there some way to get the BusinessObject behind the inserted row that was canceled?

e.EditedItem, e.NewData are both null.
Ivan Ivanov
Telerik team
 answered on 08 Aug 2011
7 answers
214 views
Hi,
I am trying to bind a hierachical gridview using entity framework 4.0. (tables: Countries with Districts)
Whenever i try to add a child table definition to the main gridview  the ability to sort the child gridview is lost ( when setting the property relation):
d.Relation = new Telerik.Windows.Data.PropertyRelation("Districts");

If i manually add the datasource then sorting works perfectly. Is this the normal behaviour ? Am i doing something wrong?

GridViewTableDefinition d = new GridViewTableDefinition();
d.DataSource = new SofERPEntities().Districts.Where(z=>z.CountryId==5).ToList();   => sorting in child gridview works
 //d.Relation = new Telerik.Windows.Data.PropertyRelation("Districts");  => sorting in child gridview not working
this.radGridView1.ChildTableDefinitions.Add(d);


Dimitrina
Telerik team
 answered on 08 Aug 2011
1 answer
300 views
I'm trying to write an app where each part of the config is held in a usercontrol.  In moving this to WPF from winforms I thought it would look good to put the config tabbed in a ribbon at the top.

I tried using the ribbonbar but ran into a problem when a tab was selected that contained a usercontrol  I've now got the RibbonView and tried the same thing and run into the same problem.

My code is:

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:WpfApplication1="clr-namespace:WpfApplication1">
    <Grid>
        <telerik:RadRibbonView Name="radRibbonView1" >
            <telerik:RadRibbonTab>
                <WpfApplication1:UserControl1/
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
    </Grid>
</Window>


Where UserControl1 is an empty user control.

When I try to run this, I get the following error:

Specified element is already the logical child of another element. Disconnect it first.

The trace is:

   at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   at System.Windows.FrameworkElement.AddLogicalChild(Object child)
   at System.Windows.Controls.HeaderedContentControl.OnHeaderChanged(Object oldHeader, Object newHeader)
   at System.Windows.Controls.HeaderedContentControl.OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(DependencyObject container, Object currentObject)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(Object createdObject, DependencyObject& rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
   at System.Windows.FrameworkTemplate.<>c__DisplayClass6.<LoadOptimizedTemplateContent>b__3(Object sender, XamlObjectEventArgs args)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(Object value)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
Viktor Tsvetkov
Telerik team
 answered on 08 Aug 2011
2 answers
171 views
The data renders just fine but the Click event does not fire...

XAML below

<telerikChart:RadChart x:Name="radChartCompanyRevenue" Width="500" Height="350" IsEnabled="True">
    <telerikCharting:ChartDefaultView>
        <telerikCharting:ChartDefaultView.ChartLegend>
            <telerikCharting:ChartLegend Visibility="Collapsed" />
        </telerikCharting:ChartDefaultView.ChartLegend>
        <telerikCharting:ChartDefaultView.ChartArea>
            <telerikCharting:ChartArea ItemClick="ChartArea_ItemClick" />
        </telerikCharting:ChartDefaultView.ChartArea>
    </telerikCharting:ChartDefaultView>
    <telerikChart:RadChart.SeriesMappings>
        <telerikCharting:SeriesMapping>
            <telerikCharting:SeriesMapping.SeriesDefinition>
                <telerikCharting:PieSeriesDefinition>
                </telerikCharting:PieSeriesDefinition>
            </telerikCharting:SeriesMapping.SeriesDefinition>
            <telerikCharting:SeriesMapping.ItemMappings>
                <telerikCharting:ItemMapping DataPointMember="XCategory" FieldName="Month"/>
                <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Revenue"></telerikCharting:ItemMapping>
            </telerikCharting:SeriesMapping.ItemMappings>
        </telerikCharting:SeriesMapping>
    </telerikChart:RadChart.SeriesMappings>
</telerikChart:RadChart>

C# code below

// constructor
public DrillDown_Report()
{
    InitializeComponent();           
    BindCompanyRevenue();
}
private void ChartArea_ItemClick(object sender, Telerik.Windows.Controls.Charting.ChartItemClickEventArgs e)
{
    CompanyRevenue_Event cr = e.DataPoint.DataItem as CompanyRevenue_Event;
    MessageBox.Show(cr.Month + " " + cr.Revenue.ToString());
}
#region Company Revenue
private void BindCompanyRevenue()
{
    radChartCompanyRevenue.ItemsSource = this.GetCompanyRevenue();
    radChartCompanyRevenue.DefaultView.ChartTitle.Content = "Company Revenue";
    radChartCompanyRevenue.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;
    radChartCompanyRevenue.DefaultView.ChartArea.ItemClick += new EventHandler<Telerik.Windows.Controls.Charting.ChartItemClickEventArgs>(ChartArea_ItemClick);
}
private List<CompanyRevenue_Event> GetCompanyRevenue()
{
    List<CompanyRevenue_Event> companyRevenue = new List<CompanyRevenue_Event>();
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Jan", 189213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Feb", 179213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Mar", 180213.58));
    companyRevenue.Add(new CompanyRevenue_Event(2011, "Apr", 184213.58));
    return companyRevenue;
}
#endregion

Marcelo
Top achievements
Rank 1
 answered on 08 Aug 2011
2 answers
402 views
Hi,

I using a MVVM environment and try to achieve an auto size of all columns depending on a user preselected mode.
Therefore I've bound the RadGridView.ColumnWidth to a Property in the ViewModel. As I change the value of the property the values of the grid is also changing but the existing Columns are not resized. To force the resize if have iterate to each Column an change the Width.
But is not the best thing to do in an MVVM concept. Is there any better solution for that?

Regards
Thomas
Thomas
Top achievements
Rank 1
 answered on 08 Aug 2011
4 answers
189 views
I used the following in a console app to create and save Chart to png.
It works for LineSeries but the BarSeries is missing.
Please help.



using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Threading;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Charting;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            Processor processor = new Processor();
            processor.Process();
        }
    }

    public class Processor
    {
        private SaveChartProcessor _ruleProcessor = new SaveChartProcessor();
        public void Process()
        {
            var processRuleThread = new Thread(workerThreadProcessRule);
            processRuleThread.Start();
        }

        private void workerThreadProcessRule()
        {
            _ruleProcessor.SaveImage();
        }
    }


    public class SaveChartProcessor
    {
        public void SaveImage()
        {
            var newThread = new Thread(processChartImageWorker);
            newThread.SetApartmentState(ApartmentState.STA);
            newThread.Start();
        }

        public void processChartImageWorker()
        {
            var chart = new RadChart();
            chart.BeginInit();

            chart.Width = 640;
            chart.Height = 480;
            chart.DefaultView.ChartArea.EnableAnimations = false;

            SeriesMapping sm1 = new SeriesMapping();
            //sm1.SeriesDefinition = new LineSeriesDefinition();   //<-LineSeries works
            sm1.SeriesDefinition = new BarSeriesDefinition();      //<-BarSeries doesn't work
            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 BarSeriesDefinition();
            sm2.SeriesDefinition = new LineSeriesDefinition();
            sm2.LegendLabel = "Line Series 2";
            sm2.CollectionIndex = 1;
            ItemMapping im2 = new ItemMapping();
            im2.DataPointMember = DataPointMember.YValue;
            sm2.ItemMappings.Add(im2);

            // Force chart to measure itseft so it provides the actual width and height to export
            chart.Measure(new System.Windows.Size(chart.Width, chart.Height));
            chart.Arrange(new System.Windows.Rect(chart.DesiredSize));

            chart.SeriesMappings.Add(sm1);
            chart.SeriesMappings.Add(sm2);

            chart.EndInit();

            var itemsSource = new List<double>[] { new List<double> { 9, 2, 3, 4 }, new List<double> { 5, 7, 3, 4 } };
            chart.ItemsSource = itemsSource;

            string path = "d:\\newpic.png";

            chart.Dispatcher.Invoke(
                    new Action(() =>
                    {
                        chart.Save(path);
                    }),
                    DispatcherPriority.Normal);
        }
    }
}
Sia
Telerik team
 answered on 08 Aug 2011
1 answer
149 views
Hi Telerik,

we are unable select an item through code. we used the item.IsSelected=true. though it highlited in different color from the one which is shown when we clicked manually. Please could you help us resolving this.
Petar Mladenov
Telerik team
 answered on 08 Aug 2011
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?