Telerik Forums
UI for WPF Forum
1 answer
681 views
I have a data entry grid that I am grouping by a code in each detail record (by default - the user does not see the grouping panel).  I would like to be able to show some additional data from the group on the header.  To do this I am using Aggregate functions which does display the correct data.  However, I really want to be able to format these results to save some space and make the display more readable.  For example:
00000 Description   Cash  Inv
                                1.00   5.00

What shows is:
00000 Description  Cash 1.00  Inv 5.00

If I leave the aggregate functions showing, I can't seem to format them.  Here is the group descriptor and template that I am trying to use.  What am I missing?  Is there another way to do this?  The data is really parent/child related but the data entry is better for our users if they can go from one "parent' to another so flattened the heirarchy.  This is working fine except the display of the group header.

thanks, Koren
P.S. I realize that the template display may not be exactly right but I can't tweak it until it actually displays something.

<telerik:RadGridView.GroupHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="0,0">
                        <TextBlock Text="{Binding Group.Key}" Margin="0,0,0,2" Width="200" />                       
                        <telerik:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Caption}" Width="80" />
                                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding FormattedValue}" Width="80" />
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal" />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </telerik:AggregateResultsList>
                    </StackPanel>
 
                </DataTemplate>
            </telerik:RadGridView.GroupHeaderTemplate>
            <telerik:RadGridView.GroupDescriptors>
                <telerik:GroupDescriptor x:Name="TransactionGroup" Member="TransactionGroup" SortDirection="Ascending" >
                    <telerik:GroupDescriptor.AggregateFunctions>
                        <telerik:MinFunction Caption="Cash: " SourceField="CashTotal" ResultFormatString="{}{0:0.00}"  />
                        <telerik:MinFunction Caption="Inv Beg: " SourceField="BegInvTotal" ResultFormatString="{}{0:0.00}"  />
                        <telerik:MinFunction Caption="End: " SourceField="EndInvTotal" ResultFormatString="{}{0:0.00}"  />
                        <telerik:MinFunction Caption="Acc Beg: " SourceField="BegAccruedTotal" ResultFormatString="{}{0:0.00}"  />
                        <telerik:MinFunction Caption="End: " SourceField="EndAccruedTotal" ResultFormatString="{}{0:0.00}"  />
                        <telerik:MinFunction Caption="Accrual: " SourceField="AccrualAmount" ResultFormatString="{}{0:0.00}"  />
                        <telerik:SumFunction Caption="Ent Amt: " SourceField="Amount" ResultFormatString="{}{0:c2}"  />
                        <local:EnterpriseDifferenceFunction Caption="Diff: " ResultFormatString="{}{0:0.00}" />
                    </telerik:GroupDescriptor.AggregateFunctions>
                </telerik:GroupDescriptor>
            </telerik:RadGridView.GroupDescriptors>


Dimitrina
Telerik team
 answered on 25 Oct 2011
1 answer
70 views
I have a very simple model.
Users can choose multiple surfaces to show the scheduled events. Basically I have to group them ( in all views) by each surface name.
Something very similar to your first look example. But we get all that data from a database. So the surface selection is always dynamic.
And each surface has it's own color elements. Also, each appointment belongs to a particular customer and users can assign different color properties to each of these clients. I want to know, if you guys can give me a full ( event if it is simple) example of how I can achieve this using XML as my data source? I am kind of new to your controls.
Rosi
Telerik team
 answered on 25 Oct 2011
1 answer
224 views

Hello,
Can I stop the grid from being rendered while manipulating data, and making it render again only at a specific point?

Now I have serious performance issues, which seems to be caused by over re-measuring of the grid.

Pavel Pavlov
Telerik team
 answered on 25 Oct 2011
8 answers
553 views
Hi,

I need to show the close button in the header rather than at the right most position of the pane(default view)! Is there any property or style settings to achieve this? Or should I extend the control!

Thanks,
Godwin
Godwin
Top achievements
Rank 1
 answered on 25 Oct 2011
1 answer
165 views

Hi,

in my application, I'm using Telerik theme "Office_BlueTheme" and the control HeaderedContentControl doesn't seem to be affected by the theme I choose, I mean, the header of the control stay gray instead of having a kind of blue like other Telerik controls I used.

Thank's

Boyan
Telerik team
 answered on 25 Oct 2011
1 answer
131 views
Right, I have a list box to the left, and a schedule view to the right. On the schedule view I have included resources, by which I group. When I drag from the list to the schedule view, I can only drop onto the first group. When I attempt to drag an appointment already on the schedule view to another group on the schedule view, it won't allow it.

I have implemented a custom drag drop behaviour class:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.ScheduleView;
 
namespace WpfApplication3
{
	public class ListBoxDragDropBehavior : Freezable
	{
		public static readonly DependencyProperty AppointmentTemplateProperty =
			DependencyProperty.Register("AppointmentTemplate"typeof(DataTemplate), typeof(ListBoxDragDropBehavior), null);
 
		public static readonly DependencyProperty EffectivePixelLengthProperty =
			DependencyProperty.Register("EffectivePixelLength"typeof(TimeSpan), typeof(ListBoxDragDropBehavior), null);
 
		public static readonly DependencyProperty EffectiveOrientationProperty =
			DependencyProperty.Register("EffectiveOrientation"typeof(Orientation), typeof(ListBoxDragDropBehavior), null);
 
		public static readonly DependencyProperty BehaviorProperty =
			DependencyProperty.RegisterAttached("Behavior"typeof(ListBoxDragDropBehavior), typeof(ListBoxDragDropBehavior), new PropertyMetadata(new PropertyChangedCallback(OnBehaviorChanged)));
 
		public DataTemplate AppointmentTemplate
		{
			get { return (DataTemplate)GetValue(AppointmentTemplateProperty); }
			set { SetValue(AppointmentTemplateProperty, value); }
		}
 
		public TimeSpan EffectivePixelLength
		{
			get { return (TimeSpan)GetValue(EffectivePixelLengthProperty); }
			set { SetValue(EffectivePixelLengthProperty, value); }
		}
 
		public Orientation EffectiveOrientation
		{
			get { return (Orientation)GetValue(EffectiveOrientationProperty); }
			set { SetValue(EffectiveOrientationProperty, value); }
		}
        
		public static ListBoxDragDropBehavior GetBehavior(DependencyObject obj)
		{
			return (ListBoxDragDropBehavior)obj.GetValue(BehaviorProperty);
		}
 
		public static void SetBehavior(DependencyObject obj, ListBoxDragDropBehavior value)
		{
			obj.SetValue(BehaviorProperty, value);
		}
 
		protected override Freezable CreateInstanceCore()
		{
			return new ListBoxDragDropBehavior();
		}
 
		private static void OnBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			System.Windows.Controls.ListBox listBox = d as System.Windows.Controls.ListBox;
			if (listBox == null)
			{
				return;
			}
 
			ListBoxDragDropBehavior behavior = (ListBoxDragDropBehavior)e.OldValue;
			if (behavior != null)
			{
				RadDragAndDropManager.RemoveDragQueryHandler(listBox, new EventHandler<DragDropQueryEventArgs>(behavior.OnDragQuery));
				RadDragAndDropManager.RemoveDropQueryHandler(listBox, new EventHandler<DragDropQueryEventArgs>(behavior.OnDropQuery));
				RadDragAndDropManager.RemoveDropInfoHandler(listBox, new EventHandler<DragDropEventArgs>(behavior.OnDropInfo));
			}
 
			behavior = (ListBoxDragDropBehavior)e.NewValue;
			if (behavior != null)
			{
				RadDragAndDropManager.SetAllowDrop(listBox, true);
				RadDragAndDropManager.AddDragQueryHandler(listBox, new EventHandler<DragDropQueryEventArgs>(behavior.OnDragQuery));
				RadDragAndDropManager.AddDropQueryHandler(listBox, new EventHandler<DragDropQueryEventArgs>(behavior.OnDropQuery));
				RadDragAndDropManager.AddDropInfoHandler(listBox, new EventHandler<DragDropEventArgs>(behavior.OnDropInfo));
			}
		}
 
		private void OnDragQuery(object sender, DragDropQueryEventArgs e)
		{
			if (e.Options.Status == DragStatus.DragQuery)
			{
				System.Windows.Controls.ListBox listbox = sender as System.Windows.Controls.ListBox;
 
				IList<IOccurrence> appointments = listbox.SelectedItems.OfType<IOccurrence>().ToList();
 
				if (appointments.Count == 0)
				{
					return;
				}
 
				e.Options.DragCue = this.CreateDragCue(appointments);
				e.Options.Payload = new ScheduleViewDragDropPayload(listbox.ItemsSource, appointments);
			}
 
			e.QueryResult = true;
		}
 
		private void OnDropQuery(object sender, DragDropQueryEventArgs e)
		{
			e.QueryResult = e.Options.Payload is ScheduleViewDragDropPayload;
		}
 
		private void OnDropInfo(object sender, DragDropEventArgs e)
		{
            System.Windows.Controls.ListBox listBox = sender as System.Windows.Controls.ListBox;
 
			if (e.Options.Status == DragStatus.DropPossible)
			{
				RadDragAndDropManager.Options.Effects = DragDropEffects.All;
				RadDragAndDropManager.Options.CurrentCursor = System.Windows.Input.Cursors.Arrow;
			}
 
            //If the user has dropped - and the drag was made FROM the scheduleview TO the listbox
			if (e.Options.Status == DragStatus.DropComplete && !listBox.IsAncestorOf(e.Options.Source))
			{
				ScheduleViewDragDropPayload payload = e.Options.Payload as ScheduleViewDragDropPayload;
				if (payload != null)
				{
					(payload.SourceAppointmentsSource as IList).RemoveAll((object i) => payload.DraggedAppointments.OfType<object>().Contains(i));
					(listBox.ItemsSource as IList).AddRange(payload.DraggedAppointments);
				}
			}
		}
 
		private ContentControl CreateDragCue(IEnumerable<IOccurrence> appointments)
		{
			bool isHorizontal = this.EffectiveOrientation == Orientation.Horizontal;
			double ticksPerPixel = this.EffectivePixelLength.Ticks;
 
			StackPanel panel = new StackPanel();
			panel.Orientation = this.EffectiveOrientation;
			panel.Background = new SolidColorBrush() { Color = Colors.Transparent };
 
			foreach (IOccurrence appointment in appointments)
			{
				double lenght = appointment.Duration().Ticks / ticksPerPixel;
 
				AppointmentCueItem item = new AppointmentCueItem();
				item.HorizontalContentAlignment = HorizontalAlignment.Stretch;
				item.VerticalContentAlignment = VerticalAlignment.Stretch;
				item.Height = isHorizontal ? 110 : lenght;
				item.Width = isHorizontal ? lenght : 110;
				item.Content = appointment;
				item.ContentTemplate = this.AppointmentTemplate;
 
				panel.Children.Add(item);
			}
 
			ContentControl cue = new ContentControl();
			cue.Content = panel;
 
			return cue;
		}
	}
}

And I have the following xaml definitions for the listbox and schedule view:

        <telerik:RadScheduleView Name="radScheduleView1"
                                 EditAppointmentDialogStyle="{StaticResource EditAppointmentDialogStyle}"
                                 Grid.Column="1"
                                 AppointmentItemContentTemplate="{StaticResource AppointmentItemContentTemplate}"
                                 GroupHeaderContentTemplateSelector="{StaticResource GroupHeaderContentTemplateSelector}">
            <telerik:RadScheduleView.ViewDefinitions>
                <my:DayViewDefinition />
                <my:WeekViewDefinition />
                <my:MonthViewDefinition />
                <my:TimelineViewDefinition />
            </telerik:RadScheduleView.ViewDefinitions>
 
            <scheduleView:RadScheduleView.GroupDescriptionsSource>
                <scheduleView:GroupDescriptionCollection>
                    <scheduleView:ResourceGroupDescription ResourceType="Operatives" />
                </scheduleView:GroupDescriptionCollection>
            </scheduleView:RadScheduleView.GroupDescriptionsSource>
 
        </telerik:RadScheduleView>
 
        <ListBox AllowDrop="True" ItemsSource="{Binding}" Name="listBox1"
                 ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"
                 ItemTemplate="{StaticResource ListBoxItemTemplate}" SelectionMode="Extended"
                 HorizontalAlignment="Left" Width="270">
            <local:ListBoxDragDropBehavior.Behavior>
                <local:ListBoxDragDropBehavior EffectivePixelLength="{Binding EffectivePixelLength, ElementName=radScheduleView1}"
                                               EffectiveOrientation="{Binding EffectiveOrientation, ElementName=radScheduleView1}"
                                               AppointmentTemplate="{Binding DragVisualCueItemTemplate, ElementName=radScheduleView1}" />
            </local:ListBoxDragDropBehavior.Behavior>
            <ListBox.Background>
                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                    <GradientStop Color="#FF4B4B4B" Offset="1" />
                    <GradientStop Color="#FF6E6E6E" />
                </LinearGradientBrush>
            </ListBox.Background>
        </ListBox>

I could really do with cracking this problem ASAP as I have deadlines to meet very soon, I really really appreciate any help you can give.

Thanks,

Dan
Valeri Hristov
Telerik team
 answered on 25 Oct 2011
2 answers
391 views
Hi, can someone tell me how (or maybe it's not possible) to center the content inside the RadRibbonButton? The text and image I set is always left justified for some reason. For each button I add to the tab (or group) I have a large image and text. I would like to center this if possible. HorizontalContentAlignment doesn't seem to do anything.

Example:
RadRibbonButton button = new RadRibbonButton();
ImageSource imgs = ResourceLoader.GetResourceImage(buttonModel.AssemblyViewFileName, buttonModel.ButtonIconResourceName);
 
button.LargeImage = imgs;
button.Size = Telerik.Windows.Controls.RibbonView.ButtonSize.Large;
button.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
button.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;

Or
<telerikRibbon:RadRibbonGroup Header="Common">
                    <telerikRibbon:RadRibbonButton Text="Home" LargeImage="/Resources/Home32.png" Width="70" Size="Large" HorizontalContentAlignment="Center" />
                </telerikRibbon:RadRibbonGroup>

Tina Stancheva
Telerik team
 answered on 25 Oct 2011
1 answer
167 views
Hello,

Practically identical to a thread opened recently for the Silverlight control...

Rather than have the zoom controller on the Image Editor UI default to a value of "100%," I'd like to have the option to default its value to "Auto." Is this property currently implemented and I just don't see it?

Thank you,
Kyle
Iva Toteva
Telerik team
 answered on 25 Oct 2011
1 answer
92 views
Hi,

I want to get all the appointments within the visible range of the scheduleview. If it is day view, all the appointments in that day and if is weekview all the appointments occur in that week..Please help...

With Regards,
Jeyakumar
Valeri Hristov
Telerik team
 answered on 25 Oct 2011
5 answers
489 views
I specified the SelectionBoxTemplate on my ComboBox, but its being ignored. My code is:
<ti:RadComboBox Name="CodeComboBox" Margin="5,0,0,0" MinWidth="80"
            tc:StyleManager.Theme="Office_Blue"
            IsEditable="True"
            ItemsSource="{Binding DataView}"
            DisplayMemberPath="{Binding DisplayColumnName}"
            SelectedValuePath="{Binding KeyColumnName}"
            SelectedItem="{Binding SelectedView}">
         <ti:RadComboBox.SelectionBoxTemplate>
              <DataTemplate>
                  <TextBox Text="Hows it going" Background="Green"/>
              </DataTemplate>
          </ti:RadComboBox.SelectionBoxTemplate>
</ti:RadComboBox>

Am I doing something wrong?
George
Telerik team
 answered on 25 Oct 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
Slider
Expander
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
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?