I create class for style selector as follows:
public class NegativeNumberStyle : StyleSelector {
public override Style SelectStyle(object item, DependencyObject container) {
GridViewCell cell = container as GridViewCell;
var value = item.GetType().GetProperty(cell.Column.UniqueName).GetValue(item, null);
if (value.GetType() == typeof(int) && ((int)value) < 0) return NegativeStyle;
if (value.GetType() == typeof(decimal) && ((decimal)value) < 0) return NegativeStyle;
return null;
}
public Style NegativeStyle { get; set; }
}
Then I add the resources to the grid on my page as follows:
<Grid.Resources>
<my:NegativeNumberStyle x:Key="negativeNumberStyle">
<my:NegativeNumberStyle.NegativeStyle>
<Style TargetType="telerik:GridViewCell" BasedOn="StaticResource GridViewCellStyle}">
<Setter Property="Background" Value="Red"/>
</Style>
</my:NegativeNumberStyle.NegativeStyle>
</my:NegativeNumberStyle>
</Grid.Recources>
Since I load columns dynamically I set Columns CellStyle property in code behind
GridViewDataColumn gridColumn = new GridViewDataColumn();
gridColumn.CellStyleSelector = new NegativeNumberStyle();
But negative numbers aren't use the proper style (not showing in red color). I debug the code and noticed that NegativeProperty always returns null.
What am I doing wrong?
Thanks
Hi,
We are trying to expand RadComboBox using CUIT and UIAutomation. Both are throwing exceptions. The exception name is ElementNotAvailableException. In CUIT the inner exception name is InvalidOperationException. Is there any way to perform expand operation on RadComboBox without getting exceptions?.Any help to solve this problem is greatly appreciated.
Regards,
Nagasree.
Hello:
We are unable to
vary the height of the bar series even though the below property is given
properly. The bar series height and width gets adjusted by itself.
The
objective is the height of the Chart should remain same as well as the bar
inside of it. When only one bar for example, the width of the bar should not auto adjust to be fat.
<telerik:RadCartesianChart Palette="Windows8"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,-205">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:LinearAxis Title="Days" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:CategoricalAxis />
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:BarSeries PaletteMode="DataPoint"
ShowLabels="True"
ItemsSource="{Binding LstRunningBatch}"
CategoryBinding="BatchId"
MinWidth="10"
Width="15"
MaxWidth="20"
MinHeight="10"
Height="150"
MaxHeight="20"
ValueBinding="TotalDays">
</telerik:BarSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
Hi Telerik,
I am trying to figure out if there is a way to make the timeline view display as a calendar. See the attached for what I'm wanting to do.
The main difference between this and the regular month view is that I want the events to be positioned on the calendar horizontally such that their position indicates their start and stop time.
How would I go about doing this? Can you please post an example?
Thank you so much for your help.
I tried to move my Grid Columns Content to a separate ResourceDictionary and it works for the first part the "GridViewDataColumn" not perfectly i expect
but
a) not for the GridViewCheckBoxColumn , do you have a suggestion how to do this ?
b) and 2nd i used the common "TextBox" for the GridViewDataColumn (child control) but which Control should i use if i want the Telerik Standard Control which is normaly used in the GridView ? if i add
<t:GridViewDataColumn Header="VALID" ...
it want work , vs designer tell me that it could not found it
thanks br
<telerik:GridViewDataColumn Header="XNAME" CellEditTemplate="{StaticResource ClaimListNameDataTemplate}" CellTemplate="{StaticResource ClaimListNameDataTemplate}"/>
<telerik:GridViewCheckBoxColumn Header="VALID" DataMemberBinding="{Binding IsValidYn, Mode=TwoWay}" AutoSelectOnEdit="True" EditTriggers="CellClick" Width="75*"
CellTemplate="{StaticResource ClaimListValidDataTemplate}" CellEditTemplate="{StaticResource ClaimListValidDataTemplate}"
>
<telerik:GridViewCheckBoxColumn.CellStyle >
<Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource CenterCheckBoxColumnCellStyle}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</telerik:GridViewCheckBoxColumn.CellStyle>
</telerik:GridViewCheckBoxColumn>
IN RESOURCEDIRECTORY
<ResourceDictionary x:Class="Application.Views.ClaimListResourceDictionary"
xmlns:local="clr-namespace:Application.Views"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:t="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:tg="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
>
<DataTemplate x:Key="ClaimListNameDataTemplate" DataType="{x:Type local:ClaimList}">
<StackPanel Orientation="Vertical" Background="Brown">
<Image Height="50" Width="50" HorizontalAlignment="Center" Source="/GapJunctionApplication;component/Images/Refresh2.png"/>
<TextBox HorizontalAlignment="Stretch" BorderThickness="0" SelectionBrush="Green" BorderBrush="Black" Text="{Binding name_nam, Mode=TwoWay}" TextAlignment="Right"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="ClaimListValidDataTemplate" DataType="{x:Type local:ClaimList}">
???
</DataTemplate>
</ResourceDictionary>
Hi Telerik,
I have some hiarchial data and I want to allow the user to pick an item from it when editing a gridview cell. How do I do that?
I basically want to do this:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/grid-with-treeview-and-combobox-editors
but with WPF.
Thanks a ton,
Hi,
I try to create a document (with the rich text editor UI, not by code) that contains a table of content which shows the heading numbers like in the attached sample from MS Word.
I'm using release 2015.1.401.40 of the WPF controls.
Thank you.
If the user changes the input box to an invalid date and then loses focus, the input box is cleared. However, the bound data still has the original valid date.
I need the input box to reflect the data it is bound to.
My chart having step line series along with data point highlighting based on conditions.I would like stretch height and width of point template to occupy all the space.I am facing issue With the rectangle fixed size height and width , it is not aligning properly during zooming.Please see attached..
1.I need to auto adjust or stretch height and width of point template to along with particular line height and width.
2.How can i access relative parent point template ?
I use DragAndDrop behavior on gridview to realize change two rows position , when the rows is many, the scrollview show, it is inconvenient to drag a row to top or bottom.
is any method to let the scrollviewer scroll when drag a row out of the top or bottom?
thanks!