Telerik Forums
UI for WPF Forum
4 answers
305 views
Hi

My RadTreeView's are in a HiearchicalDataTemplate so the number of TreeViews is not known at design time.

I need to handle the ContextMenu's click event on a RadTreeViewItem but obviously I cannot just write RadTreeView.AddHandler

Does anyone have an alternative idea?

Thanks.

<Grid>
    <Grid.Resources>
            <Style x:Key="ItemContainerStyle" TargetType="{x:Type telerik:RadTreeViewItem}">
                <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
            </Style>
             
            <HierarchicalDataTemplate
                x:Key="TreeViewItemTemplate"
                ItemsSource="{Binding TreeViewItemChildren}">
                <StackPanel Orientation="Horizontal">
                    <telerik:RadContextMenu.ContextMenu>
                        <telerik:RadContextMenu>
                            <telerik:RadMenuItem Header="Add to bookmarks" />
                        </telerik:RadContextMenu>
                    </telerik:RadContextMenu.ContextMenu>
                    <Image Margin="0,0,2,0" Height="16" Width="16">
                        <Image.Style>
                            <Style TargetType="Image">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IconType}" Value="Folder">
                                        <Setter Property="Source" Value="{StaticResource Folder}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding IconType}" Value="MultiPubReport">
                                        <Setter Property="Source" Value="{StaticResource MultiPubReport}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding IconType}" Value="SinglePubReport">
                                        <Setter Property="Source" Value="{StaticResource SinglePubReport}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding IconType}" Value="Publication">
                                        <Setter Property="Source" Value="{StaticResource Publication}"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Image.Style>
                    </Image>
                    <TextBlock Text="{Binding Name}"></TextBlock>
                </StackPanel>
            </HierarchicalDataTemplate>
             
            <HierarchicalDataTemplate x:Key="TreeViewTemplate">
                <telerik:RadTreeView
                    x:Name="ReportsTreeView"                   
                    ItemsSource="{Binding TreeViewItemChildren}"
                    ItemTemplate="{StaticResource TreeViewItemTemplate}"
                    IsLineEnabled="True"
                    IsDragDropEnabled="True"
                    PreviewDragEnded="ReportsTreeView_PreviewDragEnded"                   
                    SelectionMode="Single"
                    ItemContainerStyle="{StaticResource ItemContainerStyle}">
                </telerik:RadTreeView>
            </HierarchicalDataTemplate>
             
            <HierarchicalDataTemplate
                x:Key="PanelBarItemTemplate"
                ItemsSource="{Binding TreeViewItemViewModels}"
                ItemTemplate="{StaticResource TreeViewTemplate}" >
                <TextBlock Text="{Binding Name}"></TextBlock>
            </HierarchicalDataTemplate>
             
        </Grid.Resources>
         
        <telerik:RadPanelBar
            x:Name="ReportMenu"            
            ExpandMode="Multiple"
            ItemTemplate="{StaticResource PanelBarItemTemplate}"
            VerticalAlignment="Top">
        </telerik:RadPanelBar>
             
    </Grid>
Ryan
Top achievements
Rank 1
 answered on 07 Feb 2011
4 answers
152 views

private
void gridView_Sorting(object sender, GridViewSortingEventArgs e)
 {
    try
    {
       if (schedules == null)
       {
          e.Cancel = true;
          return;
       }
 
 
       if (e.OldSortingState == SortingState.Ascending)
       {
          e.NewSortingState = SortingState.Descending;
          schedules = schedules.OrderByDescending(s => s.Role).ThenBy(s => s.Name).ToList();
       }
       else if (e.OldSortingState == SortingState.Descending)
       {
          schedules = schedules.OrderByDescending(s => s.Name).ToList();
          e.NewSortingState = SortingState.None;
       }
       else
       {
          e.NewSortingState = SortingState.Ascending;
          schedules = schedules.OrderBy(s => s.Role).ThenBy(s => s.Name).ToList();
       }
       this.radDataPager.Source = schedules;
       //e.DataControl.ItemsSource = this.radDataPager.Source;  // replaced by the next line which is the same thing.
       this.gridView.ItemsSource = this.radDataPager.Source;
       this.gridView.Items.Refresh();
 
       this.radDataPager.PageIndex = 0;
       e.Cancel = true;
    }
    catch (Exception ex)
    {
       txtStatus.Text = "Erorr in gridView_Sorting:"+ex.Message;
    }
 }
Custom Sorting (routine shown above) of GridView with DataPager does not seem to work.
It shows sorted items on the current page but it does not navigate to another page.

Can you provide small sample code that works?

Thanks.
gureumi
Top achievements
Rank 1
 answered on 07 Feb 2011
15 answers
266 views
Anyone know of a control developer who has a HTML RichTextBoc for WPF?

Bryan
Iva Toteva
Telerik team
 answered on 07 Feb 2011
1 answer
65 views
I am using version 2010.3.1110.40.

I have a RadTransitionControl that switches between two usercontrols through the bound content property. The switching works fine, however I have noticed that the top level bindings in both the usercontrols are not being set. To get things to work I have to set the binding in the code in the loaded event. I have even set a breakpoint on the get part of the bound collection and saw that it is not read at all. However, if I take the same usercontrol and place it by itself in the xaml then the breakpoint is hit during the xaml loading as it should be.
George
Telerik team
 answered on 07 Feb 2011
1 answer
107 views
Hi

I've got an app that makes extensive use of the RadDocking system. I'm implmenting some drag and drop functionality, and this works fine when dropping an item onto a docked pane, but not onto a floating pane. Is this a known bug?

If so, when is it due to be fixed? 

Thanks
Tom Davies
Tsvyatko
Telerik team
 answered on 07 Feb 2011
1 answer
91 views
Hi,
I need to add new row in a grid at the time of edit last row in the grid.
Thanks,
Sudeep
Maya
Telerik team
 answered on 07 Feb 2011
2 answers
109 views
Hi,

Please find the attached image, mentioning the requirement, that I want in Telerik RadGridView, with the other columns, this is one of them.

Please provide a working code for the same, as soon as possible.

Thanks.

Manishkumar
Top achievements
Rank 1
 answered on 07 Feb 2011
1 answer
84 views
Is possible to recognize whitch dialog is going to be displayed in ShowDialog event? I´d like to enable only Delete dialog to be displayed and to disable all other dialogs by e.Cancel = true.
Pavel
Top achievements
Rank 1
 answered on 05 Feb 2011
9 answers
268 views
Is there a way to add extra controls to the ScheduleView toolbar (where "Month", "Week", "Day" buttons are shown) ? I would like to add a combobox to help drive the behavior of the schedule. I know I can add this above the ScheduleView but I am trying to conserve on space.

Thanks,
Rod
Chris
Top achievements
Rank 1
 answered on 05 Feb 2011
3 answers
169 views
Hi,

   I'm using RADMap control for WPF to plot the pins based on set of Lats and Longs. But, i need the Optimum Zoomlevel to display in Map. For this i use Setview() method of the rad map. By doing this i always get the Zoomlevel to 1. But, when i click on the button event, the Zoomlevel is setting correctly even if the debug says Zoomlevel =1. Please find my below code and let me know how should i proceed.

MainWindow.xaml
==============
 <Window x:Class="RadMapControlStudy.MainWindow"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
Title="MainWindow" Height="600" Width="600" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Grid>
<telerik:RadMap Height="500" HorizontalAlignment="Left" Margin="3,0,0,0" Name="radMap1" VerticalAlignment="Top" Width="500">
<telerik:InformationLayer x:Name="layer">
</telerik:InformationLayer>
</telerik:RadMap>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="503,282,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
</Grid>
</
Window>

MainWindow.xaml.cs
==================
namespace RadMapControlStudy 
{
 public partial class MainWindow : Window
{
    Location lc1 = new Location(28.066600, -82.381600); //Some LatLong
    
Location lc2 = new Location(28.066890, -82.381876); //Some LatLong

 

 public MainWindow()
{
    InitializeComponent();
    radMap1.Provider = n
ew BingMapProvider(MapMode.Road, true, "KeyValue"); 
    layer.Items.Add(lc1);
    layer.Items.Add(lc2);

    LocationRect
lr = new LocationRect(lc1, lc2); 
    
radMap1.SetView(lr);
}

private void button1_Click(object sender, RoutedEventArgs e) //Zoom seems to be working fine when you click the button
{
    
LocationRect lr1 = new LocationRect(lc1,lc2); 
    radMap1.SetView(lr1);

 

 

 

 

Padmanabhan
Top achievements
Rank 1
 answered on 05 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?