Hi
We are using telerik grid view and facing scroll bar and column size issues if we define column size as "*" in any column.
Could you please see below scenarios and help us in fixing these issues:
Case 1: Use of telerik control scroll bar:
Requirement : In our telerik grid view we want to set some column with fixed width and some variable width("*").
Issue: Horizontal scroll bar doesn't spread acording to the column width,its width is always fixed due to this column with width "*" doesn't spread at all.Please find an attached snapshot of the screen (Case1.png)
See elow eg . in which column name company is set as variable width:-
Case 1 : Code Snippet :
<Grid x:Name="radGridView" Grid.Row="1" Margin="0,30">
<!--Change Detail section-->
<telerik:RadGridView ColumnWidth="150" IsTabStop="False" x:Name="radGridView1" CanUserResizeColumns="False" IsReadOnly="True" CanUserFreezeColumns="False" RowStyle="{StaticResource rowStyle}" ItemsSource="{Binding DemoClasses}" ShowColumnFooters="False" GridLinesVisibility="None" RowIndicatorVisibility="Collapsed" telerikGridViewHeaderMenu:GridViewHeaderMenu.IsEnabled="True" ActionOnLostFocus="None" ShowGroupPanel="False" AutoGenerateColumns="False" Margin="0,-9,-1,0">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn IsSortable="False" >
<telerik:GridViewDataColumn.Header>
<TextBlock Text="Id" TextWrapping="Wrap" TextAlignment="Center"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ID}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="ClassName" DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Company" DataMemberBinding="{Binding Company}" Width="*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Company}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="Completed?" DataMemberBinding="{Binding IsComplete}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IsComplete}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="DueDate" DataMemberBinding="{Binding DueDate}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Center" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center">
<Run Text="{Binding DueDate, StringFormat={}{0:MM/dd/yyyy}}"/>
<LineBreak/>
<Run Text="{Binding DueDate, StringFormat={}{0: hh:mm tt}}"/>
</TextBlock>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" HeaderCellStyle="{DynamicResource columnSelectorHeaderCellStyle}" >
<telerik:GridViewDataColumn.Header>
<StackPanel Orientation="Horizontal">
<Image x:Name="image1" Source="Images/images.jpg" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,5,5,5" MouseLeftButtonDown="Image_MouseDown"/>
</StackPanel>
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
Case 2 : Code Snippet :
<Grid x:Name="radGridView" Grid.Row="1" Margin="0,30">
<!--Change Detail section-->
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<telerik:RadGridView ColumnWidth="150" IsTabStop="False" x:Name="radGridView1" CanUserResizeColumns="False" IsReadOnly="True" CanUserFreezeColumns="False" RowStyle="{StaticResource rowStyle}" ItemsSource="{Binding DemoClasses}" ShowColumnFooters="False" GridLinesVisibility="None" RowIndicatorVisibility="Collapsed" telerikGridViewHeaderMenu:GridViewHeaderMenu.IsEnabled="True" ActionOnLostFocus="None" ShowGroupPanel="False" AutoGenerateColumns="False" Margin="0,-9,-1,0">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn IsSortable="False" >
<telerik:GridViewDataColumn.Header>
<TextBlock Text="Id" TextWrapping="Wrap" TextAlignment="Center"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ID}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="ClassName" DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Company" DataMemberBinding="{Binding Company}" Width="*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Company}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="Completed?" DataMemberBinding="{Binding IsComplete}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IsComplete}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="DueDate" DataMemberBinding="{Binding DueDate}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Center" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center">
<Run Text="{Binding DueDate, StringFormat={}{0:MM/dd/yyyy}}"/>
<LineBreak/>
<Run Text="{Binding DueDate, StringFormat={}{0: hh:mm tt}}"/>
</TextBlock>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" HeaderCellStyle="{DynamicResource columnSelectorHeaderCellStyle}" >
<telerik:GridViewDataColumn.Header>
<StackPanel Orientation="Horizontal">
<Image x:Name="image1" Source="Images/images.jpg" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,5,5,5" MouseLeftButtonDown="Image_MouseDown"/>
</StackPanel>
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</ScrollViewer>
</Grid>
Note : WHen all column's width is fixed then grid view behaviour is quite good but this doesn't suit our requirement.Attached is the snapshot of the grid when column width is fixed(radgridview.jpg).
We want our grid to autosize to fill the view acordingly.
Looking forward for the reply.
Hi,
I would like to know if its possible to display a heat map with different item sizes? We need to visualize road conditions and we use a custom built chart using writable bitmap currently.
I am busy replacing these charts with Telerik controls. But all the examples ive seen for the heatmap, all items are the same size.
I have attached our current HeatMap, highlighted with Yellow rectangle.
Hello,
I'm not capable of doing a Telerik RadGridView with a combobox to manage Edit and Delete actions (see image attached).
The combobox has 2 options "Edit" and "Delete".
I want the control to do:
The problem is that the GridView doesn't fire the SelectedIndexChanged event when I select the combobox.
Could you help me with this? Is there any example that I can see?
Thanks for your help!
I've created a new command in my ViewModel of the scheduleview that works properly in a context menu associated with the scheduleview, however when I try and place this command on a button outside the scheduleview control it doesn't trigger that an appointment has been selected or not.
I can make the CanExecute always return true and then it will fire the event properly when clicked, however I need it to disable/enable when an appointment is selected and it has specific values set in the appointment. The edit button triggers the selection changed ok when outside the schedule view. How do I get this same functionality for my command/button?
public
DelegateCommand StartVisitCommand {
get
{
return
this
.startVisitCommand; }
set
{
this
.startVisitCommand = value; } }
<
telerik:RadButton
Content
=
"Start Visit"
Grid.Column
=
"4"
Command
=
"{Binding DataContext.StartVisitCommand, ElementName=scheduleview}"
CommandTarget
=
"{Binding ElementName=scheduleview}"
CommandParameter
=
"{Binding SelectedAppointments, ElementName=scheduleview}"
DockPanel.Dock
=
"Right"
/>
private
void
StartVisitCommandExecuted(
object
parameter)
{
IEnumerable appointments = parameter
as
IEnumerable;
SqlAppointment appt = appointments.OfType<SqlAppointment>().Where(x => x.TimeMarkerID == 3).FirstOrDefault();
SchedulingInterface.CreateDocumentationByAppt(appt);
}
private
static
bool
CanExecuteStartVisitCommand(
object
parameter)
{
IEnumerable appointments = parameter
as
IEnumerable;
if
(appointments !=
null
)
{
SqlAppointment appt = appointments.OfType<SqlAppointment>().Where(x => x.TimeMarkerID == 3).FirstOrDefault();
if
(appt !=
null
)
return
appt.CurrentTimeMarkerId ==
"3"
;
}
return
false
;
}
I have been trying to get a different color on a Grid, and all I have seen are where you have to override the ControlTemplate. I also tried setting the color of specific color resource, but that did not work either. Here is my xaml
<Style x:Key="GridRadGridView" TargetType="{x:Type telerik:RadGridView}">
<Style.Resources>
<Style TargetType="telerik:GridViewHeaderCell"
BasedOn="{StaticResource {x:Type telerik:GridViewHeaderCell}}">
<Setter Property="Background" Value="#014C6C" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="White" />
</Style>
</Style.Resources>
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="HeaderRowStyle" >
<Setter.Value>
<Style TargetType="telerik:GridViewHeaderRow"
BasedOn="{StaticResource {x:Type telerik:GridViewHeaderRow}}">
<Setter Property="Background" Value="#014C6C" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderThickness" Value="0" />
</Style>
</Setter.Value>
</Setter>
<Setter Property="GroupRowStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Type telerik:GridViewGroupRow}}"
TargetType="telerik:GridViewGroupRow">
<Setter Property="Background" Value="#F8F8F8" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderThickness" Value="0 0 0 1" />
<!--<Setter Property="GroupHeaderTemplate">
<Setter.Value>
<DataTemplate >
</DataTemplate>
</Setter.Value>
</Setter>-->
</Style>
</Setter.Value>
</Setter>
<!--<Setter Property="RowStyle">
<Setter.Value>
<Style TargetType="telerik:GridViewRow"
BasedOn="{StaticResource {x:Type telerik:GridViewRow}}">
<Setter Property="Background" Value="#F9F9F9" />
--><!--<Trigger Property="IsCurrent" Value="True">
<Setter Property="Background" Value="#D7EFF9"/>
</Trigger>--><!--
</Style>
</Setter.Value>
</Setter>-->
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="FontFamily" Value="Nunito" />
<Setter Property="ShowGroupPanel" Value="True" />
<Setter Property="FontSize" Value="14" />
<Setter Property="RowIndicatorVisibility" Value="Collapsed" />
<Setter Property="GridLinesVisibility" Value="Horizontal" />
<Setter Property="ScrollMode" Value="RealTime" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible" />
</Style>
Hi everyone.
I hate to post stacktraces without details on how to replicate, but I'm in one of those "impossible to consistently replicate but get enough error reports that it's starting to drive me insane" kind of situations. Every so often, I get this unhandled exception that crashes an application with a rapidly updating RadGridView.
System.NullReferenceException: Object reference not set to an instance of an
object.
at
Telerik.Windows.Controls.GridView.GridViewCell.UpdateValue()
at
Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement()
at
Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase
cellBase, GridViewColumn column)
at
Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(GridViewCellBase
cell, GridViewColumn column)
at
Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn
column, Boolean createIfNull)
at
Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32
startIndex, Int32 predictedLastIndex, Func`2 calculateNextIndex)
at
Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells()
at
Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size availableSize)
at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at
System.Windows.UIElement.Measure(Size availableSize)
at
System.Windows.ContextLayoutManager.UpdateLayout()
at
System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at
System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at
System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at
System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object
resizedCompositionTarget)
at
System.Windows.Media.MediaContext.RenderMessageHandler(Object
resizedCompositionTarget)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args, Int32 numArgs)
at
MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source,
Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at
System.Windows.Threading.DispatcherOperation.InvokeImpl()
at
System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object
state)
at
System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state, Boolean preserveSyncCtx)
at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
at
System.Windows.Threading.DispatcherOperation.Invoke()
at
System.Windows.Threading.Dispatcher.ProcessQueue()
at
System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr
wParam, IntPtr lParam, Boolean& handled)
at
MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr
lParam, Boolean& handled)
at
MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object
source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at
System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority
priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam,
IntPtr lParam)
at
MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at
System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at
System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at
System.Windows.Threading.Dispatcher.Run()
at
System.Windows.Application.RunDispatcher(Object ignore)
at
System.Windows.Application.RunInternal(Window window)
at
System.Windows.Application.Run(Window window)
at
APSSGuardianAVL.App.Main()
Posting this in hopes that someone has seen it before, or admins know this is a bug that has been addressed.
Thanks.
Hi,
I have a RadTileList which fills the entire width of the screen. By default it has a right padding (50px I guess which is perfect) and I would like to add the same on the left exactly the same way it's done in the demo app.
But I can't find where it's defined, I'm stuck in my research in RadTileListTemplate # ItemsPresenter
Thanks,
Rémi.
Hello,
I am attempting to retain the position of the scroll position of the RadGridView depending on the action being performed by the user during a ReBind() event. I found a solution presented already before but I am having problems implementing it: http://www.telerik.com/forums/scrollviewer-in-radgridview. It only seems to work intermittently. Even though the contents and row count are not changing, sometimes the scroll stays perfectly still as expected, sometimes nudges slightly, sometimes jumps 5-10 rows losing focus on whatever the user was doing and confusing them. Oddly it always seems to work on subsequent Rebind() events unless the user adjusts the scroll position again and the problem begins to repeat. Is there anything that can be done to prevent or fix this unpredictable ​behavior?
var scrollViewer = this.radGridView.ChildrenOfType<
GridViewScrollViewer
>().FirstOrDefault();
//Get horizontal and vertical offsets
var horizontalOffset = scrollViewer.HorizontalOffset;
var verticalOffset = scrollViewer.VerticalOffset;
//Set horizontal and vertical offsets
scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
scrollViewer.ScrollToVerticalOffset(verticalOffset);
so i have RadScheduleView and RadCalendar, SelectedDate and CurrentDate is bound so when i change the dates in calendar, it will also change in ScheduleView.
here's the problem, i want to make another ScheduleView with the same appointment but when i add it, both ScheduleView's CurrentDate is no longer bound to the SelectedDate, why?
and how can i make a Hourly View Appointment? it's like i want to make the 2nd ScheduleView to Hourly so i have an option to open it from the 1st ScheduleView (Day View). for example when i click the slot/appointment at 1:00 time, i will be able to go to 2nd ScheduleView that have timer 1:10 1:20 ... 1:50 something like that so i can make appointment per-10min.
Hi,
I have RadGridView binded to QueryableEntityCollectionView. I want to sort only items on current page by click on column header, not full data from server.
I was trying to sort items in GridView_Sorting event, set e.NewSortingState and e.Cancel = true but without any success. Can't access and sort items from current page.
Any help?