Telerik Forums
UI for WPF Forum
1 answer
119 views
I have a custom selection box template for a RadComboBox containing buttons, and then I handle the click events of those buttons to set values in my data.  This previously worked, but I just installed the latest version of the RadControls and now it doesn't work anymore, events don't seem to get routed to the buttons inside the combo box anymore, the combo box eats all the focus and click events itself without passing them on.

I made a simple test app to show this happening, you'll notice when an item is selected, the buttons inside the combo box can't get focus and can't be clicked.

<Window x:Class="RadControlsTest.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Window.Resources>
        <DataTemplate x:Key="ComboBoxSelectionBoxTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                 
                <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Text="{Binding TestData1}" FontSize="18.667" FontWeight="Bold" FontStyle="Italic"/>
                <Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" />
                <TextBlock Grid.Row="2" Grid.Column="0" Text="TestText1" HorizontalAlignment="Center" Margin="3,3,3,0" />
                <TextBlock Grid.Row="2" Grid.Column="1" Text="TestText2" HorizontalAlignment="Center" Margin="3,3,3,0" />
                <TextBlock Grid.Row="2" Grid.Column="2" Text="TestText3" HorizontalAlignment="Center" Margin="3,3,3,0" />
                <TextBlock Grid.Row="2" Grid.Column="3" Text="TestText4" HorizontalAlignment="Center" Margin="3,3,3,0" />
                <TextBlock Grid.Row="2" Grid.Column="4" Text="TestText5" HorizontalAlignment="Center" Margin="3,3,3,0" />
                <telerik:RadButton Grid.Row="3" Grid.Column="0" Tag="0" Focusable="False" telerik:StyleManager.Theme="Office_Silver" Content="Button1" Click="ComboButton_Click" Margin="3" HorizontalAlignment="Center"/>
                <telerik:RadButton Grid.Row="3" Grid.Column="1" Tag="1" Focusable="False" telerik:StyleManager.Theme="Office_Silver" Content="Button1" Click="ComboButton_Click" Margin="3" HorizontalAlignment="Center"/>
                <telerik:RadButton Grid.Row="3" Grid.Column="2" Tag="2" Focusable="False" telerik:StyleManager.Theme="Office_Silver" Content="Button1" Click="ComboButton_Click" Margin="3" HorizontalAlignment="Center"/>
                <telerik:RadButton Grid.Row="3" Grid.Column="3" Tag="3" Focusable="False" telerik:StyleManager.Theme="Office_Silver" Content="Button1" Click="ComboButton_Click" Margin="3" HorizontalAlignment="Center"/>
                <telerik:RadButton Grid.Row="3" Grid.Column="4" Tag="4" Focusable="False" telerik:StyleManager.Theme="Office_Silver" Content="Button1" Click="ComboButton_Click" Margin="3" HorizontalAlignment="Center"/>
            </Grid>
        </DataTemplate>
    </Window.Resources>
        <Grid>
            <telerik:RadComboBox x:Name="TestComboBox" Margin="15,10" SelectionBoxTemplate="{StaticResource ComboBoxSelectionBoxTemplate}" Height="100" Width="320" />
        </Grid>
</Window>



And the relevant C# code for the main window

public class TestData
{
    public TestData(string test1) { TestData1 = test1; }
 
    public string TestData1 { get; set; }
}
 
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    List<TestData> m_TestDataList = new List<TestData>();
     
    public MainWindow()
    {
        m_TestDataList.Add(new TestData("test1"));
        m_TestDataList.Add(new TestData("test2"));
        m_TestDataList.Add(new TestData("test3"));
        m_TestDataList.Add(new TestData("test4"));
         
        InitializeComponent();
    }
 
    private void ComboButton_Click(object sender, System.Windows.RoutedEventArgs e)
    {
        Button comboButton = (Button)sender;
        int index = (int)comboButton.Tag;
 
        MessageBox.Show("Clicked button " + index.ToString());
    }
 
    private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
    {
        TestComboBox.ItemsSource = m_TestDataList;
        TestComboBox.DisplayMemberPath = "TestData1";
    }
}
Valeri Hristov
Telerik team
 answered on 15 Dec 2011
1 answer
214 views

im having a problem with templates it seems that only the first template is used not the cascaded if i use datatemplateselector it is ignored ( SelectTemplate is never called )

im quite new so maybee im doing something wron if you need more help please contact me

Edit: the ItemSource handling is correct and currentItem is also fine just the visual tree of the nested templates are ignored and this obviously results in binding errors

cheers jan

<

 

 

UserControl

xmlns

 

 

="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns

 

 

:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns

 

 

:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns

 

 

:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns

 

 

:local="clr-namespace:LibaryTest" xmlns:ViewModel="clr-namespace:LibaryTest.ViewModel"

xmlns

 

 

:View="clr-namespace:LibaryTest.View" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

xmlns

 

 

:Breadcrumb="clr-namespace:Telerik.Windows.Controls.Breadcrumb;assembly=Telerik.Windows.Controls.Navigation"

mc

 

 

:Ignorable="d"

x

 

 

:Class="LibaryTest.View.ProductionDetailView"

x

 

 

:Name="UserControl"

d

 

 

:DesignWidth="300" d:DesignHeight="240">

 

 

<UserControl.Resources>

 

 

<HierarchicalDataTemplate x:Key="ScheduleTemplate">

 

 

<TextBlock Text="{Binding DomainObject.ScheduleName}" />

 

 

</HierarchicalDataTemplate>

 

 

<HierarchicalDataTemplate x:Key="RunTemplate" ItemsSource="{Binding ProductionSchedules}" ItemTemplate="{StaticResource ScheduleTemplate}" >

 

 

<TextBlock Text="{Binding DomainObject.RunName}" />

 

 

</HierarchicalDataTemplate>

 

 

<HierarchicalDataTemplate x:Key="ProductionTemplate" ItemsSource="{Binding ProductionSchedules}" ItemTemplate="{StaticResource RunTemplate}" >

 

 

<TextBlock Text="{Binding DomainObject.ProductionName}" />

 

 

</HierarchicalDataTemplate>

 

 

<View:NavigationDetailTemplateSelector x:Key="detailSelector"/>

 

 

<View:NavigationMasterTemplateSelector x:Key="masterSelector"/>

 

 

</UserControl.Resources>

 

 

<d:DataContext>

 

 

<ViewModel:ProductProductionViewModel />

 

 

</d:DataContext>

 

 

<Grid x:Name="LayoutRoot">

 

 

<Grid.RowDefinitions>

 

 

<RowDefinition Height="0.05*"/>

 

 

<RowDefinition Height="0.95*"/>

 

 

</Grid.RowDefinitions>

 

 

<telerik:RadBreadcrumb x:Name="navigationView"

 

Header="{Binding}"

 

Grid.Row="0"

 

ItemTemplate="{DynamicResource ProductionTemplate}"

 

ItemsSource="{Binding ProductProductionRuns}"

 

IsTextModeEnabled="False"

 

/>

 

 

<!--

ItemTemplateSelector="{DynamicResource masterSelector}"

HeaderTemplateSelector="{DynamicResource masterSelector}"

HeaderTemplate="{DynamicResource RunTemplate}"

ItemTemplate="{DynamicResource ProductionTemplate}"

HeaderTemplate="{DynamicResource ProductionTemplate}"

<TreeView x:Name="navigationView" ItemsSource="{Binding ProductProductionRuns}" Grid.Row="0" ItemTemplate="{DynamicResource RunTemplate}" />

-->

 

 

<!--

this is working fine

<ContentControl x:Name="DetailView"

DataContext="{Binding CurrentItem, ElementName=navigationView}"

ContentTemplateSelector="{DynamicResource detailSelector}"

Grid.Row="1"

Content="{Binding DataContext, RelativeSource={RelativeSource Self}}" >

</ContentControl>-->

 

 

 

 

</Grid>

</

 

 

UserControl>

Zarko
Telerik team
 answered on 15 Dec 2011
1 answer
285 views
I have a model class, Folder:

public class Folder
{
    public string Name { get; set; }
    public ObservableCollection<Folder> SubFolders { get; set; }
}

This is exposed to the UI via a view model, the the folder structure is displayed in a RadTreeView using a hierarchical data template and all is well.

I am adding a context menu to each Folder in the tree view, one of the options on the menu is "Rename". When this is clicked, I want the relevant RadTreeViewItem to go into edit mode.

I can add an "IsInEditMode" flag to the Folder, that's not a problem. The Command on the menu item is bound to the command on the view model, and I can get hold of the relevant Folder using a command parameter, that's not a problem.

But how to I set the IsEditable on the hierarchical data template? And how do I bind the IsInEditMode of the TreeViewItem to that of the Folder? Here is my current XAML (which shows a few other things, like a similar structure with the Tag objects:

<telerik:RadTreeView DockPanel.Dock="Top">
    <telerik:RadTreeViewItem Header="My Folders" ItemsSource="{Binding Folders}">
        <telerik:RadTreeViewItem.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding SubFolders}" DataType="{x:Type Model:Folder}">                                   
                <TextBlock Text="{Binding Name}" />
            </HierarchicalDataTemplate>
        </telerik:RadTreeViewItem.ItemTemplate>
    </telerik:RadTreeViewItem>
</telerik:RadTreeView>
 
<telerik:RadTreeView DockPanel.Dock="Top">
    <telerik:RadTreeViewItem Header="My Tags" ItemsSource="{Binding Tags}">
        <telerik:RadTreeViewItem.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding SubTags}" DataType="{x:Type Model:Tag}">
                <TextBlock Text="{Binding Name}" >
                <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu>
                    <telerik:RadMenuItem Header="Rename" Command="{StaticResource renameTagCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=DataContext}"/>
                    <telerik:RadMenuItem Header="Delete Tag"/>
                </telerik:RadContextMenu>
            </telerik:RadContextMenu.ContextMenu>
                </TextBlock>
            </HierarchicalDataTemplate>
        </telerik:RadTreeViewItem.ItemTemplate>
    </telerik:RadTreeViewItem>

Open to other suggestions. Cheers.
Petar Mladenov
Telerik team
 answered on 15 Dec 2011
1 answer
86 views
I'm using RadChart 2011 Q3. I have a chart with two lines series on it. I would like to add two separate grid lines and shade the area in between. I know how to add the grid lines. But I don't know how (or if it's possible) to shade the entire area between the two grid lines.

Thank you!
Sia
Telerik team
 answered on 15 Dec 2011
1 answer
62 views
Hello,

as stated in this article (http://www.telerik.com/help/wpf/radscheduleview-migration-from-radscheduler.html) the old radscheduler had an property called "AppointmentEditAction" in the AppointmentEditingEventArgs where you could get the type of edit action such as edit, drag or resize. This property is not present in RadScheduleView. However i subscribed to the appointment editing event and i need to act differently on it regarding the edit action such as edit, drag or resize. Is there a way on how i can get the information of what type the edit event is?

thanks in advance

best regards

Matthias
Yana
Telerik team
 answered on 15 Dec 2011
4 answers
104 views
Does anyone have any articles or example code were drag drop functionality has been implemented between a surfacelistbox and radscheduleview in WPF? Thanks a lot.
Daniel
Top achievements
Rank 1
 answered on 15 Dec 2011
1 answer
145 views
Is there an easy way to change the icon on the TimePicker control?  I looked and couldn't find a quick property to set (e.g. IconPath="MyImage.png" or something).
Dani
Telerik team
 answered on 15 Dec 2011
2 answers
115 views
Hi there
I would like to display individual context menus based on whether the user right-clicks an appointment, and empty area, or an empty area between two appointments. What's the best way to accomplish this?

Thanks for your advice
Philipp
Philipp
Top achievements
Rank 1
 answered on 15 Dec 2011
1 answer
63 views
Hi, I noticed that when I add a sort descriptor in my xaml, the group order (not the rows in the group) is reversed. What's going on here? Here's the markup:

                      <telerik:RadGridView.GroupDescriptors>
                        <data:GroupDescriptor Member="Checked" />
                    </telerik:RadGridView.GroupDescriptors>
                    <telerik:RadGridView.SortDescriptors>
                        <data:SortDescriptor Member="Name"/>
                    </telerik:RadGridView.SortDescriptors>
Twistur
Top achievements
Rank 1
 answered on 15 Dec 2011
5 answers
238 views
Hello!
I've got a problem installing telerik ui controls. I've spent my whole day searching for the reason of the problem, but found nothing.
I have downloaded the latest telerik installer (.exe) and tried to install wpf ui controls (I've also tried to install Silverlight controls and had the same result).
After waiting for ~ half an hour after starting the installation process, the window shows "Oops, it seems we've hit an installation problem".
I don't know what to do now.

My machine is running Win7, VS 2010 SP1.
I've tried to start the installer in admin mode, nothing changed.

If I could see the logs, at least.... But I don't know where I can find them and I don't know if they are being created at all (I've read about logging the setup process, but I'm using an .exe, not an msi installer - I can't find where to download the .msi from)

Anyway, I need to get it working as soon as possible...
So, do you have any ideas?

PS.The interesting is: first, the folder "c:\program files\telerik" is being created and some files and folders are written there, 
and later, through the installation process, the telerik folder gets deleted (seems like the installer is restoring everything).
And after that, the error is shown (see attached file).

Thanks in advance
Teodor
Telerik team
 answered on 14 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?