Telerik Forums
UI for WPF Forum
2 answers
134 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
151 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
124 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
73 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
149 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
93 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
69 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
213 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
66 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
2 answers
228 views
I'm trying to use the RadGridView AggregateFunctions. I've tested Count, Min and Max functions successfully. However, when I try using SumFunction or AverageFunction, nothing is displayed on the column footer (including the previously added Count, Min, Max functions).

I'm binding a DataTable to the grid from C# like this:

this.radGrid1.ItemsSource = dtData; 

This is the XAML for the GridView:

<telerikGrid:RadGridView  
            x:Name="radGrid1" 
            MultipleSelect="True"  
            AutoGenerateColumns="False" 
            ShowColumnFooters="True" ShowGroupFooters="True"
 
            <telerikGrid:RadGridView.Columns> 
                 
                <telerikGrid:GridViewDataColumn Header="AccountNo" DataMemberBinding="{Binding AccountNo}"
                    <telerikGrid:GridViewDataColumn.AggregateFunctions> 
                        <telerikData:CountFunction Caption="Count:" /> 
                    </telerikGrid:GridViewDataColumn.AggregateFunctions> 
                </telerikGrid:GridViewDataColumn> 
                 
                <telerikGrid:GridViewDataColumn Header="InvestmentCost" DataMemberBinding="{Binding InvestmentCost}" DataFormatString="{}{0:c}" TextAlignment="Right"
                    <telerikGrid:GridViewDataColumn.AggregateFunctions> 
                        <telerikData:SumFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                        <telerikData:MinFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                        <telerikData:MaxFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                    </telerikGrid:GridViewDataColumn.AggregateFunctions> 
                </telerikGrid:GridViewDataColumn> 
                 
            </telerikGrid:RadGridView.Columns> 
        </telerikGrid:RadGridView> 

Edit: 
DataType for InvestmentCost column in dtData is Decimal.
I'm using RadControls for WPF Q3 2009 SP1
Jeffrey
Top achievements
Rank 1
 answered on 30 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?