This is a migrated thread and some comments may be shown as answers.

Gridview Visiblity based on ComboBox value & Passing Observable Collection as Converter Parameter

1 Answer 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Prakash
Top achievements
Rank 1
Prakash asked on 04 Jun 2012, 07:34 PM

Hi,

 

I have a requirement

 

Requirement 1# : Inside a Hirerchy Template placed 2 Grids where in

1st grid 3 columns where 1 column has Combo Box loaded with Values.

 

For ex: Football, Disco

 

If i select Football, 2 grid placed inside Hirechy Template should be visible or else visbility of that grid should be collapsed.

How can i solve this.

 

Requirement 2#: Can i pass Observable collection as converter parameter

 

<Radcombobox selecteditem={Binding collection, converter={}} -> to show as like A,B,C (Selected Items as comma separated)

 

<controls:RadGridView Name="clubsGrid" 
                      ItemsSource="{Binding Clubs}" Grid.Row="0" 
                  AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" DataContext="{StaticResource MyViewModel}">
            <controls:RadGridView.ChildTableDefinitions>
                <controls:GridViewTableDefinition/>
            </controls:RadGridView.ChildTableDefinitions>
            <controls:RadGridView.Columns>
                <controls:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                            Header="Est."></controls:GridViewDataColumn>
                <controls:GridViewDataColumn DataMemberBinding="{Binding Established}"></controls:GridViewDataColumn>
            </controls:RadGridView.Columns>
            <controls:RadGridView.HierarchyChildTemplate>
                <DataTemplate                      
                                            <controls:RadGridView Name="playersGrid" 
                                     ItemsSource="{Binding Players}" 
                                     AutoGenerateColumns="False" EnableRowVirtualization="False" EnableColumnVirtualization="False"
                                        <controls:RadGridView.ChildTableDefinitions>
                <controls:GridViewTableDefinition/>
            </controls:RadGridView.ChildTableDefinitions>

                            <controls:RadGridView.Columns>
                                <controls:GridViewDataColumn DataMemberBinding="{Binding Name}">                                    
                                </controls:GridViewDataColumn>
                                <controls:GridViewDataColumn DataMemberBinding="{Binding SelectedItem.Name}">
                                    <controls:GridViewDataColumn.CellEditTemplate>
                                        <DataTemplate>
                                            <RadControls:RadComboBox ItemsSource="{Binding Hobbies, Mode=OneTime}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" SelectedValue="Name" DisplayMemberPath="Name" >                                                
                                            </RadControls:RadComboBox>                                            
                                        </DataTemplate>
                                    </controls:GridViewDataColumn.CellEditTemplate>
                                </controls:GridViewDataColumn>                         
                            </controls:RadGridView.Columns
                                    

<

 

 

telerik:RadGridView.HierarchyChildTemplate>

 

 

 

 

<HierarchicalDataTemplate>

 


                                    <controls:RadGridView Name="Hobbies" 
                                     ItemsSource="{Binding Hobbies}" 
                                     AutoGenerateColumns="True" EnableRowVirtualization="False" EnableColumnVirtualization="False"/>

            
                        </controls:RadGridView>

</

 

 

HierarchicalDataTemplate>

 

 

 

 

</telerik:RadGridView.HierarchyChildTemplate>

 


                                                                </DataTemplate>
            </controls:RadGridView.HierarchyChildTemplate>
        </controls:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Prakash
Top achievements
Rank 1
answered on 05 Jun 2012, 05:39 AM

Hi,

 

I have a requirement

 

Requirement 1# : Inside a Hirerchy Template placed 2 Grids where in

1st grid 3 columns where 1 column has Combo Box loaded with Values.

 

For ex: Football, Disco

 

If i select Football, Hobbies grid should be visible as hirerchy or else hirerchy should not be visible and (+) should not be visible. 

How can i solve this.

 

Requirement 2#: Can i pass Observable collection as converter parameter

 

<Radcombobox selecteditem={Binding collection, converter={}} -> to show as like A,B,C (Selected Items as comma separated)

 

<controls:RadGridView Name="clubsGrid" 
                      ItemsSource="{Binding Clubs}" Grid.Row="0" 
                  AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" DataContext="{StaticResource MyViewModel}">
            <controls:RadGridView.ChildTableDefinitions>
                <controls:GridViewTableDefinition/>
            </controls:RadGridView.ChildTableDefinitions>
            <controls:RadGridView.Columns>
                <controls:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                            Header="Est."></controls:GridViewDataColumn>
                <controls:GridViewDataColumn DataMemberBinding="{Binding Established}"></controls:GridViewDataColumn>
            </controls:RadGridView.Columns>
            <controls:RadGridView.HierarchyChildTemplate>
                <DataTemplate                      
                                            <controls:RadGridView Name="playersGrid" 
                                     ItemsSource="{Binding Players}" 
                                     AutoGenerateColumns="False" EnableRowVirtualization="False" EnableColumnVirtualization="False"
                                        <controls:RadGridView.ChildTableDefinitions>
                <controls:GridViewTableDefinition/>
            </controls:RadGridView.ChildTableDefinitions>

                            <controls:RadGridView.Columns>
                                <controls:GridViewDataColumn DataMemberBinding="{Binding Name}">                                    
                                </controls:GridViewDataColumn>
                                <controls:GridViewDataColumn DataMemberBinding="{Binding SelectedItem.Name}">
                                    <controls:GridViewDataColumn.CellEditTemplate>
                                        <DataTemplate>
                                            <RadControls:RadComboBox ItemsSource="{Binding Hobbies, Mode=OneTime}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" SelectedValue="Name" DisplayMemberPath="Name" >                                                
                                            </RadControls:RadComboBox>                                            
                                        </DataTemplate>
                                    </controls:GridViewDataColumn.CellEditTemplate>
                                </controls:GridViewDataColumn>                         
                            </controls:RadGridView.Columns
                                    

<

 

 

telerik:RadGridView.HierarchyChildTemplate>

 

 

 

 

<HierarchicalDataTemplate>

 


                                    <controls:RadGridView Name="Hobbies" 
                                     ItemsSource="{Binding Hobbies}" 
                                     AutoGenerateColumns="True" EnableRowVirtualization="False" EnableColumnVirtualization="False"/>

            
                        </controls:RadGridView>

</

 

 

HierarchicalDataTemplate>

 

 

 

 

</telerik:RadGridView.HierarchyChildTemplate>

 


                                                                </DataTemplate>
            </controls:RadGridView.HierarchyChildTemplate>
        </controls:RadGridView>
Tags
GridView
Asked by
Prakash
Top achievements
Rank 1
Answers by
Prakash
Top achievements
Rank 1
Share this question
or