Hi
Please find my below code showing the celledittemplate
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<tbcontrols:SmartSearchRadAutoCompleteBox x:Name="JournalSuggestions" AutomationProperties.AutomationId="JournalSuggestions"
Style="{StaticResource SmartControlStyle}"
SelectionMode="Single"
KeyDown="JournalSuggestions_KeyDown"
PreviewGotKeyboardFocus="JournalSuggestions_PreviewGotKeyboardFocus"
Populating="JournalSuggestions_Populating"
Width="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewDataColumn}, Path=ActualWidth}"
BorderThickness="0"
BorderBrush="Transparent"
ClipToBounds="True"
AutoCompleteMode="Suggest"
ItemsSource="{Binding Source={StaticResource SmartJournalAccounts}}"
DisplayMemberPath="Code"
FilteringBehavior="{StaticResource LocalJournalFilter}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
DropDownItemTemplate="{Binding Source={StaticResource CustomDropDownTemplate}}"
NoResultsContentTemplate="{StaticResource NoResultsContentTemplate}"
DropDownWidth="Auto"
BoxesItemStyle="{StaticResource CustomRadAutoCompleteBoxesItemStyle}"
IsEnabled="True"
Margin="-17 0 0 0"
SearchText="{Binding DataContext.SmartControlSearchText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
SelectedItem="{Binding Path=SmartJournalAccountItem, Mode=TwoWay}"
TextSearchMode="Contains" TextBoxStyle="{StaticResource TrailBalanceAccountTextBoxStyle}" FontSize="12" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cal:ActionMessage MethodName="AutoCompleteBoxSelectionChanged">
<cal:Parameter Value="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadAutoCompleteBox}}}"></cal:Parameter>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
<i:Interaction.Behaviors>
<behaviours:RadAutoCompleteBoxBehavior/>
</i:Interaction.Behaviors>
</tbcontrols:SmartSearchRadAutoCompleteBox>
<Button x:Name="SearchButton" Grid.Column="1"
DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=controls:APTPanel}}"
Click="SearchButton_Click">
<Button.Visibility>
<con:ConverterBindableBinding Binding="{Binding IsSearchAccountVisible,UpdateSourceTrigger=PropertyChanged}"
Converter="{StaticResource BooleanToVisibilityConverter}"
ConverterParameterBinding="{Binding IsSearchAccountVisible, RelativeSource={RelativeSource AncestorType={x:Type controls:APTPanel}}, UpdateSourceTrigger=PropertyChanged}">
</con:ConverterBindableBinding>
</Button.Visibility>
</Button>
</Grid>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
If I click the "SearchButton" on first click the event does not fire, the click event fires if I click it second time.
If I remove the SmartSearchRadAutoCompleteBox control & only keep the SearchButton then it works ok.
Can someone give me code snippet having multiple controls (one radautosearchbox & one button) in datatemplate of celledittemplate or help me understand what is causing issue in my Click event
Regards,
Swapnil.
I am adding tooltip to my datagrid headers this way:
<telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"
Width="40"
TextAlignment="Right">
<telerik:GridViewDataColumn.Header>
<TextBlock Text="#"
ToolTipService.ToolTip="Number of the match"/>
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
The problem is I also has this defined for my grid:
<telerik:RadGridView.SortDescriptors>
<telerik:SortDescriptor Member="StartDate" SortDirection="Ascending"/>
<telerik:SortDescriptor Member="StartTime" SortDirection="Ascending"/>
<telerik:SortDescriptor Member="PitchName" SortDirection="Ascending"/>
</telerik:RadGridView.SortDescriptors>
With indirect styling, the header now does not change the text color and thus fade away behind the selected color of the header... how can I style the column to avoid this effect?
Hi,
I am using a RadGridView to bind a DataTable. In that table I have dynamically generated columns. That's why I chose to set AutoGenerateColumns=true.
I am now looking for a way to style the cells in depending on the properties of the object within the cell of the DataTable.
What I tried until now:
The first method seem the most promissing to me, so here is some code for that:
<UserControl.Resources>
<Style x:Key="PilotStyle"
TargetType="telerik:GridViewCell">
<Setter Property="Background"
Value="Magenta" />
</Style>
<Style x:Key="ExpansionStyle"
TargetType="telerik:GridViewCell">
<Setter Property="Background"
Value="Aqua" />
</Style>
<valueConverters:RodTimeTypeConverter x:Key="converter" />
<local:RodTableCellStyleSelector x:Key="selector"
ConditionConverter="{StaticResource converter}">
<local:RodTableCellStyleSelector.Rules>
<local:ConditionalStyleRule Style="{StaticResource PilotStyle}">
<local:ConditionalStyleRule.Value>
<system:Boolean>True</system:Boolean>
</local:ConditionalStyleRule.Value>
</local:ConditionalStyleRule>
<local:ConditionalStyleRule Style="{StaticResource ExpansionStyle}">
<local:ConditionalStyleRule.Value>
<system:Boolean>False</system:Boolean>
</local:ConditionalStyleRule.Value>
</local:ConditionalStyleRule>
</local:RodTableCellStyleSelector.Rules>
</local:RodTableCellStyleSelector>
</UserControl.Resources>
<telerik:RadGridView Grid.Row="1"
CanUserSortColumns="False"
CanUserSelectColumns="False"
CanUserReorderColumns="False"
CanUserDeleteRows="False"
CanUserGroupColumns="False"
CanUserSelect="False"
IsFilteringAllowed="False"
ShowColumnSortIndexes="False"
ShowGroupPanel="False"
RowHeight="45"
AutoGeneratingColumn="GridViewDataControl_OnAutoGeneratingColumn"
ItemsSource="{Binding RodTimesTable.DefaultView}">
<telerik:RadGridView.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize"
Value="20" />
</Style>
</telerik:RadGridView.Resources>
</telerik:RadGridView>
public class RodTableCellStyleSelector : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
var conditionValue = this.ConditionConverter.Convert(item, null, null, null);
foreach (var rule in this.Rules.Where(rule => Equals(rule.Value, conditionValue)))
{
return rule.Style;
}
return base.SelectStyle(item, container);
}
List<ConditionalStyleRule> rules;
public List<ConditionalStyleRule> Rules
{
get
{
return this.rules ??= new List<ConditionalStyleRule>();
}
}
public IValueConverter ConditionConverter { get; set; }
}
public class ConditionalStyleRule
{
public object Value { get; set; }
public Style Style { get; set; }
}
private void GridViewDataControl_OnAutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
var grid = (RadGridView)sender;
var dataGrid = (grid.ItemsSource as DataView)?.Table;
e.Column.Header = dataGrid?.Columns[e.Column.Header.ToString()].Caption;
if (e.Column.Header != null && (e.Column.Header.ToString().StartsWith("Pilot") || e.Column.Header.ToString().StartsWith("Expansion")) )
{
e.Column.CellStyleSelector = (StyleSelector)this.FindResource("selector");
}
}
I would really appreciate any help.
Thanks in advance.
I have been fighting this for hours and have tried a number of things to no avail. The selector is hit, returns the correct values, but grid is showing no change. I have distilled the issue down to a simple project and removed anything that might be interfering. I am attaching the whole solution here (.NET 6).
I have to be doing something wrong but very simple. Any help is appreciated.
Alan
hi Team,
I need to add a radpath button to the RadGridView's searchpanel .
RadGridView doesnt has a particular style property for searchpanel, like it has for groups (i.e. GroupPaneItemStyle).
So I extracted the style, and to the control template added the radpath button.
But then this style is used globally in my application. So this button comes at all the places where the RadGridView is used.
Now I want to add a attachproperty to the radGridViewSearchPanel , which can be accessed from my different views and I should be able to control the visibility of my radpathbutton.
So I want something like this -
<telerik:RadGridView
Name="DeviceConnectionsGridView"
ShowSearchPanel="True"
SearchPanelCloseButtonVisibility="Hidden"
My_AttachedProperty_For_SearchPanelsRadPathButtonVisbility = "Visible"
/>
Here's what I performed -
I added an attached, to the GridViewSearchPanel class, but this property is only accessible where the GridViewSearchPanel is used.
In my case ggridViewsearchpanel is not used directly but coming from the RadGridView, so this attach property is not coming for R
adGridView.
So plz tell me, how can we achieve this ?
I have a RadGridView in my application and did not explicitly set the style for it. It works well in normal contrast mode but when turn on the Aquatic high contrast mode in Windows 11, the contrast between the text and background on the header becomes minimal like below.
I tried changing the style like below but the text will stay at the defined color regardless of the contrast mode.
<Style TargetType="telerik:GridViewHeaderCell" BasedOn="{StaticResource GridViewHeaderCellStyle}"> <Setter Property="Foreground" Value="Red"/> <Setter Property="HorizontalContentAlignment" Value="Center"/> </Style>
PROBLEM
When you have a WPF RadGridView based on Table of many columns, consequently the Horizontal Scrollbar appear in Last row's as shown below. As the user scrolls to the bottom, it is look like the last row is not fully visible, its content has been cut.
Note : Theme Setting Mechanisms
Using Implicit Styles In this case use NoXaml dlls.
QUESTION : How can show Horizontal scrollbar correctly like :
CAUSE & SOLUTION plz?
Hello, I'm trying to set rounded corners for my RadGridView but can't figure out how to do it, I tried putting it in a border with CornerRadius but it did nothing
Hello, I can't find how to remove the border around the rows in my radgridview as shown in the screen shot
The first row is bordered in gray and the row which is moused over is bordered in orange
Here's the code for the radgridview with a column and the code for my row style :
<Grid Grid.Row="2" Grid.Column="1" Background="White" >
<!-- Calibrators TAB -->
<Grid x:Name="TabCalibrators" Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition Height="775px"></RowDefinition>
</Grid.RowDefinitions>
<!--<Rectangle Width="500px" Height="2" Fill="White" HorizontalAlignment="Center" VerticalAlignment="Top"/>-->
<Border x:Name="BDRoundedCalibrators" Background="{StaticResource Zentech_DarkGray}" BorderThickness="0" BorderBrush="{x:Null}" CornerRadius="0,0,12,0"/>
<Line X1="0" Y1="0" Stroke="White" StrokeThickness="2" X2="1735" Y2="0" Grid.Row="0"/>
<telerik:RadGridView x:Name="GridCalibrators"
BorderBrush="Transparent"
BorderThickness="0"
AutoGenerateColumns="False"
IsReadOnly="True"
CanUserSelect="False"
GridLinesVisibility="None"
CanUserReorderColumns="False"
CanUserSortColumns="False"
Background="White"
CanUserSelectColumns="False"
ShowGroupPanel="False"
CanUserDeleteRows="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
RowIndicatorVisibility="Collapsed"
CanUserFreezeColumns="False"
ShowSearchPanel="False"
ShowColumnSortIndexes="False"
MergedCellsDirection="Vertical"
GroupRenderMode="Flat"
CanUserSearch="False"
CanUserSortGroups="False"
IsFilteringAllowed="False"
ReorderColumnsMode="None"
IsManipulationEnabled="False"
HeaderRowStyle="{StaticResource RadGridViewColumnHeaderStyle}"
RowStyle="{StaticResource RadGridViewRow_Standard}"
Grid.Row="0"
>
<!--RowStyle="{StaticResource RadGridViewRow_Standard}"-->
<telerik:RadGridView.OpacityMask>
<VisualBrush Visual="{Binding ElementName=BDRoundedCalibrators}"/>
</telerik:RadGridView.OpacityMask>
<telerik:RadGridView.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFFFFF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#5D6467"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#FFFFFF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#5D6467"/>
</telerik:RadGridView.Resources>
<telerik:RadGridView.Columns>
<!-- Status -->
<telerik:GridViewDataColumn Header="Status" Width="175"
HeaderCellStyle="{StaticResource RadGridViewHeaderCellStyle}"
DataMemberBinding="{Binding WellStatus}"
IsCellMergingEnabled="False"
HeaderTextAlignment="Center"
CellStyle="{StaticResource ViewCellStyle}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" >
<Image x:Name="IconStatus" Height="37" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0,0,0">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Value="Completed" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconCompleted}"/>
</DataTrigger>
<DataTrigger Value="Processing" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconProcessing}"/>
</DataTrigger>
<DataTrigger Value="Aborted" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconAborted}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding WellStatus}"/>
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewPinRowColumn MinWidth="0" Width="1" HeaderCellStyle="{StaticResource RadGridViewColumnSeparatorSmallStyle}" />
<!--PlateSerialNumber-->
<telerik:GridViewDataColumn Header="Plate serial number" Width="180"
HeaderCellStyle="{StaticResource RadGridViewHeaderCellStyle}"
DataMemberBinding="{Binding PlateBarcode}"
IsCellMergingEnabled="False"
TextAlignment="Center"/>
<Style x:Key="RadGridViewRow_Standard" TargetType="{x:Type telerik:GridViewRow}" >
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="{StaticResource Zentech_DarkGray}"/>
<Setter Property="TextElement.FontFamily" Value="{StaticResource PrimaryFont}"/>
<Setter Property="TextElement.FontSize" Value="16pt"/>
<Setter Property="Height" Value="65"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="MouseOverBackground" Value="Transparent"/>
<Setter Property="SelectedBackground" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource Zentech_DarkGray}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="IsSelected" Value="False"/>
<Setter Property="IsManipulationEnabled" Value="False"/>
</Style>
Hello, I can't find how to remove the border around the header cells in my radgridview as shown in the screen shot
Here's the code for the radgridview with a column and the code for my styles :
<Grid Grid.Row="2" Grid.Column="1" Background="White" >
<!-- Calibrators TAB -->
<Grid x:Name="TabCalibrators" Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition Height="775px"></RowDefinition>
</Grid.RowDefinitions>
<!--<Rectangle Width="500px" Height="2" Fill="White" HorizontalAlignment="Center" VerticalAlignment="Top"/>-->
<Border x:Name="BDRoundedCalibrators" Background="{StaticResource Zentech_DarkGray}" BorderThickness="0" BorderBrush="{x:Null}" CornerRadius="0,0,12,0"/>
<Line X1="0" Y1="0" Stroke="White" StrokeThickness="2" X2="1735" Y2="0" Grid.Row="0"/>
<telerik:RadGridView x:Name="GridCalibrators"
BorderBrush="Transparent"
BorderThickness="0"
AutoGenerateColumns="False"
IsReadOnly="True"
CanUserSelect="False"
GridLinesVisibility="None"
CanUserReorderColumns="False"
CanUserSortColumns="False"
Background="White"
CanUserSelectColumns="False"
ShowGroupPanel="False"
CanUserDeleteRows="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
RowIndicatorVisibility="Collapsed"
CanUserFreezeColumns="False"
ShowSearchPanel="False"
ShowColumnSortIndexes="False"
MergedCellsDirection="Vertical"
GroupRenderMode="Flat"
CanUserSearch="False"
CanUserSortGroups="False"
IsFilteringAllowed="False"
ReorderColumnsMode="None"
HeaderRowStyle="{StaticResource RadGridViewColumnHeaderStyle}"
RowStyle="{StaticResource RadGridViewRow_Standard}"
Grid.Row="0"
>
<!--RowStyle="{StaticResource RadGridViewRow_Standard}"-->
<telerik:RadGridView.OpacityMask>
<VisualBrush Visual="{Binding ElementName=BDRoundedCalibrators}"/>
</telerik:RadGridView.OpacityMask>
<telerik:RadGridView.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFFFFF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#5D6467"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#FFFFFF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#5D6467"/>
</telerik:RadGridView.Resources>
<telerik:RadGridView.Columns>
<!-- Status -->
<telerik:GridViewDataColumn Header="Status" Width="175"
HeaderCellStyle="{StaticResource RadGridViewHeaderCellStyle}"
DataMemberBinding="{Binding WellStatus}"
IsCellMergingEnabled="False"
HeaderTextAlignment="Center">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" >
<Image x:Name="IconStatus" Height="37" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0,0,0">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Value="Completed" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconCompleted}"/>
</DataTrigger>
<DataTrigger Value="Processing" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconProcessing}"/>
</DataTrigger>
<DataTrigger Value="Aborted" Binding="{Binding WellStatus}">
<Setter Property="Source" Value="{StaticResource AssayApproval_IconAborted}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding WellStatus}"/>
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewPinRowColumn MinWidth="0" Width="1" HeaderCellStyle="{StaticResource RadGridViewColumnSeparatorSmallStyle}" />
<!--PlateSerialNumber-->
<telerik:GridViewDataColumn Header="Plate serial number" Width="180"
HeaderCellStyle="{StaticResource RadGridViewHeaderCellStyle}"
DataMemberBinding="{Binding PlateBarcode}"
IsCellMergingEnabled="False"
TextAlignment="Center"/>
<Style x:Key="RadGridViewHeaderCellStyle" TargetType="{x:Type telerik:GridViewHeaderCell}">
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="HorizontalAlignment" Value="Left"></Setter>-->
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="IsHitTestVisible" Value="False"/>
</Style>
<Style x:Key="RadGridViewColumnHeaderStyle" TargetType="{x:Type telerik:GridViewHeaderRow}">
<Setter Property="Background" Value="{StaticResource Zentech_DarkGray}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="TextElement.FontFamily" Value="{StaticResource PrimaryFont}"/>
<Setter Property="TextElement.FontSize" Value="16pt"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Height" Value="55"/>
<Setter Property="BorderThickness" Value="0 0 0 0"/>
<Setter Property="Padding" Value="0"/>
</Style>