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

end-user customize visible columns

5 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 20 Sep 2012, 09:21 PM
Before I write new code, I wonder if it already exists? My end-user wants the ability to select the columns that are to be visible in the grid from a popup list of columns with check boxes next to each column name. They select the columns they want to see.

Does Telerik Silverlight offer something like this OOB?
Thank you

5 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 21 Sep 2012, 05:26 AM
Hello,

 There is no such built-in functionality however we have an example which may help you in your case. 

Regards,
Vlad
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Accepted
Josh
Top achievements
Rank 1
answered on 25 Sep 2012, 09:57 PM
We were easily able to implement something similar to this with the following:

<ListBox ItemsSource="{Binding ElementName=PART_grid, Path=Columns}" MinHeight="150" MaxHeight="150">
     <ListBox.ItemTemplate>
          <DataTemplate>
              <StackPanel Orientation="Horizontal">
                   <CheckBox IsChecked="{Binding Path=IsVisible, Mode=TwoWay}" />
                   <TextBlock Text="{Binding Path=Header.Text}"  />
               </StackPanel>
          </DataTemplate>
     </ListBox.ItemTemplate>
</ListBox>


It's worth noting that the all of our headers are TextBlocks. 
0
Marcel
Top achievements
Rank 1
answered on 26 Sep 2012, 10:50 PM
Hi Josh, Vlad

Vlad, the example you showed was good but the code is abstracted away. Can you provide the code?

Thanks Josh - it's working. My listbox was not showing the column names - I had to remove '.Text' from the pasted line.

<TextBlock Text="{Binding Path=Header.Text}" 
0
Vlad
Telerik team
answered on 27 Sep 2012, 05:27 AM
Hello,

 I'm not sure I understand. Have you checked the code of the demo? You can click the "code" button in the top right part of the demo. 

Greetings,
Vlad
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Marcel
Top achievements
Rank 1
answered on 27 Sep 2012, 03:03 PM
Hi Vlad,
You were right - all the code was there and I got it working on my end. This is a very nice solution. THANK YOU.

For anyone intertested, I couldn't find a way to copy the code from the online example, BUT the code is available on your hard drive in the demos\examples folders.
Tags
GridView
Asked by
Marcel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Josh
Top achievements
Rank 1
Marcel
Top achievements
Rank 1
Share this question
or