Hi,
after last release updated my treeview get the following random error:
Application_UnhandledThreadException
Output: A first-chance exception of type 'System.NullReferenceException' in Telerik.Windows.Controls.GridView.dll
StackTrace:
in Telerik.Windows.Controls.TreeListView.TreeListCellsPanel.GetCellLeftOffset(UIElement child, Double childWidth)
in Telerik.Windows.Controls.GridView.GridViewCellsPanel.ArrangeVirtualizedCell(GridViewCellBase cell, Size finalSize)
in Telerik.Windows.Controls.GridView.GridViewCellsPanel.ArrangeVirtualizedCells(Size finalSize)
in Telerik.Windows.Controls.GridView.GridViewCellsPanel.ArrangeOverride(Size finalSize)
in Telerik.Windows.Controls.TreeListView.TreeListCellsPanel.ArrangeOverride(Size finalSize)
in System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
in System.Windows.UIElement.Arrange(Rect finalRect)
in System.Windows.ContextLayoutManager.UpdateLayout()
in System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
in System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
in System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
in System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
in System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
in MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
in System.Windows.Threading.DispatcherOperation.InvokeImpl()
in System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Windows.Threading.DispatcherOperation.Invoke()
in System.Windows.Threading.Dispatcher.ProcessQueue()
in System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
in MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
in MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
in MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
in System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
in MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.Run(Form mainForm)
in SISCO.MileMATE.WinUI.Program.RunApplication(Boolean mailBugEnabled) in ****\Program.cs:riga 157
in SISCO.MileMATE.WinUI.Program.Main(String[] args) in ****\Program.cs:riga 114
in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
I notice that sometimes the Mousedown works correctly by selecting the cell being clicked.
Other times, it will scroll back to the top.
I've attempted to add the following code to handle tho Mouse Left Button, and it builds, but doesn't compile.
In constructor:
gridLineItem.MouseLeftButtonDown += new MouseButtonEventHandler(gridLineItem_MouseDown);
And later on:
private void gridLineItem_MouseDown(object sender, MouseEventArgs e)
{
var foo = 42;
}
If I add a debugger breakpoint inside gridLineItem_MouseDown, it doesn't fire.
The goal is to have the Mouse Left Button consistently select the cell clicked on, and not to scroll to the top.
Any suggestions?
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Windows.Threading; public class DispatchableObservableCollection<T> : ObservableCollection<T> { public DispatchableObservableCollection() { } public DispatchableObservableCollection(IEnumerable<T> collection) : base(collection) { } // Override the event so this class can access it public override event NotifyCollectionChangedEventHandler CollectionChanged; protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { // Be nice - use BlockReentrancy like MSDN said using (BlockReentrancy()) { NotifyCollectionChangedEventHandler eventHandler = CollectionChanged; if (eventHandler != null) { Delegate[] delegates = eventHandler.GetInvocationList(); // Walk thru invocation list foreach (NotifyCollectionChangedEventHandler handler in delegates) { DispatcherObject dispatcherObject = handler.Target as DispatcherObject; // If the subscriber is a DispatcherObject and different thread if (dispatcherObject != null && !dispatcherObject.CheckAccess()) { // Invoke handler in the target dispatcher's thread dispatcherObject.Dispatcher.Invoke(DispatcherPriority.DataBind, handler, this, e); } else // Execute handler as is { handler(this, e); } } } } } }
Hi,
I have to create a simple page that display same group of controls in a tab item multiple times. Idea is that user can click a button and create a copy of that UI multiple times.
Is there a way to do it without creating a user control? A simple way to create a copy of the selected tab will be helpful. Kindly let me know if there is any possibility to do so.
Hi Team,
I have a problem with Telerik RadGridView 2015.1.225.40 version on Windows 7 64 bits. In my application I show a virtualized grid with a large number of columns (up to 45 although the user can select the columns to see). Data types are showing dates, text, images, combos, etc. The number of rows can vary but usually not more than 40.
The columns are created dynamically in the ViewModel. Depending on the type of data to show, a different type of column is used. To show simple data is used GridViewDataColumn but to show more specific data (e.g. dates) types of custom columns are used. An example is:
var colduracion =
new
RadTimePickerColumn();
colduracion.Width = tamano;
colduracion.MinWidth = 40.0;
colduracion.UniqueName = col.Columna.Id.ToString();
colduracion.Header =
" "
+ col.Nombre +
" "
;
if
(binding.Path.Path !=
string
.Empty)
{
colduracion.DataMemberBinding = binding;
}
colduracion.IsFilterable =
true
;
colduracion.IsSortable =
true
;
colduracion.IsReadOnly = !col.Columna.Editable;
if
(col.Columna.Orden == 0)
{
colduracion.IsVisible =
false
;
}
this
.grid.Columns.Add(colduracion);
The RadTimePickerColumn type is declared as follows:
internal
class
RadTimePickerColumn : GridViewBoundColumnBase
{
#region Fields
/// <summary>
/// Campo que controla lo que se pinta.
/// </summary>
private
MediaTextBox mediaTextBox =
null
;
/// <summary>
/// Campo que controla lo que se pinta en modo de edición.
/// </summary>
private
MediaTextBox mediaTextBoxEdit =
null
;
#endregion
#region Methods
/// <summary>
/// Crea el cóntenido de la celda en modo solo lectura.
/// </summary>
/// <param name="cell">Celda de la que se crea el contentido.</param>
/// <param name="dataItem">Origen de datos.</param>
/// <returns>Contenido de la celda,</returns>
public
override
FrameworkElement CreateCellElement(GridViewCell cell,
object
dataItem)
{
this
.mediaTextBox =
this
.CreateElement(dataItem);
return
this
.mediaTextBox;
}
/// <summary>
/// Get New Value From Editor
/// </summary>
/// <param name="editor"> editor Element</param>
/// <returns>object Element re</returns>
public
override
object
GetNewValueFromEditor(
object
editor)
{
var mts = editor
as
MediaTextBox;
if
(mts !=
null
)
{
return
mts.Time;
}
else
{
return
null
;
}
}
/// <summary>
/// Update Source With Editor Value
/// </summary>
/// <param name="gridViewCell"> editor Element</param>
/// <returns>object Element re</returns>
public
override
IList<
string
> UpdateSourceWithEditorValue(GridViewCell gridViewCell)
{
List<
string
> errors =
new
List<
string
>();
var editor = gridViewCell.GetEditingElement()
as
MediaTextBox;
var bindingExpression = editor.ReadLocalValue(MediaTextBox.TimeProperty)
as
BindingExpressionBase;
if
(bindingExpression !=
null
)
{
bindingExpression.UpdateSource();
errors.AddRange(Validation.GetErrors(editor).Select(d => d.ErrorContent.ToString()).ToList());
}
return
errors;
}
/// <summary>
/// Create Cell Edit Element
/// </summary>
/// <param name="cell"> Cell Edit Element</param>
/// <param name="dataItem">data Item</param>
/// <returns>Framework Element</returns>
public
override
FrameworkElement CreateCellEditElement(GridViewCell cell,
object
dataItem)
{
this
.mediaTextBoxEdit =
this
.CreateElement(dataItem);
this
.mediaTextBoxEdit.IsReadOnly =
false
;
return
this
.mediaTextBoxEdit;
}
/// <summary>
/// Crea el control para pintar la celda.
/// </summary>
/// <param name="dataItem">Origen de datis.</param>
/// <returns>Control utilizado para pintar el valor.</returns>
private
MediaTextBox CreateElement(
object
dataItem)
{
var mediaTextBox =
new
MediaTextBox
{
AutoValidateTime =
true
,
FractionAdjust = FractionAdjust.Truncate,
FractionSeparator =
'.'
,
Fps = 25,
IsReadOnly =
true
,
Height = 20,
TimeFormat = MediaTimeSpanStringFormat.HHmmssff,
Width = 100
};
if
(dataItem
is
Dto.MediaUIDto)
{
mediaTextBox.SetBinding(MediaTextBox.FpsProperty,
"Fps"
);
}
var binding =
new
Binding(
this
.DataMemberBinding.Path.Path);
binding.Mode = BindingMode.TwoWay;
binding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;
mediaTextBox.SetBinding(MediaTextBox.TimeProperty, binding);
return
mediaTextBox;
}
// CreateElement
#endregion
}
<
telerik:RadGridView
x:Name
=
"GridFilasGrid"
Margin
=
"-2,48,0,48"
AlternationCount
=
"2"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserFreezeColumns
=
"True"
CanUserInsertRows
=
"False"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"False"
FocusVisualStyle
=
"{x:Null}"
GridLinesVisibility
=
"Both"
IsReadOnly
=
"True"
ItemsSource="{Binding FilasGrid,
Mode
=
TwoWay
,
NotifyOnSourceUpdated
=
True
}"
ScrollMode
=
"Deferred"
RowIndicatorVisibility
=
"Collapsed"
SelectedItem="{Binding
Path
=
FilaSeleccionada
,
Mode
=
TwoWay
}"
SelectionMode
=
"Single"
ShowGroupPanel
=
"False"
Style
=
"{DynamicResource EstiloRejillaDatos}"
VirtualizingPanel.CacheLength
=
"5"
VirtualizingPanel.CacheLengthUnit
=
"Item"
VirtualizingPanel.ScrollUnit
=
"Item"
VirtualizingPanel.VirtualizationMode
=
"Recycling"
Visibility
=
"Visible"
cal:Action.TargetWithoutContext="{Binding DataContext,
ElementName
=
LayoutRoot
}"
cal:Message.Attach="[Event Loaded] = [Action GridResultadoLoaded ($source, $eventargs)];
[Event MouseRightButtonUp] = [Action OnMouseRightButtonUp ($source, $eventargs)];
[Event MouseDown] = [Action OnMouseDown ($source, $eventargs)];
[Event MouseUp] = [Action OnMouseUp ($source, $eventargs)];
[Event CellValidating] = [Action OnCellValidating ($source, $eventargs)];
[Event CellValidated] = [Action OnCellValidated ($source, $eventargs)];
[Event BeginningEdit] = [Action OnBeginningEdit ($source, $eventargs)];
[Event ColumnReordered] = [Action OnColumnReordered ($source, $eventargs)];
[Event SelectionChanged] = [Action OnSelectionChanged ($source, $eventargs)]">
<
telerik:RadRadialMenu.RadialContextMenu
>
<
telerik:RadRadialMenu
x:Name
=
"RadContextMenu"
ItemsSource
=
"{Binding RadialMenuItems}"
StaysOpenOnShow
=
"True"
PopupPlacement
=
"MousePoint"
IsOpen
=
"True"
OuterRadiusFactor
=
"1"
Height
=
"300"
Width
=
"300"
>
<
telerik:RadRadialMenu.Resources
>
<
Style
TargetType
=
"telerik:NavigationItemButton"
>
<
Setter
Property
=
"Foreground"
Value
=
"White"
/>
<
Setter
Property
=
"Background"
Value
=
"DarkOrange"
/>
</
Style
>
<
Style
TargetType
=
"telerik:VisualStatesItemPresenter"
>
<
Setter
Property
=
"Background"
Value
=
"DarkOrange"
/>
<
Setter
Property
=
"ThicknessFactor"
Value
=
"0.2"
/>
<
Setter
Property
=
"ArrowThicknessFactor"
Value
=
"0.3"
/>
</
Style
>
<
Style
TargetType
=
"telerik:RadRadialMenuItem"
>
<
Setter
Property
=
"FontSize"
Value
=
"10"
/>
<
Setter
Property
=
"FontFamily"
Value
=
"Tahoma"
/>
</
Style
>
</
telerik:RadRadialMenu.Resources
>
</
telerik:RadRadialMenu
>
</
telerik:RadRadialMenu.RadialContextMenu
>
</
telerik:RadGridView
>
Hi,
I have below code implemented, which shows the formatted value.
<
telerik:RadMaskedCurrencyInput
x:Name
=
"uxCurrency"
Grid.Row
=
"8"
Grid.Column
=
"1"
Margin
=
"2,1"
Width
=
"170"
Style
=
"{StaticResource RadMaskedCurrencyInputStyle}"
Validation.ErrorTemplate
=
"{x:Null}"
FormatString
=
"c"
UpdateValueEvent
=
"PropertyChanged"
MaskedInput:MaskedInputExtensions.Maximum
=
"9999999999.99"
MaskedInput:MaskedInputExtensions.Minimum
=
"0"
Value
=
"{Binding CurrencyProperty,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True,NotifyOnTargetUpdated=True}"
MaskedInput:MaskedInputExtensions.IsEditorTabStop
=
"True"
/>
my query here is, the control does not update Property, when user hits "Delete" / "Backspace" Keyboard button. What is the possible workaround here?
Note: I don't want to use the "_" or " " mask here
I came across "IsValueChangingFromInternal " property of InputBase, but didn't get enough documentation or samples around it to figure out, if i could use that.
Can you please help me resolve the issue?
Thanks in Advance :)
Sagar
Hello,
I want to show the panzoombar when the user zoom the chart, and hide the panzoombar if there is no zoom. So I implement this:
I add tiggers in the a style for panzoombar:
<
Style.Triggers
><
br
> <
Trigger
Property
=
"Orientation"
Value
=
"Horizontal"
><
br
> <
Setter
Property
=
"Visibility"
Value
=
"{Binding HorizontalPanZoomBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
/><
br
> </
Trigger
><
br
> <
Trigger
Property
=
"Orientation"
Value
=
"Vertical"
><
br
> <
Setter
Property
=
"Visibility"
Value
=
"{Binding VerticalPanZoomBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
/><
br
> </
Trigger
><
br
> </
Style.Triggers
>
private
Size _zoom =
new
Size(1, 1);<br>
public
Size Zoom<br> {<br>
get
{
return
_zoom; }<br>
set
<br> {<br> _zoom = value;<br>
if
(Math.Abs(_zoom.Width - 1) < 0.00001f)<br> {<br> HorizontalPanZoomBarVisible =
false
;<br> }<br>
else
<br> {<br> HorizontalPanZoomBarVisible =
true
;<br> }<br><br>
if
(Math.Abs(_zoom.Height - 1) < 0.00001f)<br> {<br> VerticalPanZoomBarVisible =
false
;<br> }<br>
else
<br> {<br> VerticalPanZoomBarVisible =
true
;<br> }<br> }<br> }<br><br>
public
bool
VerticalPanZoomBarVisible<br> {<br>
get
<br> {<br>
return
_verticalPanZoomBarVisible;<br> }<br>
set
<br> {<br> _verticalPanZoomBarVisible = value;<br> RaisePropertyChanged(() => VerticalPanZoomBarVisible);<br> }<br> }<br><br>
private
bool
_horizontalPanZoomBarVisible;<br>
private
bool
_verticalPanZoomBarVisible;<br><br>
public
bool
HorizontalPanZoomBarVisible<br> {<br>
get
{
return
_horizontalPanZoomBarVisible; }<br>
set
<br> {<br> _horizontalPanZoomBarVisible = value;<br> RaisePropertyChanged(() => HorizontalPanZoomBarVisible);<br> }<br> }
The chart:
<telerik:RadCartesianChart Grid.Row="2" x:Name="Chart" Margin="20" Zoom="{Binding Zoom, Mode=TwoWay}">
The problem is, it work only for the first time, at the beginning, there is no zoom, so the panzoombar hides correctly, after I zoom, the panzoombar appear correctly, but if I reset zoom to (1,1), and zoom again, the panzoombar never appear, I don't know why? I use snoop to check and find out the visibility of the panzoombar is changed correctly, but I still can not see it.
Do you have any ideas?
Thanks,
Jie
Normally when you sort a column wether the groups are open or closed is remembered.
But when adding Custom sorting to RadGridView and all the groups are collapsed when sorting, but if you add AutoExpandGroups all groups are expanded.
I figure the reason is that the items are re-added to the collection.
I would really like to have the default behaviour, where the open groups are open and the closed are closed, event after sorting.
Is there a way to do this??
Regards
Martin