Telerik Forums
UI for WPF Forum
3 answers
271 views
Hello,

I need to change visual style of line chart. I want to change size and fill of circle points, lines between points may remain unchanged.

I'm not sure what control I should template, because changing template of whole telerik:Line destroys all the lines between points and also Y positions of points are wrong.

Some example, like in your Demo application (Custom Bar Template) would be great.

Thank you!


Dwight
Telerik team
 answered on 10 Dec 2009
1 answer
171 views
Hi Telerik

In the following xaml I have set up a RadGridView with two columns:

       <t:RadGridView ItemsSource="{Binding Persons}"  ActionOnLostFocus="CommitEdit" AutoGenerateColumns="False" > 
            <t:RadGridView.Columns> 
                <!-- Auto column --> 
                <t:GridViewDataColumn DataMemberBinding="{Binding Path=ID}"  /> 
                <!-- Manual column --> 
                <t:GridViewDataColumn DataMemberBinding="{Binding Name}"
                    <t:GridViewDataColumn.CellTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="{Binding Name}" /> 
                        </DataTemplate> 
                    </t:GridViewDataColumn.CellTemplate> 
                    <t:GridViewDataColumn.CellEditTemplate> 
                        <DataTemplate> 
                            <TextBox Text="{Binding Name,Mode=TwoWay}" /> 
                        </DataTemplate> 
                    </t:GridViewDataColumn.CellEditTemplate> 
                </t:GridViewDataColumn> 
            </t:RadGridView.Columns> 
        </t:RadGridView>       

This xaml was placed in a window with the following code behind:

using System.Collections.ObjectModel; 
using System.Windows; 
 
namespace WpfApplication2 
    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainWindow : Window 
    { 
        public MainWindow()        { 
            InitializeComponent(); 
            this.DataContext = this
        } 
 
        public ObservableCollection<Employee> Persons 
        { get { return EmployeeService.GetEmployees(); } } 
 
    } 
    public class Employee    { 
        public int ID { getset; } 
        public string Name { getset; } 
    } 
    public class EmployeeService    { 
        public static ObservableCollection<Employee> GetEmployees() 
        { 
            ObservableCollection<Employee> employees = new ObservableCollection<Employee>(); 
            Employee employee = new Employee(); 
            employee.Name = "Maria"
            employee.ID = 24890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
            employee.Name = "Ana"
            employee.ID = 23890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
            employee.Name = "Antonio"
            employee.ID = 24890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
 
            return employees; 
        } 
    } 
 

Now if you run this code you will notice that the two DataGrid columns behave differently when you are updating them. As I understand, when ActionOnLostFocus is set to "CommitEdit" the cell being edited should save its new value when it looses focus. The cells in the first column behave in this fashion, however those in the second column do not - Each reverts to its old value whenever it looses focus.

Why is this? How do I change the behavior of the cells in the second column so that each cell saves its new value when focus is transfered elsewhere?

Cheers

Bob
Nedyalko Nikolov
Telerik team
 answered on 09 Dec 2009
2 answers
213 views
When I update a field in a WPF datagrid that's associated with a dataset the corresponding field in the underlying datatable is also modified after I issue a commitedit.
When I delete a column in the grid the corresponding column in the datatable is still present. Am I responsible for deleting the datatable column or am I doing something wrong?

Jorge Gonzalez
Top achievements
Rank 1
 answered on 09 Dec 2009
4 answers
100 views
Hello,
I have a problem exporting to a text file while grouping the data.

<!-- Window1.xaml --> 
<Window x:Class="WpfTelerikRadGridViewTest.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Width="800" Height="600" > 
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition Height="Auto" /> 
        </Grid.RowDefinitions> 
        <telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" /> 
        <Button Grid.Row="1" Click="ButtonBase_OnClick">Save</Button> 
    </Grid> 
</Window> 


// Window1.xaml.cs  
public partial class Window1  
{  
    public Window1()  
    {  
        InitializeComponent();  
 
        var list = new ObservableCollection<string>();  
 
        list.Add("HELLO1");  
        list.Add("HELLO2");  
        list.Add("HELLO3");  
        list.Add("HELLO4");  
        list.Add("HELLO5");  
 
        DataContext = list;  
    }  
 
    private void ButtonBase_OnClick(object sender, RoutedEventArgs e)  
    {  
        var s = radGridView1.ToText();  
    }  

When i press the save button the variable 's' gets the _correct_ value:
"\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n"

When i press the save button while grouping the column i get the following value on 's': 
"\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n"

This means that i cant export a grid if the user is grouping. I thought that it would generate a sorted grid. This behavior also applies to ToHtml.
Robert
Top achievements
Rank 1
 answered on 09 Dec 2009
2 answers
122 views
how can i make the Text inside  the GridViewDataColumn.Header wrap?

i think something can be done with the GridViewHeaderCell but i didn't managed to make it work

igal a
Top achievements
Rank 1
 answered on 09 Dec 2009
5 answers
144 views
Hi everybody,

I am trying to set up RadGridView as a multi-column tree-view for a self-referencing scenario. I need to make grid columns to be aligned for all the child and parent rows. So if I drag a column gridline then I would expect the gridline to stay straight across all the rows, both parent and child. We are talking about the same column and I need it to behave like one. How can I do this?
Also, when I set frozen columns then child rows would keep sliding past the freeze line (I guess this is part of the same task: treat parent and child columns with the same name as the same visual column).

The final task is when I can get this 'same column' behavior then I need to be able to sort, filter, etc, i.e. do common grid operations.
(Note: I can sort on different columns in the 'SelfReference' example in the Examples_WPF.CS demo but the result of sorting does make much sense when you expand child rows).

Has anybody been able to address this task before? Could you please share your experience/knowledge?

Regards,
g8r.
Gennady Ralko
Top achievements
Rank 1
 answered on 09 Dec 2009
9 answers
458 views
Hi,

I've embedded a fairly simple example of an issue we have in the greater solution.

The Context:
Using a datatable as the source.
Adding a summary row for Hours (Int32)
Get the error:No method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied arguments.

<Window x:Class="Window1"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"    
    xmlns:telerikdata="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" 
    Title="Window1" WindowState="Maximized">  
    <Grid> 
        <telerik:RadGridView      
                        AutoGenerateColumns="False"    
                        HorizontalAlignment="Right"      
                        IsFilteringAllowed="False"    
                        CanUserFreezeColumns="False"      
                        CanUserReorderColumns="False"      
                        IsEnabled="True"    
                        ColumnsWidthMode="Auto"    
                        ShowColumnFooters="True" 
                        CanUserSortColumns="False"                     
                        ShowGroupPanel="False"    
                        ItemsSource="{Binding Tables[Labour.EmployeeLeave]}"    
                        > 
            <telerik:RadGridView.Columns> 
                <telerik:GridViewComboBoxColumn      
                                Header="Employee"      
                                DataMemberBinding="{Binding [EmpNum], Mode=TwoWay}"    
                                SelectedValueMemberPath="EmpNum"    
                                DisplayMemberPath="Fullname"    
                                ItemsSource="{Binding}"      
                                DataContext="{Binding Tables[Labour.Employee]}"/>  
                <telerik:GridViewDataColumn Header="Leave Type" UniqueName="LeaveCode" /> 
                <telerik:GridViewDataColumn Header="Date From" UniqueName="DateFrom" /> 
                <telerik:GridViewDataColumn Header="Date To" UniqueName="DateTo" /> 
                <telerik:GridViewDataColumn   
                    Header="Hours"   
                    DataMemberBinding="{Binding [Hours], Mode=TwoWay}" > 
                    <telerik:GridViewDataColumn.AggregateFunctions> 
                        <telerikdata:SumFunction Caption="Total: " SourceField="Hours" /> 
                    </telerik:GridViewDataColumn.AggregateFunctions> 
                </telerik:GridViewDataColumn> 
                <telerik:GridViewDataColumn Header="Pay In Advance" UniqueName="PayInAdvance"/>  
                <telerik:GridViewDataColumn Header="Comments" UniqueName="Comments" /> 
                <telerik:GridViewDataColumn Header="Total Made" UniqueName="TotalMade" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window>    
 

Imports System.Data  
 
Class Window1  
 
    Public Sub New()  
        InitializeComponent()  
        Dim ds As New DataSet  
        Dim dt As New DataTable("Labour.Employee")  
        Me.BuildEmployeesTable(dt)  
        ds.Tables.Add(dt)  
        dt = New DataTable("Labour.EmployeeLeave")  
        Me.BuildEmployeeLeaveTable(dt)  
        ds.Tables.Add(dt)  
        Me.DataContext = ds  
    End Sub 
 
    Private Sub BuildEmployeesTable(ByVal dt As DataTable)  
        dt.Columns.Add("EmpNum"GetType(System.Int32))  
        dt.Columns.Add("Firstname"GetType(System.String))  
        dt.Columns.Add("Surname"GetType(System.String))  
        dt.Columns.Add("Fullname"GetType(System.String), "Firstname+' '+Surname")  
        Me.AdddEmployeesRow(dt, 1, "Joe""Blogs")  
        Me.AdddEmployeesRow(dt, 2, "John""Doe")  
        Me.AdddEmployeesRow(dt, 3, "Mary""May")  
    End Sub 
 
    Private Sub BuildEmployeeLeaveTable(ByVal dt As DataTable)  
        dt.Columns.Add("EmpNum"GetType(System.Int32))  
        dt.Columns.Add("LeaveCode"GetType(System.String))  
        dt.Columns.Add("DateFrom"GetType(System.DateTime))  
        dt.Columns.Add("DateTo"GetType(System.DateTime))  
        dt.Columns.Add("Hours"GetType(System.Int32))  
        dt.Columns.Add("PayInAdvance"GetType(System.Boolean))  
        dt.Columns.Add("Comments"GetType(System.String))  
        dt.Columns.Add("TotalMade"GetType(String), "Comments+Hours")  
        Me.AdddEmployeeLeaveRow(dt, 1, "sss", Now, Now, 55, True"comment")  
        Me.AdddEmployeeLeaveRow(dt, 2, "sss", Now, Now, 22, True"comment")  
        Me.AdddEmployeeLeaveRow(dt, 3, "sss", Now, Now, 33, True"comment")  
    End Sub 
 
    Private Sub AdddEmployeesRow(ByVal dt As DataTable, ByVal id As IntegerByVal fname As StringByVal lname As String)  
        Dim dr As DataRow = dt.NewRow()  
        dr("EmpNum") = id  
        dr("Firstname") = fname  
        dr("Surname") = lname  
        dt.Rows.Add(dr)  
    End Sub 
 
    Private Sub AdddEmployeeLeaveRow(ByVal dt As DataTable, ByVal id As IntegerByVal LeaveCode As StringByVal DateFrom As DateTime, ByVal DateTo As DateTime, ByVal Hours As IntegerByVal PayInAdvance As BooleanByVal Comments As String)  
        Dim dr As DataRow = dt.NewRow()  
        dr("EmpNum") = id  
        dr("LeaveCode") = LeaveCode  
        dr("DateFrom") = DateFrom  
        dr("DateTo") = DateTo  
        dr("Hours") = Hours  
        dr("PayInAdvance") = PayInAdvance  
        dr("Comments") = Comments  
        dt.Rows.Add(dr)  
    End Sub 
 
End Class 
 

The last issue I had with datasets had a fairly simple fix. Hope this is the same.

Regards,
Nic Roche
Dean
Top achievements
Rank 1
 answered on 09 Dec 2009
4 answers
133 views
Hi,

I'm using a RadTreeView with IsDragDropEnabled ="True" and need to limit dragging and dropping for certain items. Tried to attach to 
            RadDragAndDropManager.AddDragQueryHandler(...); 
            RadDragAndDropManager.AddDragInfoHandler(...); 
            RadDragAndDropManager.AddDropQueryHandler(..); 
            RadDragAndDropManager.AddDropInfoHandler(...); 
 
and manipulate with e.QueryResult but it does not take any effect. All the items are allowed to be dragged and dropped anywhere inside the treeview. 

I followed the sample and it does work for the GridView but doesn't on a TreeView.

Thanks,
Ruben.

rubenhak
Top achievements
Rank 1
 answered on 08 Dec 2009
2 answers
125 views
Hi..
1. Do have any examples of Multi Column Combo box in a GridView?
2. How do 'select' or 'set focus' to the combo box so it is visible in a row?
3. How can I pull multiple values from the combo box and populate other columns in the selected Row with the values?

thanks in advance
Jon
Top achievements
Rank 1
 answered on 08 Dec 2009
1 answer
72 views
Hi

I have noticed that there is a difference between Q2 and Q3 on selecting a row;

In the Q2 release, the row becomes selected

  • when the user clicks the leftmost bar which does not have any data
  • when the user clicks on one of the cells in that row

 

In the Q3 release, the row only becomes selected when the user clicks on one of the cells in that row.

This means that the user can no longer drag data from the leftmost column which is probably the most intuitive way to do it. Is there any way to recreate this behavior in Q3?
Milan
Telerik team
 answered on 08 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?