Mike Hanson
Top achievements
Rank 1
Mike Hanson
asked on 06 Aug 2008, 03:39 PM
Is it possible to disable the horizontal scrolling on the RadTreeView?
am using the tree control to create Gantt View with a table and chart. I want to handle horizontal scrolling myself so that I can scroll the two side seperately. I have created controls for the row in the view that are split and have their own ScrollViewers that I control programatically but the treeview is adding it's own horizontal scrollbar when the content exceeds the width of the page.
I have tried setting the static properties ScrollViewer properties but this throws an exception
Mike
am using the tree control to create Gantt View with a table and chart. I want to handle horizontal scrolling myself so that I can scroll the two side seperately. I have created controls for the row in the view that are split and have their own ScrollViewers that I control programatically but the treeview is adding it's own horizontal scrollbar when the content exceeds the width of the page.
I have tried setting the static properties ScrollViewer properties but this throws an exception
ScrollViewer.HorizontalScrollBarVisibility
="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Is there another way to do it?Mike
10 Answers, 1 is accepted
0
Hi Mike,
For the moment you can not do it from the XAML, but you can use the ScrollViewer property of RadTreeView and to configure it. Let me know how it goes.
Sincerely yours,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
For the moment you can not do it from the XAML, but you can use the ScrollViewer property of RadTreeView and to configure it. Let me know how it goes.
Sincerely yours,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike Hanson
Top achievements
Rank 1
answered on 06 Aug 2008, 04:50 PM
Tried that in the Loaded event of the UserControl and in the Loaded event of the TreeView but in both cases I get a NullReferenceException when accessing the ScrollViewer property.
Any suggestions?
Any suggestions?
0
Accepted
Valio
Top achievements
Rank 1
answered on 06 Aug 2008, 08:44 PM
Hello Mike,
The ScrollViewer property is initialized once the template for the TreeView has been applied. You can use the following code as a reference:
public partial class FirstLook : UserControl |
{ |
public FirstLook() |
{ |
InitializeComponent(); |
RadTreeView1.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged); |
} |
void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) |
{ |
if (RadTreeView1.ItemContainerGenerator.Status == Telerik.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) |
{ |
if (RadTreeView1.ScrollViewer != null) |
{ |
RadTreeView1.ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; |
} |
} |
} |
} |
Best Regards,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike Hanson
Top achievements
Rank 1
answered on 07 Aug 2008, 09:16 AM
That worked perfectly to hide the scrollbar of the TreeView, thanks.
At first I thought this was what is needed but although the scrollbar is hidden or disabled (as set) but it still allows the contents to stretch to a width that means my own ViewScrollers are never activated so not quite what I need.
Will let you know if I get any further.
At first I thought this was what is needed but although the scrollbar is hidden or disabled (as set) but it still allows the contents to stretch to a width that means my own ViewScrollers are never activated so not quite what I need.
Will let you know if I get any further.
0
Hello Mike,
I'm not sure what real situation is, but let us know if we can help you in this scenario.
Greetings,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm not sure what real situation is, but let us know if we can help you in this scenario.
Greetings,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike Hanson
Top achievements
Rank 1
answered on 07 Aug 2008, 01:12 PM
I guess what I am looking for is a way to make the RadTreeView take up the whole width of the area it is given (in my case the whole width of the browser). However when an item is wider than the width of the browser, I don't want the treeview to use it's scrollbars because the items have their own.
I can't share the code I am working on here, but I could post it with a support ticket if it helps
Mike
I can't share the code I am working on here, but I could post it with a support ticket if it helps
Mike
0
Hello Mike,
Maybe in this case you better change the control template of the RadTreeView and remove the ScrollViewer at all?
Greetings,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Maybe in this case you better change the control template of the RadTreeView and remove the ScrollViewer at all?
Greetings,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike Hanson
Top achievements
Rank 1
answered on 07 Aug 2008, 01:34 PM
Unfortunately that is not an option. The control used for the template is a GanttRow which is split with a table on the left side and a graph on the right side.
What I am trying to achieve (in a quick and dirty fashion because of time scales) is create a split view. Each GanttRow has two scroll viewers one around the table and one around the graph, in a containing GanttView I have managed to synchronise horizontal scrolling of the table part, but cannot do so with the right side because the scrollviewer around it never activates because the treeview is making as much space as it needs available.
I am just about to try programattically setting a fixed width on each GanttRow that is less than the page width.
I did say it was quick and dirty?
What I am trying to achieve (in a quick and dirty fashion because of time scales) is create a split view. Each GanttRow has two scroll viewers one around the table and one around the graph, in a containing GanttView I have managed to synchronise horizontal scrolling of the table part, but cannot do so with the right side because the scrollviewer around it never activates because the treeview is making as much space as it needs available.
I am just about to try programattically setting a fixed width on each GanttRow that is less than the page width.
I did say it was quick and dirty?
0
Mike Hanson
Top achievements
Rank 1
answered on 07 Aug 2008, 01:56 PM
Solved the problem with code:-)
In the SizeChanged event of the outer control I iterate through all the GanttRow items and set them to the width of the RadTreeView minus the width of the Expander. This then deactivates the ScrollViewer of the RadTreeView and lets the GanttRow handle it's own scrolling.
Thanks for all your help
Mike
In the SizeChanged event of the outer control I iterate through all the GanttRow items and set them to the width of the RadTreeView minus the width of the Expander. This then deactivates the ScrollViewer of the RadTreeView and lets the GanttRow handle it's own scrolling.
Thanks for all your help
Mike
0
Hi Mike,
I'm glad you were able to achieve the scenario - I was just wondering what else to propose as a solution :)
Best wishes,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm glad you were able to achieve the scenario - I was just wondering what else to propose as a solution :)
Best wishes,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.