Telerik Forums
UI for WinForms Forum
1 answer
108 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
61 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
324 views
Can I create to EditAppointmentDialog for me ?


Dobry Zranchev
Telerik team
 answered on 13 Jul 2010
1 answer
135 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
77 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
121 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
355 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
123 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
143 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
1 answer
189 views

Hello.. how are you..

i have the next scene.. i have a grid nest into the other grid i am using the tools to export of telerik.. its a example:

 

public

 

void Export(String sFilepath, RadGridView grvExportExcel)

 

{

 

ExportToExcelML exporter = new ExportToExcelML(grvExportExcel);

 

exporter.SummariesExportOption =

SummariesOption.ExportAll;

 

exporter.RunExport(sFilepath);

 

}

but its doesn't work .. when i run this function its make the file succesfully but only export the primary grid and the template not...
i need export all information of the grid... if somebody can help me.. i will pleasure.. for your help.

 

 

public void Export(String sFilepath, GridViewTemplate grvtExportExcel)

 

{

 

RadGridView rgvGrid = new RadGridView();

 

 

foreach (GridViewDataColumn c in grvtExportExcel.Columns)

 

{

rgvGrid.Columns.Add(c);

}

 

foreach (GridViewDataRowInfo d in grvtExportExcel.Rows)

 

{

rgvGrid.Rows.AddNew(d);

}

ExportToExcelML exporter = new ExportToExcelML(rgvGrid);

 

exporter.SummariesExportOption = SummariesOption.ExportAll;

 

exporter.RunExport(sFilepath);

}

 

}

but its doesn't work neither....

regards...
thanks for your help.

Martin Vasilev
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)
Form
Chart (obsolete as of Q1 2013)
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
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?