Telerik Forums
UI for WPF Forum
1 answer
122 views
Hi

I would like to drag-and-drop an Appointment from ScheduleView to a ListView. The (visual) effect should be that it drags a copy of it, leaving the item in ScheduleView intact. I've followed the example for ScheduleView Drag-and-Drop, and everything works except the item being removed from ScheduleView. How do you recommend I go about this?
-- 
Sincerely, 
Christian
Konstantina
Telerik team
 answered on 03 Jul 2012
2 answers
686 views
I am using Radgridview which has AutoGenerateColumns= "true" and binding it to a Datatable. Now based on conditions I have to add a border around the entire column red/green/blue. Different columns can have different colored border. Can you please suggest an approach to it.
Minal
Top achievements
Rank 1
 answered on 03 Jul 2012
1 answer
154 views
I am using RadDateTimePicker controls for Start/End columns in the RadGanttView:

            <telerik:RadGanttView.Columns>
                <telerik:TreeColumnDefinition Header="Title" />
                <telerik:ColumnDefinition MemberBinding="{Binding MyFormattedStart}" Header="Start" ColumnWidth="100" >
                    <telerik:ColumnDefinition.CellEditTemplate>
                        <DataTemplate>
                            <telerik:RadDateTimePicker SelectedValue="{Binding Start, Mode=TwoWay}" 
                                                       InputMode="DatePicker" />
                        </DataTemplate>
                    </telerik:ColumnDefinition.CellEditTemplate>

and the same for End...I have to click two times in the cell before the DropDown control displays so that I may use the control to change the value. 

I would like to click only once.  It is not intuitive to have to click again.

I did notice if I do this on the same row, e.g., changed the Start date with the DropDown, I can then go to the End column and just click one time to use the DropDown for that cell.

So, I guess the first click is required to select the row, and then once the row is selected, another click to display the DropDown.

Is there any way to configure the control/cell such that a single click in a Start or End cell selects the row *and* displays the DropDown?

Thanks, nelson
Miroslav Nedyalkov
Telerik team
 answered on 03 Jul 2012
4 answers
95 views
I have the following issue:

I am binding a radgridview to a viewmodel and am currently not using the code behind and taking care of all the logic in the VM.

There is an "Apply" button bound to an IsDirty property being set once data changes in any of the bound items in the radgridview - this
is done via propertychanged events etc.

If I edit a value and click "apply" without clicking anywhere else, the edited value isn't commited to the bound model and apply doesn't
take the latest/most up to date value.

The closest thing I could find in forums is: http://www.telerik.com/community/forums/winforms/gridview/rowstate-question.aspx
but that didn't really help me.

Do you have any suggestions how I can get this to work, without breaking my design pattern.
Dimitrina
Telerik team
 answered on 03 Jul 2012
4 answers
130 views
Hello,
I am trying to setup a data drill down simiar to the provided example. But I am facing the problem that the ItemToolTipOpening event is not fired when I place the mouse on a chart point.
Here is the code that I am using:
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.Shapes; 
using Telerik.Windows.Controls.Charting; 
using AppointmentScheduler; 
using Telerik.Windows.Data; 
using System.Globalization; 
using Telerik.Windows.Controls; 
 
namespace AppointmentSchedulerUI 
    /// <summary> 
    /// Interaction logic for ChartWorkingHours.xaml 
    /// </summary> 
    public partial class ChartWorkingHours : Window 
    { 
        private AppointmentScheduler.AppointmentScheduler m_AppointmentScheduler; 
        private Dictionary<string, Employee> m_Employees; 
 
 
        public ChartWorkingHours(Dictionary<string, Employee> employees, AppointmentScheduler.AppointmentScheduler appointmentScheduler) 
        { 
            m_AppointmentScheduler = appointmentScheduler; 
            m_Employees = employees; 
 
            InitializeComponent(); 
            CountriesBox.ItemsSource = employees.Values; 
 
            m_CB_Year.ItemsSource = new int[]{2009, 2010, 2011, 2012};             
             
            List<string> monthNames = new List<string>(); 
            monthNames.Add("Komplettes Jahr"); 
            for (int i=1; i<=12; i++) 
                monthNames.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i)); 
            m_CB_Month.ItemsSource = monthNames;             
 
            m_RadChart.DefaultView.ChartLegend.Header = ""
            m_RadChart.DefaultView.ChartLegendPosition = Dock.Bottom; 
 
            SeriesMapping seriesMapping1 = new SeriesMapping(); 
            seriesMapping1.LegendLabel = "Abgerechnete Arbeitsstunden"
            seriesMapping1.SeriesDefinition = new BarSeriesDefinition(); 
            ItemMapping itemMapping1 = new ItemMapping(); 
            itemMapping1.DataPointMember = DataPointMember.YValue; 
            itemMapping1.FieldName = "WorkedHours"
            ItemMapping itemMapping2 = new ItemMapping(); 
            itemMapping2.DataPointMember = DataPointMember.XCategory; 
            itemMapping2.FieldName = "ShortName"
            seriesMapping1.ItemMappings.Add(itemMapping1); 
            seriesMapping1.ItemMappings.Add(itemMapping2); 
            m_RadChart.SeriesMappings.Add(seriesMapping1);                   
                         
            SeriesMapping seriesMapping2= new SeriesMapping(); 
            seriesMapping2.LegendLabel = "Bezahlte Arbeitsstunden"
            seriesMapping2.SeriesDefinition = new BarSeriesDefinition(); 
            ItemMapping itemMapping3 = new ItemMapping(); 
            itemMapping3.DataPointMember = DataPointMember.YValue; 
            itemMapping3.FieldName = "PaidHours"
            ItemMapping itemMapping4 = new ItemMapping(); 
            itemMapping4.DataPointMember = DataPointMember.XCategory; 
            itemMapping4.FieldName = "ShortName"
            seriesMapping2.ItemMappings.Add(itemMapping3); 
            seriesMapping2.ItemMappings.Add(itemMapping4); 
            m_RadChart.SeriesMappings.Add(seriesMapping2); 
             
            m_CB_Year.SelectedItem = DateTime.Now.Year; 
            m_CB_Month.SelectedIndex = 0; 
            m_CB_Year.SelectionChanged +=new SelectionChangedEventHandler(TimeSpanModified); 
            m_CB_Month.SelectionChanged += new SelectionChangedEventHandler(TimeSpanModified); 
 
            m_RadChart.DefaultView.ChartArea.ItemToolTipOpening += this.ChartItemToolTipOpening; 
 
            UpdateData(); 
        } 
 
 
 
 
 
        private void ChartItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs args) 
        { 
            RadChart chart = new RadChart(); 
            chart.Height = 200; 
            chart.Width = 300; 
 
            chart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed; 
            chart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Inside; 
            string axisItemLabel = m_RadChart.DefaultView.ChartArea.AxisX.TickPoints[args.ItemIndex].Label; 
            chart.DefaultView.ChartTitle.Content = string.Format("Quarterly Preview: {0}", axisItemLabel); 
 
            chart.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "C"
 
            DataSeries series = new DataSeries(); 
            series.Definition = new LineSeriesDefinition(); 
            series.Definition.ShowItemLabels = false
            //SeriesExtensions.FillWithSampleData(series, 4, (int)args.DataPoint.YValue); 
 
            string[] quarters = new string[] { "Q1""Q2""Q3""Q4" }; 
 
            for (int i = 0; i < chart.DefaultView.ChartArea.AxisX.TickPoints.Count; i++) 
                series[i].XCategory = quarters[i]; 
 
            //for (int i = 0; i < series.Count; i++) 
            //    quarterlyRevenues[i] = series[i].YValue; 
 
            chart.DefaultView.ChartArea.DataSeries.Add(series); 
 
            tooltip.Content = chart; 
        } 
 
 
 
 
 
        private void UpdateData() 
        { 
            int selectedYear = (int)m_CB_Year.SelectedItem; 
            string selectedMonthString = (string)m_CB_Month.SelectedItem; 
            bool wholeYear = false
            int selectedMonth = 0; 
            if (selectedMonthString == "Komplettes Jahr"
                wholeYear = true
            else 
                selectedMonth = DateTime.ParseExact(selectedMonthString, "MMMM", CultureInfo.CurrentCulture).Month; 
 
            DateTime startTime; 
            DateTime endTime; 
            if (wholeYear) 
            { 
                startTime = new DateTime(selectedYear, 1, 1); 
                endTime = new DateTime(selectedYear + 1, 1, 1); 
            } 
            else 
            { 
                startTime = new DateTime(selectedYear, selectedMonth, 1); 
                endTime = new DateTime(selectedYear, selectedMonth, 1).AddMonths(1); 
            } 
 
            List<ChartData> chartData = new List<ChartData>(); 
            foreach (Employee emp in m_Employees.Values) 
            { 
                double workedHours = m_AppointmentScheduler.GetWorkedHours(startTime, endTime, emp); 
                double paidHours = m_AppointmentScheduler.GetPaidHours(startTime, endTime, emp); 
                chartData.Add(new ChartData(emp.FirstName, emp.LastName, workedHours, paidHours)); 
            } 
 
            m_RadChart.ItemsSource = chartData; 
        } 
 
        private void CheckBox_Checked(object sender, RoutedEventArgs e) 
        { 
            CheckBox sourceCheckbox = e.OriginalSource as CheckBox; 
            Queue<ChartFilterDescriptor> filtersToRemove = new Queue<ChartFilterDescriptor>(); 
 
            foreach (ChartFilterDescriptor descriptor in m_RadChart.FilterDescriptors) 
            { 
                if (descriptor.Value.Equals(sourceCheckbox.Content)) 
                    filtersToRemove.Enqueue(descriptor); 
            } 
 
            foreach (ChartFilterDescriptor descriptor in filtersToRemove) 
                m_RadChart.FilterDescriptors.Remove(descriptor); 
 
        } 
 
        private void CheckBox_Unchecked(object sender, RoutedEventArgs e) 
        { 
            CheckBox sourceCheckbox = e.OriginalSource as CheckBox; 
            m_RadChart.FilterDescriptors.Add(new ChartFilterDescriptor("FullName"typeof(string), FilterOperator.IsNotEqualTo, sourceCheckbox.Content)); 
        } 
 
        private void TimeSpanModified(object sender, SelectionChangedEventArgs e) 
        { 
            UpdateData(); 
        } 
    } 

I am custom classes which are connected via SeriesMapping.

Best regards,
Markus Demmler
Anitha
Top achievements
Rank 1
 answered on 03 Jul 2012
0 answers
78 views
I'm trying to sum a column using the sum aggregate function. What is the maximum value that I can have up to. I seem to be getting an overflow problem.
Oliver
Top achievements
Rank 1
 asked on 03 Jul 2012
1 answer
76 views
Hi,

There is a new command called "ShowInsertTableOfContentsDialog" but we must give arguments and there is no documentation that show wich kind of arguments is needed.

Thanks a lot.
Patrick
Top achievements
Rank 2
 answered on 02 Jul 2012
1 answer
451 views
Hello,
I've created a mail merge application as per he example on your website.

The Word document is loaded in, and the docprovider is set. I then insert images fine using insert>picture and they show up in the document. Everything appears fine form within the program. 


When I send the emails however, the pictures don't show up. From within Outlook I get an error that reads:

 "the linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."

 I've attached a screenshot of exactly how I'm inserting the image into the document. Below is the code I use when I send the emails. Also noteworthy, I had to change the formatprovider from docx to rtf before sending the emails. If I use the docxformatprovider, the text in the email shows up with a bunch of symbols, improperly formatted. 

Here's DocOpened event I use when opening and loading the word doc:
try
{
    OpenFileDialog fDialog = (OpenFileDialog)sender;
     
    switch (System.IO.Path.GetExtension(fDialog.FileName))
    {
        case ".docx":
            docProvider = new DocxFormatProvider();
            break;
        case ".rtf":
            docProvider = new RtfFormatProvider();
            break;
        case ".txt":
            docProvider = new TxtFormatProvider();
            break;
        case ".html":
            docProvider = new HtmlFormatProvider();
            break;
        default:
            break;
    }
     
    using (FileStream fStream = new FileStream(fDialog.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
    {
        rDoc = docProvider.Import(fStream);
    }
   
    rDoc.LayoutMode = DocumentLayoutMode.Paged;
    emailForm1.Document = rDoc;
}

 ...and then when sending the emails I use this. 
protected void SubmitEmail(object sender, RoutedEventArgs e)
{
    MailMessage message = new MailMessage();
    byte[] emailBytes = null;
    string bodyText = string.Empty;
     
    SmtpClient mailServer = new SmtpClient("mail.pentegra.com");
    mailServer.UseDefaultCredentials = true;
     
    this.emailForm1.Document.MailMergeDataSource.ItemsSource = mergeFields;
    //here's where I change the formatprovider from docx to rtf. if I use docx, the email text comes out as a bunch of   symbols
 
    docProvider = new RtfFormatProvider();  
 
    //this is just a datatable with a list of emails that gets iterated through to send the emails. 
    for (int i = 0; i < _dtMerge.Rows.Count; i++)
    {
        message = new MailMessage();
        foreach (string s in lstAttachments)
        {
            message.Attachments.Add(new Attachment(s));
        }
        message.From = _fromAddress;
        emailForm1.Document.MailMergeDataSource.MoveToIndex(i);
        emailBytes = docProvider.Export(emailForm1.Document.MailMergeCurrentRecord());
 
        //I convert the byte array into the email body test here.
        StringBuilder sb = new StringBuilder();
        using (StreamReader sReader = new StreamReader(mStream))
         {
                    while (!(sReader.EndOfStream))
                    {
                        sb.Append(sReader.ReadLine() + Environment.NewLine);
                    }
          }
         bodyText = sb.ToString();
        message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(bodyText, null, "text/html"));
         
        message.To.Clear();
        message.To.Add(new MailAddress("x@xx.com"));
 
       mailServer.Send(message);
 
         
}



Everything shows up fine in the emails except the image. 
Martin Ivanov
Telerik team
 answered on 02 Jul 2012
0 answers
152 views
It appears the default behavior when selecting a time is by mouse click only. Can I select via enter key?  
I have the following requirement:

- the time picker control shall enable selection of time by pressing Enter key

Before I start intercepting key press events etc., I just want to make sure there are not setter properties I could be unaware of which would enable this behavior.

Thanks in advance.
Pete
Top achievements
Rank 1
 asked on 02 Jul 2012
2 answers
451 views
Few users are having our WPF telerik application  running very slow. This is when its loads and switch between tabs etc. All tabs have radgrids. It just says not responding and hangs.
But it works very welll on others. 
Do you have any clue?
Mike
Top achievements
Rank 1
 answered on 02 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?