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

TreeView WPF + Load on Demand

2 Answers 155 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
LAURIO
Top achievements
Rank 2
LAURIO asked on 20 Feb 2009, 09:34 AM
Hi all,

Excuse for my poor english, i'm a french user. We planned to buy Telerik WPF components to use them in our VS 2008 projects, but i need to check first if they're fully compatible with my actual code.

I followed an article from Code Project, using theViewModelPattern to feed my treeview. That's ok with the basic treeview from vs 2008, but the basic treeview doesn't implement Drag and drop operations, so i have to test yours. I would like to use your treeview instead of microsoft one but without rewriting my code behind and classes, just by rewriting my xaml.I have tried a lot of thing but i couldn't manage to plug my actual code with your treeview.

My "classic" code working with microsoft treeview:

<UserControl  
  x:Class="Window2" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:local="clr-namespace:XXX.XXX.LoadOnDemand" Background="Transparent"
    <DockPanel> 
        <TextBlock DockPanel.Dock="Bottom" TextWrapping="Wrap" FontSize="12"
        
            <Image Source="/XXX;component/LoadOnDemand/Images/logo.png" Height="120" Width="160"></Image> 
        </TextBlock> 
         
        <TreeView ItemsSource="{Binding Regions}" Background="Transparent" BorderThickness="0" x:Name="MonTreeview"
              
            <TreeView.ItemContainerStyle> 
                <!-- 
        This Style binds a TreeViewItem to a TreeViewItemViewModel. 
        --> 
                <Style TargetType="{x:Type TreeViewItem}"
                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /> 
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /> 
                    <Setter Property="FontWeight" Value="Normal" /> 
                    <Style.Triggers> 
                        <Trigger Property="IsSelected" Value="True"
                            <Setter Property="FontWeight" Value="Bold" /> 
                        </Trigger> 
                    </Style.Triggers> 
                </Style> 
            </TreeView.ItemContainerStyle> 
 
            <TreeView.Resources> 
                <HierarchicalDataTemplate  
          DataType="{x:Type local:affaireModel}"  
          ItemsSource="{Binding Children}" 
          > 
                    <StackPanel Orientation="Horizontal"
                        <Image Width="16" Height="16" Margin="3,0" Source="Images\Region.png" /> 
                        <TextBlock Text="{Binding AffaireName}" /> 
                    </StackPanel> 
                </HierarchicalDataTemplate> 
 
                <HierarchicalDataTemplate  
          DataType="{x:Type local:StateViewModel}"  
          ItemsSource="{Binding Children}" 
          > 
                    <StackPanel Orientation="Horizontal"
                        <Image Width="16" Height="16" Margin="3,0" Source="Images\State.png" /> 
                        <TextBlock Text="{Binding ChapitreAffaireName}" /> 
                    </StackPanel> 
                </HierarchicalDataTemplate> 
 
                <DataTemplate DataType="{x:Type local:maTacheModel}"
                    <StackPanel Orientation="Horizontal"
                        <Image Width="16" Height="16" Margin="3,0" Source="Images\City.png" /> 
                        <TextBlock Text="{Binding TacheName}" /> 
                    </StackPanel> 
                </DataTemplate> 
            </TreeView.Resources> 
        </TreeView> 
        <Label Height="66" Name="Label1" Width="149">Label</Label> 
    </DockPanel> 
</UserControl> 
 

Is it possible for me to use your treeview just by rewriting my xaml, without changing any of my classes?


Thanks for your reply. I've already try the carousel component and the grid view too, i'm fully satisfied.

2 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 21 Feb 2009, 08:30 AM
Hello Laurio

Attached, you can find an example where the "Load on Demand" mechanism is demonstrated.
Please give it a try and let me know if I can assist you further.

If you are specifically interested in RadTreeView and especially in the load on demand please check following articles:
How to Databind RadTreeView in WPF
Silverlight TreeView Load on Demand
RadControls for Silverlight Demo with ADO.NET Data Services

Please note there are some glitches with the Drag&Drop in our last release and we will definitely address them with the upcoming Q1 release due in March.

Regards
Ivan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
LAURIO
Top achievements
Rank 2
answered on 23 Feb 2009, 08:17 AM
Hi,

I'll try this as soon as i can, i'll make you a reply about the issue. Thanks a lot, have a good day


Tags
TreeView
Asked by
LAURIO
Top achievements
Rank 2
Answers by
Ivan
Telerik team
LAURIO
Top achievements
Rank 2
Share this question
or