Telerik Forums
UI for WPF Forum
1 answer
289 views
Hi,

I am in need of a custom aggregate function which is required to sum certain values based on some conditions. Can anyone give sample code for writing the custom aggregate function in WPF RadGrid?
Vlad
Telerik team
 answered on 04 Jan 2010
2 answers
172 views
Hi,

How can i achieve functionality of changing row background color acording to even/odd value of row number. In other words: I would like to have all even-number rows in color A and all odd-number rows in color B, starting from first row in group.

Regards,
MC.
Maciej Czerwiakowski
Top achievements
Rank 1
 answered on 04 Jan 2010
6 answers
174 views
We have installed Q2003 SP1, but we are now getting StackOverflow Exception in WindowsBase.dll each time with click a RadComboBox.

All are defined as below:

        <telerik:RadComboBox x:Name="InsurancePositionComboBox" IsEnabled="{Binding DataContext.IsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
                           Grid.Row="4" Grid.Column="6" 
                           ItemsSource="{Binding DataContext.InsurancePositionItems,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
                           DisplayMemberPath="Name" 
                           SelectedValuePath="StakeholderId" 
                           SelectedValue="{Binding InsurancePositionId}" 
                           IsSynchronizedWithCurrentItem="True" Margin="10,0,0,0" Height="25" Width="170"
        </telerik:RadComboBox> 

Any idea ?
4ward s.r.l.
Top achievements
Rank 1
 answered on 03 Jan 2010
2 answers
155 views
In MS ListView I did like this to set color/brush on a row with sertial "Category" value.

 <Window.Resources> 
        <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}">  
            <Style.Resources> 
                <LinearGradientBrush x:Key="Brush1" StartPoint="0.5,0" EndPoint="0.5,1">  
                    <GradientStop Offset="0.1" Color="#AA00CC00" /> 
                    <GradientStop Offset="0.8" Color="#55008800" /> 
                </LinearGradientBrush> 
                  
        <LinearGradientBrush x:Key="Brush2" StartPoint="0.5,0" EndPoint="0.5,1">  
                    <GradientStop Offset="0.1" Color="Orange" /> 
                    <GradientStop Offset="0.8" Color="OrangeRed" /> 
                </LinearGradientBrush> 
 
            </Style.Resources> 
 
 
            <Style.Triggers> 
                  
                <DataTrigger Binding="{Binding Path=Category}" Value="1">  
                    <Setter Property="Background" Value="{StaticResource Brush1}" /> 
                    <Setter Property="Height" Value="25"/>  
                </DataTrigger> 
                  
                <DataTrigger Binding="{Binding Path=Category}" Value="2">  
                    <Setter Property="Background" Value="{StaticResource Brush2}" /> 
                    <Setter Property="Height" Value="30"/>  
                </DataTrigger> 
                  
                 
            </Style.Triggers> 
        </Style> 
 
    </Window.Resources> 

In Listview
 <ListView x:Name="listView1" ItemContainerStyle="{StaticResource ItemContStyle}">  
<ListView.View> 
<GridView> 
 <GridViewColumn Header="Artist" DisplayMemberBinding="{Binding Path=Artist}" Width="310" /> 
<GridViewColumn Header="Title" DisplayMemberBinding="{Binding Path=Title}" Width="310" /> 
</GridView> 
</ListView.View> 
 </ListView> 

How can I applay the same method on RadGridView?
Tsvyatko
Telerik team
 answered on 30 Dec 2009
1 answer
99 views
Two Questions

1 how can i Control over the Place of the splitter ?

2 i want to change the header line background color to white ?
Rossen Hristov
Telerik team
 answered on 30 Dec 2009
1 answer
185 views
can't find in the latest documentation how to bind datatable to the radgridview. .itemssource works , table gets rows added , call .rebind , grid scrolls but rows are added with no values (or at least not displayed) , also how do I get scroll bars...

is this release of ddls botched? or is it me?
Rossen Hristov
Telerik team
 answered on 30 Dec 2009
3 answers
118 views

selected_id = (

string)((DataRow)((DataRecord)this.radGridView_A1.SelectedRecord).Data)[0];

DataRecord is gone, any sugguestions, Also, don't understrand why telerik posts examples (as of 3 months ago ) of apis that will be obscolete, wtf?


 

Rossen Hristov
Telerik team
 answered on 30 Dec 2009
1 answer
88 views

 

if (this.radGridView_A1.SelectedRecords.Count() == 0)


does not compile with the latest (q3) wpf dlls

 

Rossen Hristov
Telerik team
 answered on 30 Dec 2009
5 answers
253 views
I have to grid views (one is my medialibrary and one for a playlist). I want to drag songs from the "medialibrary" to the "playlist", I aslo need to be adle to insert anywhere on the "playlist" grid when I drag from "medialib".

Also need to dragdrop within the "playlist" so I can change place on the songs in the "playlist".

Now I only get drag from "medialib" to "playlist" work sort of, and the tooltip looks funny.

Help!

C#
ObservableCollection<Song> _mediaLib;     
ObservableCollection<Song> _playlist;     
    
    
private void InitGrids()     
        {     
            _mediaLib = new ObservableCollection<Song>();     
            _playlist = new ObservableCollection<Song>();     
    
            radGridViewMediaLib.ItemsSource = _mediaLib;     
            radGridViewPlaylist.ItemsSource = _playlist;     
    
            RadDragAndDropManager.AddDropQueryHandler(radGridViewMediaLib, OnDropQuery);     
            RadDragAndDropManager.AddDropQueryHandler(radGridViewPlaylist, OnDropQuery);     
    
            RadDragAndDropManager.AddDragQueryHandler(radGridViewMediaLib, OnOrderDragQuery);     
            RadDragAndDropManager.AddDragQueryHandler(radGridViewPlaylist, OnOrderDragQuery);     
    
            RadDragAndDropManager.AddDragInfoHandler(radGridViewMediaLib, OnOrderDragInfo);     
            RadDragAndDropManager.AddDragInfoHandler(radGridViewPlaylist, OnOrderDragInfo);     
        }   
  
  
#region DragDrop     
    
        private void OnDropQuery(object sender, DragDropQueryEventArgs e)     
        {     
            // We allow drop only if the dragged items are products:     
            ICollection draggedItems = e.Options.Payload as ICollection;     
            bool result = draggedItems.Cast<object>().All((object item) => item is Song);     
            e.QueryResult = result;     
            e.Handled = true;     
    
            // Note that here we agree to accept a drop. We will be notified     
            // in the DropInfo event whether a drop is actually possible.     
        }     
    
        private void OnOrderDragQuery(object sender, DragDropQueryEventArgs e)     
        {     
            RadGridView gridView = sender as RadGridView;     
            if (gridView != null)     
            {     
                IList selectedItems = gridView.SelectedItems.ToList();     
                e.QueryResult = selectedItems.Count > 0;     
                e.Options.Payload = selectedItems;     
            }     
    
            e.QueryResult = true;     
            e.Handled = true;     
        }     
    
        private void OnOrderDragInfo(object sender, DragDropEventArgs e)     
        {     
            RadGridView gridView = sender as RadGridView;     
            IEnumerable draggedItems = e.Options.Payload as IEnumerable;     
    
            if (e.Options.Status == DragStatus.DragInProgress)     
            {     
                //Set up a drag cue:     
                TreeViewDragCue cue = new TreeViewDragCue();     
                //Here we need to choose a template for the items:     
                cue.ItemTemplate = this.Resources["Song"as DataTemplate;     
                cue.ItemsSource = draggedItems;     
                e.Options.DragCue = cue;     
            }     
            else if (e.Options.Status == DragStatus.DragComplete)     
            {     
                IList source = gridView.ItemsSource as IList;     
                foreach (object draggedItem in draggedItems)     
                {     
                    _playlist.Add((Song)draggedItem);     
                }     
            }     
        }   
  
        #endregion     
    
    
private ObservableCollection<Song> GetSongs(int count)     
        {     
            ObservableCollection<Song> _sList = new ObservableCollection<Song>();     
    
            for (int i = 0; i < count; i++)     
            {     
                Song _s = new Song();     
                _s.Artist = "Artist " + i.ToString();     
                _s.Title = "Title " + i.ToString();     
                _s.GUID = Guid.NewGuid();     
                _sList.Add(_s);     
            }     
    
    
            return _sList;     
        }     
    
    
//Song class     
public class Song     
    {     
        public Song()     
        {     
                
        }     
    
        public Guid GUID { getset; }     
        public string Artist { getset; }     
        public string Title { getset; }     
    
    }     
 


WPF:
<Window.Resources> 
        <Style TargetType="gridViewElements:GridViewRow" x:Key="OrderItemStyle">  
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" /> 
        </Style> 
 
        <LinearGradientBrush x:Key="DropPossibleBackground" StartPoint="0 0" EndPoint="0 1">  
            <GradientStop Offset="0" Color="White" /> 
            <GradientStop Offset="1" Color="#FFE699" /> 
        </LinearGradientBrush> 
 
    </Window.Resources> 
 
<telerik:RadGridView Height="762" Margin="12,42,571,-42" Name="radGridViewMediaLib" Width="595" HorizontalAlignment="Left" 
                             IsReadOnly="True" dragDrop:RadDragAndDropManager.AllowDrop="True" 
                        RowStyle="{StaticResource OrderItemStyle}" Background="White" 
                        CanUserFreezeColumns="False" CanUserInsertRows="False" 
                        ShowGroupPanel="False" /> 
              
 
        <telerik:RadGridView Height="762" Margin="0,50,64,-50" Name="radGridViewPlaylist" Width="480" HorizontalAlignment="Right"   
                             IsReadOnly="True" dragDrop:RadDragAndDropManager.AllowDrop="True" 
                        RowStyle="{StaticResource OrderItemStyle}" Background="White" 
                        CanUserFreezeColumns="False" CanUserInsertRows="False" 
                        ShowGroupPanel="False" /> 
Christophe
Top achievements
Rank 1
 answered on 30 Dec 2009
1 answer
82 views
hi
i would like to rollback the datetime user selection under the 'SelectedStartDateTimeChanged' event.
it seems that the SelectedDateTime property is updated correctly but the time control (view) is not.

scenario
the current dateTime selection is  29/12/2009 14:00
user try to change the datetime to  29/12/2009 15:00
then i would like from the time control to show 14:00 and not 15:00

source code:
 private void OnSelectedStartDateTimeChanged(object sender, RoutedPropertyChangedEventArgs<DateTime?> e)
        {
            try
            {
                UnSubscribeToSelectedStartDateTimeChanged();
                if (e.OldValue == null) //first time loading
                    return;

                 startDateTime.SelectedDateTime = (DateTime) e.OldValue;
              
            }
            finally
            {
                SubscribeToSelectedStartDateTimeChanged();
            }
        }
Kaloyan
Telerik team
 answered on 30 Dec 2009
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
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?