Telerik Forums
UI for WinForms Forum
2 answers
92 views
Hi,

Does the Winform Telerik Grid Supports displaying hierachial data from object collection.

I can give you a simple example in our application we have a Customer class which has Firstname and Surname and a List of Address details. The Address is a separate class which have properties like Town,Postcode and all

Customer
{
    string FirstName;
    string Surname;
    List<Address> Addresses;
}

the requirement is to display the customer forename and surname only in the main row and the list of address in the child table.

Does the winform grid supports displaying the above scenario?
Julian Benkov
Telerik team
 answered on 14 Jul 2010
1 answer
80 views

Hi,

I'm working radGridView control for displaying self referencial and hierarchal data, i'm using the latest telerik binaries (i.e.WPF Q1 2010 SP2).

With my current code, this displays as:

Task 1
-- Task101
-- Task102
Task 2
-- Task201
-- Task202
Task101
Task102
Task201
Task202

I dont want to display Task101,Task102,Task201,Task202 in the main hirerarchy list, as those are the childs to Task1 and Task2

Code Pasted Below:

XAML:

 <Grid>
        <telerik:RadGridView x:Name="RadGridView1"
             DataLoading="RadGridView1_DataLoading" RowLoaded="RadGridView1_RowLoaded" GridLinesVisibility="Horizontal"
            CanUserFreezeColumns="False" IsReadOnly="True" AutoGenerateColumns="False"  >

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn  DataMemberBinding="{Binding TaskId}"  />
               
                <telerik:GridViewDataColumn Header="Task Name" DataMemberBinding="{Binding TaskName}" />

                <telerik:GridViewDataColumn Header="Read">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="checkBoxRead" IsChecked="{Binding Read}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewDataColumn>

                <telerik:GridViewDataColumn Header="Write">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="checkBoxWrite" IsChecked="{Binding Write}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewDataColumn>

            </telerik:RadGridView.Columns>

            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition>
                    <telerik:GridViewTableDefinition.Relation  >
                        <telerik:TableRelation IsSelfReference="True" >
                            <telerik:TableRelation.FieldNames>
                                <telerik:FieldDescriptorNamePair
                                    ParentFieldDescriptorName="TaskId"
                                    ChildFieldDescriptorName="ParentTaskId" />
                            </telerik:TableRelation.FieldNames>
                        </telerik:TableRelation>
                    </telerik:GridViewTableDefinition.Relation>
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>

        </telerik:RadGridView>
    </Grid>

 

 

 

 

 

 

 

 

 

.CS Code:

/// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //RadGridView1. .MasterTableView.FilterExpression = "ParentID = 0";
            RadGridView1.ItemsSource = GetTasks();
           
        }

 

        private List<Task> GetTasks()
        {
            List<Task> tasks = new List<Task>();

            tasks.Add(new Task { TaskId = 1, TaskName = "Task1", Read = true, Write = true, ParentTaskId = 0 });
            tasks.Add(new Task { TaskId = 2, TaskName = "Task2", Read = false, Write = true, ParentTaskId = 0 });

            tasks.Add(new Task { TaskId = 101, TaskName = "Task101", Read = true, Write = true, ParentTaskId = 1 });
            tasks.Add(new Task { TaskId = 102, TaskName = "Task102", Read = false, Write = false, ParentTaskId = 1 });

            tasks.Add(new Task { TaskId = 201, TaskName = "Task201", Read = true, Write = true, ParentTaskId = 2 });
            tasks.Add(new Task { TaskId = 202, TaskName = "Task202", Read = false, Write = false, ParentTaskId = 2 });

            //tasks.Add(new Task { TaskId = 1011, TaskName = "Task1011", Read = true, Write = false, ParentTaskId = 101 });

         
            return tasks;
        }

        private bool HasSubTasks(Task currentTask)
        {
            return
            (from task in (IEnumerable<Task>)this.RadGridView1.ItemsSource
             where task.ParentTaskId == currentTask.TaskId
             select task).Any();
        }

        private void RadGridView1_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
        {

            GridViewRow row = e.Row as GridViewRow;
            Task currentTask = e.DataElement as Task;

            if (row != null && currentTask != null)
            {
                row.IsExpandable = this.HasSubTasks(currentTask);
            }
        }

        private void RadGridView1_DataLoading(object sender, GridViewDataLoadingEventArgs e)
        {
            GridViewDataControl dataControl = (GridViewDataControl)sender;

            if (dataControl.ParentRow != null)
            {
                dataControl.ShowGroupPanel = false;
                dataControl.AutoGenerateColumns = false;
                dataControl.CanUserFreezeColumns = false;
                dataControl.IsReadOnly = false;
                dataControl.ChildTableDefinitions.Clear();

                GridViewDataColumn column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("TaskId");
                dataControl.Columns.Add(column);

                column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("TaskName");
                dataControl.Columns.Add(column);

                column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("Read");
                dataControl.Columns.Add(column);

                column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("Write");
                dataControl.Columns.Add(column);
            }

        }
    }

    public class Task
    {
        public int TaskId { get; set; }
        public string TaskName { get; set; }
        public bool Read { get; set; }
        public bool Write { get; set; }

        public int ParentTaskId { get; set; }

    }

 

Thanks,
-Narendra

Veselin Vasilev
Telerik team
 answered on 14 Jul 2010
1 answer
45 views
In Step-by-step Tutorial – RadControls for WinForms
I open Telerik_RadControls_for_WinForms_VS_Projects\RealEstate\CS\UserDock\UserDock project
Why can't I add the usercontrl ,CalendarPanel, to toolbox?
Nikolay
Telerik team
 answered on 13 Jul 2010
8 answers
283 views
Can I create to EditAppointmentDialog for me ?


Dobry Zranchev
Telerik team
 answered on 13 Jul 2010
1 answer
109 views
Hi,

We are using Telerik Version 2009.3.9.1203. In that, We are also using the Scheduler control in our project. As per our requirement, the user can block some particular time in the day. In that case, we need to highlight that time in different color in the Scheuduler Calendar. But, right now, the scheduler allows me to differentiate only the Working time and Non Working time in the day.

Can you please help us on solving this.

Dobry Zranchev
Telerik team
 answered on 13 Jul 2010
1 answer
54 views
i have a c# project , i need to modify the entire project to the telerik visual style controls.
please help me...
Boryana
Telerik team
 answered on 13 Jul 2010
1 answer
106 views
Hi,
I have hosted the create/edit  appointment telerik control in window form. I want to display the popup at the center of the screen when it opens but i am unable to do so.
Please provide any assistence

Thanks & Regards,
Rahul
Dobry Zranchev
Telerik team
 answered on 13 Jul 2010
1 answer
322 views
Hello,
I have problem with RadGridView. I would like to select more than one rows in grid so I change MultiSelect to true. I click 5 rows (ctrl+left mouse), and now i would like to deselect f.e 2 and 4. I click rows 2 and 4 (ctrl+left mouse), finally program unselect this rows but user cannot see this in rows nr.4 (image). I try to change it in Visual Style Builder but, only I find how to change GridDataRowElement.IsCurrent to blue, and GridDataRowElement.IsSelected to yellow. I want to get colors like :
When rows is Select and current -> yellow
When rows is Unselect and current -> white

So finally :
first click (ctrl + left) -> select row(yellow)
double click (ctrl + left) -> unselect row(white)

Any idea to solve this problem?
Thanks for help !!!
    Marcin
Stefan
Telerik team
 answered on 13 Jul 2010
7 answers
105 views
Hi:

Somehow when I install Q2.2010 Beta Winforms it doesn't install the documentation help files.
I have installed and uninstalled nubmer of times but no help...
Is it possilbe if Telerik can provide the standalone documentation ????
Without documentation its just useless...

IK
Nikolay
Telerik team
 answered on 13 Jul 2010
1 answer
117 views
when is Telerik.WinControls.Themes.ControlDefault.dll needed?  do all the controls function and look the same without it?  I'm running Telerik WinForms v2010.1.409
Nikolay
Telerik team
 answered on 13 Jul 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Barcode
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Licensing
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? 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?