I am attempting to set a column's cell template in code to a template that is also generated in code, but its not working as I assumed it would.
The template seems to only be applied to one row at a time, always the last row to draw. I suspect this is because its an instance of a template and not a resource, but I'm not sure the right way to set this up.
I am making a custom search control that displays results in a grid; I need to add a button to a column and hook the click event up. It is much easier for me to set up in code in this case.
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
//find grid column control part
GridViewColumn PART_SelectColumn = GetTemplateChild("PART_SelectColumn") as Telerik.Windows.Controls.GridViewColumn;
//make cell content
RadButton btn_SelectItem = new RadButton() { Content = "Add"};
btn_SelectItem .Click += PART_SelectItem_Click;
//generate template - code builds a sealed datatemplate with the button as the content
DataTemplate SelectTemplate = DataTemplateExtentions.CreateDataTemplate ( () => { return btn_SelectItem } );
//Set the column's cell template - I suspect this is what I'm doing wrong
PART_SelectColumn.CellTemplate = SelectTemplate;
}
see attached image; the template only applies to the last row.
Anyone know where I'm going wrong?
Hello
When I set DropDownPlacement = "Left", the MenuItem sometimes opens to the left, sometimes to the right.
If I set DropDownPlacement = "Right" the same game - the MenuItem opens sometimes left, sometimes right.
<telerik:RadMenu x:Name="topmenu" Grid.Row="0" Grid.ColumnSpan="4" IconColumnWidth="0" VerticalAlignment="Top" HorizontalAlignment="Stretch"> <telerik:RadMenuItem Header="Allgemein" DropDownPlacement="Bottom"> <telerik:RadMenuItem Header="Beenden" Command="{Binding ExitApplicationCommand}"/> <telerik:RadMenuItem Header="Info" Command="{Binding InfoCommand}"/> </telerik:RadMenuItem> <telerik:RadMenuItem Header="Protokolle" Command="{Binding OpenChangeProtocolViewCommand}"/> <telerik:RadMenuItem DataContext="{Binding MenuDocuments}" ItemsSource="{Binding ChildMenuItems, UpdateSourceTrigger=PropertyChanged}" Header="{Binding Header, UpdateSourceTrigger=PropertyChanged}" StaysOpenOnClick="True" DropDownPlacement="Left"> <telerik:RadMenuItem.Resources> <HierarchicalDataTemplate DataType="{x:Type local:MenuItemViewModel}" ItemsSource="{Binding ChildMenuItems, UpdateSourceTrigger=PropertyChanged}"> <telerik:RadMenuItem Header="{Binding Header, UpdateSourceTrigger=PropertyChanged}" Command="{Binding ExecuteCommand}" StaysOpenOnClick="True" DropDownPlacement="Left"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseEnter" > <i:InvokeCommandAction Command="{Binding MouseEnterCommand}" /> </i:EventTrigger> </i:Interaction.Triggers> </telerik:RadMenuItem> </HierarchicalDataTemplate> </telerik:RadMenuItem.Resources> </telerik:RadMenuItem> </telerik:RadMenu>
We would like, that all menuitem always open on the left site from parent menu.
Is this possible with the RadMenu Control?
For what purpose is the setting DropDownPlacement?
Thank you
Hello.
I have a column in my RadGridView that's bound to a DateTime field of my data source. It's showing both date and time (i.e. 7/7/2017 2:22 PM). When I'm clicking the Filter button (next to the column name) I'm getting the filtering popup with the distinct values and two Date pickers. Is there a way to make them DateTime pickers instead?
I tried to use AutoGenerateColumns="True" so that my customizations don't interfere but I'm still getting Date pickers.
Thank you.
I use ExportToXlsx to export gridview data to an excel file using the following code snippet
gridView.ExportToXlsx(fs, new GridViewDocumentExportOptions(){ ShowColumnHeaders = true, AutoFitColumnsWidth = true});
Sometimes when opening the file in Excel I get the error message:
Excel found unreadable content in ... Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.
I can open the file after clicking yes, but the content is not in sync with the information as shown in the GridView.
It seems that this happens when the grid has empty cells e.g. we have a date field which can be omitted (null).
If I use the exportToPdf method al goes well using the same date in the gridview. So it seems it's an issue related to Excel export.
Is this a bug or otherwise how can I fix this issue?
I use version 2015.1.401.45
Regards,
Peter
I'm just starting out with WPF and with the Telerik controls and am trying to work with RadWindow; I'm following the example in "User RadWinfow as UserControl" and the window is running but it is not displaying on the screen. I've followed the example to the letter so stuck as to what the issue is?
The RadWindow XAML is as per the example:
<telerik:RadWindow x:Class="Temp.TelerikScenario1"
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"
Header="TelerikScenario1" Height="300" Width="300">
<Grid>
</Grid>
</telerik:RadWindow>
and so is the code:
public partial class TelerikScenario1
{
public TelerikScenario1()
{
InitializeComponent();
}
}
Then I try to open in the MainWindow.xaml.cs:
public MainWindow()
{
InitializeComponent();
TelerikScenario1 window = new TelerikScenario1();
window.Show();
}
And whilst I can see the code is running for the TelerikScenario1 RadWindow it is not displayed on the screen? (if I declare a new Radwindow in c# "RadWindow radWindow = new RadWindow();" then that opens fine).
The Top grid will show the row as invalid. and the botton grid will have a new row
Here is the Xaml
<Window x:Class="TestMultipleRadGrids.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <telerik:RadGridView Grid.Row="0" x:Name="_rad1" ValidatesOnDataErrors="InEditMode" ShowGroupPanel="False" AutoGenerateColumns="False" CanUserReorderColumns="True" CanUserInsertRows="True" RowValidating="_rad1_RowValidating" ShowInsertRow="True"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Name1" /> <telerik:GridViewDataColumn Header="Initial Value1" DataMemberBinding="{Binding InitialValue1, Mode=TwoWay}"/> </telerik:RadGridView.Columns> </telerik:RadGridView> <telerik:RadGridView Grid.Row="1" x:Name="_rad2" ShowGroupPanel="False" ValidatesOnDataErrors="InEditMode" AutoGenerateColumns="False" CanUserReorderColumns="True" CanUserInsertRows="true" RowValidating="_rad2_RowValidating" ShowInsertRow="True"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Name2"/> <telerik:GridViewDataColumn Header="Initial Value2" DataMemberBinding="{Binding InitialValue2, Mode=TwoWay}" /> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></Window>
Here is the code behind:
using System.Windows;using Telerik.Windows.Controls;namespace TestMultipleRadGrids{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void _rad1_RowValidating(object sender, Telerik.Windows.Controls.GridViewRowValidatingEventArgs e) { GridViewCellValidationResult validationResult = new GridViewCellValidationResult(); validationResult.PropertyName = "InitialValue1"; validationResult.ErrorMessage = "Error"; e.ValidationResults.Add(validationResult); e.IsValid = false; } private void _rad2_RowValidating(object sender, Telerik.Windows.Controls.GridViewRowValidatingEventArgs e) { _rad1.Focus(); GridViewCellValidationResult validationResult = new GridViewCellValidationResult(); validationResult.PropertyName = "InitialValue2"; validationResult.ErrorMessage = "Error"; e.ValidationResults.Add(validationResult); e.IsValid = false; } }}
Any help would be greatly appreciated.

I tried hosting your WPF RichTextBox in a WinForms application and the Japanese IME doesn't work properly with it. I used the Microsoft IME and the characters start repeating themselves.
I am wanting to change the behavior of the Radial Menu Button. Instead of opening / closing the radial menu, I'd like it to do something else.
Is it possible to override the behavior of the central radial menu button on a radial menu?
