Telerik Forums
UI for WPF Forum
3 answers
228 views

Hi,

I am having some problems with RadTreeView.ExpandItemByPath(...). It does not do anything when I call it.

I guess the problem is that  I did not set headers for the listviewitems, but when I try to set it with the commented setter, the name does not get displayed.

Below you can see the (stripped) XAML for my ListView:

<telerik:RadTreeView ItemsSource="{Binding Items}">
                            
               <telerik:RadTreeView.ItemContainerStyle>
                   <Style TargetType="telerik:RadTreeViewItem">
                       <!--<Setter Property="Header" Value="{Binding Path=Item, Converter={StaticResource ClientTreeItemToTextConverter}}"/>-->
                       <Setter Property="IsDropAllowed" Value="{Binding IsDropAllowed, Mode=TwoWay}"/>
                       <Setter Property="IsLoadOnDemandEnabled" Value="{Binding IsLoadOnDemandEnabled, Mode=TwoWay}"/>
                       <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                       <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                    </Style>
               </telerik:RadTreeView.ItemContainerStyle>
 
               <telerik:RadTreeView.ItemTemplate>
                   <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                       <StackPanel Orientation="Horizontal" Margin="2">
                           <Image Margin="0 0 4 0" Source="{Binding Path=Item.Type, Converter={StaticResource NodeTypeToImageConverter}}" VerticalAlignment="Center"/>
                           <TextBlock Text="{Binding Path=Item, Converter={StaticResource ClientTreeItemToTextConverter}}" VerticalAlignment="Center"/>
                       </StackPanel>
                   </HierarchicalDataTemplate>
               </telerik:RadTreeView.ItemTemplate>
 
          </telerik:RadTreeView>
Petar Mladenov
Telerik team
 answered on 23 Aug 2011
10 answers
475 views
Hi,

Could you please tell me what the best way to validating the form is? (and displaying error messages/highlighting fields)

Many thanks,
Daryl
Marcelo
Top achievements
Rank 1
 answered on 23 Aug 2011
11 answers
513 views

Hi

I posted that as a support ticket, but if you have an answer for me, feel frre to give it, thank you very much. I'll paste the answer form the support.


 

I am testing your product. I am trying to make a nested hierarchy inside a radGridView. My code is inspired from both the Getting started documentation and an example you gave about nested hierarchy. Please, see the attached project.

 

My goal is to show a list of Divisions in a gridView, each division has teams, and each team has some employees.

 

I have an Employee class:

 

    public class Employee

    {

        public string FirstName

        {

            get;

            set;

        }

        public string LastName

        {

            get;

            set;

        }

        public int Age

        {

            get;

            set;

        }

        public bool Married

        {

            get;

            set;

        }

 

    }

 

 

A team class who has a collection of employees:

 

public class Team

    {

        private ObservableCollection<Employee> _empl = new ObservableCollection<Employee>();

 

        public ObservableCollection<Employee> Empl

        {

            get

            { return _empl; }

 

            set

            { _empl = value; }

        }

 

 

        public int Ident

        {

            get;

            set;

        }

        public string Nom

        {

            get;

            set;

        }

        public int Place

        {

            get;

            set;

        }

 

    }

 

 

A division class who has a list of teams:

    public class Division

    {

        public int Id

        {

            get;

            set;

        }

        public string Name

        {

            get;

            set;

        }

        public List<Team> Teams

        {

            get;

            set;

        }

 

    }

 

And a DivisionService class, who creates a collection of divisions, populating each division with some teams and some teams with some employees. Here is an excerpt of the class:

 

   public class DivisionsService

    {

        public static ObservableCollection<Division> GetDivisions()

        {

ObservableCollection<Division> divisions = new ObservableCollection<Division>();

            Division dA = new Division();

            dA.Name = "Division A";

            dA.Id = 1;

            dA.Teams = new List<Team>();

            Team team1 = new Team();

            team1.Ident = 1;

            team1.Nom = "Team I";

            team1.Place = 1;

            Employee emp01 = new Employee();

            emp01.FirstName = "Maria";

            emp01.LastName = "Anders";

            emp01.Married = true;

            emp01.Age = 24;

            team1.Empl.Add(emp01);

            Employee emp02 = new Employee();

            emp02.FirstName = "Klodia";

            emp02.LastName = "Choufleur";

            emp02.Married = false;

            emp02.Age = 28;

            team1.Empl.Add(emp02);

            dA.Teams.Add(team1);

 

            Team team2 = new Team();

            team2.Ident = 2;

            team2.Nom = "Team II";

            team2.Place = 2;

            Employee emp03 = new Employee();

            emp03.FirstName = "Jean";

            emp03.LastName = "Bon";

            emp03.Married = true;

            emp03.Age = 44;

            team2.Empl.Add(emp03);

 

            dA.Teams.Add(team2);

 

          (code here)

           

           return divisions;

        }

    }

 

 

The XAML creates the gridview and the data template:

 

<Window x:Class="TestRadGridView.MainWindow"

                           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="MainWindow" Height="350" Width="525">

             <Grid>

        <telerik:RadGridView x:Name="HierarchicalGridView"

                             AutoGenerateColumns="False"

                             MinHeight="386">

 

 

 

            <telerik:RadGridView.Columns>

                <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}"

                                       Header="Id" />

                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"

                                       Header="Name" />

            </telerik:RadGridView.Columns>

 

            <telerik:RadGridView.HierarchyChildTemplate>

                <DataTemplate>

                    <telerik:RadGridView

                        Name="teamGrid"

                        ShowGroupPanel="False"

                        AutoGenerateColumns="False">

                        <telerik:RadGridView.Columns>

                            <telerik:GridViewDataColumn

                                Header="Id"

                                DataMemberBinding="{Binding Ident}"/>

                            <telerik:GridViewDataColumn

                                Header="Nom"

                                DataMemberBinding="{Binding Nom}"/>

                            <telerik:GridViewDataColumn

                                Header="Place"

                                DataMemberBinding="{Binding Place}"/>

                        </telerik:RadGridView.Columns>

                        <telerik:RadGridView.HierarchyChildTemplate>

                            <DataTemplate>

                                <telerik:RadGridView

                                    Name="employeesGrid"

                                    ShowGroupPanel="False">

                                </telerik:RadGridView>

                            </DataTemplate>

                        </telerik:RadGridView.HierarchyChildTemplate>

                    </telerik:RadGridView>

                </DataTemplate>

            </telerik:RadGridView.HierarchyChildTemplate>

 

        </telerik:RadGridView>    

    </Grid>

</Window>

 

 

And the code behind the data binding and the relations:

 

       public MainWindow()

        {

            InitializeComponent();

 

            GridViewTableDefinition TeamsTableDefinition = new GridViewTableDefinition();

            TeamsTableDefinition.Relation = new PropertyRelation("Teams");

            this.HierarchicalGridView.TableDefinition.ChildTableDefinitions.Add(TeamsTableDefinition);

 

            GridViewTableDefinition emplTableDefinition = new GridViewTableDefinition();

            emplTableDefinition.Relation = new PropertyRelation("empl");

            TeamsTableDefinition.ChildTableDefinitions.Add(emplTableDefinition);

 

 

            this.HierarchicalGridView.ItemsSource = DivisionsService.GetDivisions();

 

        }

 

 

So, it does not work: I see the divisions, but there are no teams (and of course I can’t see is there are employees in the teams).

 

If I delete, in the XAML code, the data template, things are a little better: I see Teams in the divisions, but I do not see Employees in teams. Anyway, I need the data template.

 

So, what I did wrong?

 

 

Could-you too, please, say how to access a selected item in a nested grid? Thank you again.

 

Cordially

 

Richard

Richard
Top achievements
Rank 1
 answered on 23 Aug 2011
4 answers
956 views
Hi, I am prototyping with radgridview and am not very wpf experienced. I have a simple problem I can't solve and am hoping someone can give me a hint.

<telerik:RadGridView x:Name="Navigation"
                    AutoGenerateColumns="False"
                    ItemsSource="{StaticResource data}"
                    >

"data" is an ObservableCollection and I was expecting the grid to update, when the collection gets updated. Data already in the list after initialisation is shown. I guessed this does not work, as its a StaticResource, but with DynamicResource it also does not work.

However if i use c# code it works:

this.Navigation.ItemsSource = this.data;

Now its obvious to me I am doing something wrong with the ItemsSource in xaml, but I just have no clue what I should be doing...
marc
Top achievements
Rank 1
 answered on 23 Aug 2011
1 answer
112 views
Hi, How can I add the item template i create from the ResourceTypeTemplateSelector? 

All I wanted is that when  i click on a certain tab, a radgrid will appear. thanks
Tina Stancheva
Telerik team
 answered on 23 Aug 2011
1 answer
170 views
Hello,

We are currently using the gridview along with a chart control.  When a selection is made on the chart control, we select the cells in the gridview that are related (which amounts to all the cells in a particular column) and then use:


Grid1.ScrollIntoView(cell2Select, cell2Select.DataColumn);

 



We would like to expand this so that the selected column of cells moves directly underneath the selection made on the chart.  Is this possible?

Thanks,
Derek

Dimitrina
Telerik team
 answered on 23 Aug 2011
3 answers
117 views
Hey, on RadGridView with scrollbars and DragAndDrop query/info - when I try to scroll - Drag tooltip appears (OnDragQuery) preventing normal scrolling.

e.Options.Source is RadGridView, how to filter scrollbars out of DragDrop when scrolling content of RadGridView?

Thanks,
Alex
Tsvyatko
Telerik team
 answered on 23 Aug 2011
1 answer
124 views
Hello everybody

There is a standard way to set the maximum level of row nesting? For example two or three levels max.
I hope you can help me.

Best regards
Jorge
Dimitrina
Telerik team
 answered on 23 Aug 2011
1 answer
141 views
Hello,

Can you please attach/supply a simple example of a RadGrid having RadComboBox, RadButton on its cells/rows? Thanks!
I badly need it. Thank you!
Vera
Telerik team
 answered on 23 Aug 2011
5 answers
304 views
I have setup a basic RadGridView in WPF, and applied the metro theme to it.

When I try and apply a filter to any column in the GridView it throws a DynamicResourceExtension error the second time the filter is selected.
This ONLY happens when using the Metro UI theme on the RadGridView and happens in several examples that I tested this on.

The basic error message thrown is:
{"A 'DynamicResourceExtension' cannot be set on the 'BasedOn' property of type 'Style'. A 'DynamicResourceExtension' can only be set on a DependencyProperty of a DependencyObject."}
Vanya Pavlova
Telerik team
 answered on 23 Aug 2011
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
PersistenceFramework
DataPager
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?