Telerik Forums
UI for WPF Forum
1 answer
153 views

Are there any solutions for it in version before useful EnableSelectionCaching option was added?

https://docs.telerik.com/devtools/wpf/controls/radlistbox/features/selection#disabling-caching-of-selected-items 

"Disabling Caching of Selected Items
By default, when its ItemsSource is reset, RadListBox will try to restore any previously selected items through its built-in caching mechanism. As of R1 2017, RadListBox allows you to disable this functionality by setting its new EnableSelectionCaching property to False."

Dinko | Tech Support Engineer
Telerik team
 answered on 13 Jul 2020
2 answers
440 views
I am using contextmenu on my wpf project. I tried customize the items background on focus but I can't find a way to remove the yellow highlights color. Any idea on how I can override this property?
gerardo
Top achievements
Rank 1
Veteran
 answered on 12 Jul 2020
2 answers
132 views

How can I apply animation on contextmenu show. I'am trying apply ShowDelay and HideDelay properties but it shows no effect.

gerardo
Top achievements
Rank 1
Veteran
 answered on 12 Jul 2020
1 answer
106 views

I'm trying to make a Grid with "labeled" connectors. 

Each cell of the grid contains a TextBlock and a RadDiagramConnector. 

The problem is that the behavior of the standalone RadDiagramConnector in the grid cell is not the same as a RadDiagramConnector inside the RadDiagramShape.Connectors collection. It is for example not possible to use it as a target connector. It also loses its connection when used as a source connector, when the shape is dragged.

Is it possible to use the `RadDiagramConnector` standalone (not part of the RadDiagramShape.Connectors collection)? How would that be possible?

Thank you!

Martin Ivanov
Telerik team
 answered on 10 Jul 2020
1 answer
256 views

Hello,

I want to store RadDocument object in the database table as byte[]. Is any way do that?

(I don`t want to use export/import, because seems it is not export all data (ex. don`t export "tracking changes", etc)).

Martin
Telerik team
 answered on 10 Jul 2020
3 answers
605 views

I want to be able to render an image from a RadMap control without displaying the map control. I can see the map control rendered in my png but the map background (in this case OSM) does not get rendered with the image. I assume this happens because the map data hasn't yet been retrieved. 

public class MapRender
{
    private Thread _thread;
 
    public void StartRender()
    {
        ThreadStart start = ScreenshotMap; // Render;
        _thread = new Thread(start);
        _thread.SetApartmentState(ApartmentState.STA);
 
        _thread.Start();
    }
 
    private void ScreenshotMap()
    {
        var imageSize = 800;
 
        var osmBasedMapProvider = new OsmBasedMapProvider();
 
        var radMap = new RadMap()
        {
            Provider = osmBasedMapProvider,
            RenderSize = new Size(imageSize, imageSize), Height = imageSize, Width = imageSize
        };
 
        radMap.Loaded += RadMap_Loaded;
        radMap.InitializeCompleted += RadMap_InitializeCompleted;
        radMap.SizeChanged += RadMap_SizeChanged;
 
        var c = new Canvas { Width = imageSize, Height = imageSize };
        c.Children.Add(new Rectangle { Height = imageSize, Width = imageSize, Fill = new SolidColorBrush(Colors.Red) });
        c.Children.Add(radMap);
 
        var dpi = 80;
 
        var bitmap = new RenderTargetBitmap((int)c.Width, (int)c.Height, dpi, dpi, PixelFormats.Default);
        c.Measure(new Size((int)c.Width, (int)c.Height));
        c.Arrange(new Rect(new Size((int)c.ActualWidth, (int)c.ActualHeight)));
        bitmap.Render(c);
 
        var png = new PngBitmapEncoder();
        png.Frames.Add(BitmapFrame.Create(bitmap));
 
        using (Stream stm = File.Create("c:\\temp\\map.png"))
        {
            png.Save(stm);
        }
 
        //radMap.ExportToImage("c:\\temp\\map2.png", true);
    }
}

Is there some way for me to wait for the map data to be retrieved before saving the image file?

Thanks
Pete

Martin Ivanov
Telerik team
 answered on 09 Jul 2020
1 answer
276 views

I am using the Fluent theme implicitly (noxaml). If I use a standard Window as my main window, it appears correctly and the controls are properly themed.

However, if I change the main window to use RadWindow (and make the appropriate change to override OnStartup in App.xaml), at runtime the window does not appear.

I'm thinking that it may be that the RadWindow is rendering before the styling has been loaded. The RadWindow does render correctly in the designer.

Any thoughts on this?

Martin Ivanov
Telerik team
 answered on 09 Jul 2020
1 answer
107 views
Is there any way to delete DocumentLists from a RadDocument? I don't want to create a new RadDocument because I will lose the styles that I applied. 
Martin
Telerik team
 answered on 09 Jul 2020
18 answers
261 views
Hi.
I need show after day in calendar some number.
This my sources:
<telerik:RadDateTimePicker>
    <telerik:RadDateTimePicker.CalendarStyle>
        <Style TargetType="{x:Type telerik:RadCalendar}">
            <Setter Property="DayTemplateSelector" Value="{StaticResource CalendarCountTask}"/>
        </Style>
    </telerik:RadDateTimePicker.CalendarStyle>
</telerik:RadDateTimePicker>
<a:CustomTemplateSelector x:Key="CalendarCountTask">
    <a:CustomTemplateSelector.DefaultTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Text}"/>
        </DataTemplate>
    </a:CustomTemplateSelector.DefaultTemplate>
    <a:CustomTemplateSelector.CustomTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Text}" Foreground="RoyalBlue"/>
        </DataTemplate>
    </a:CustomTemplateSelector.CustomTemplate>
</a:CustomTemplateSelector
public class CustomTemplateSelector : DataTemplateSelector
{
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        CalendarButtonContent content = item as CalendarButtonContent;
        foreach (KeyValuePair<DateTime, short> oneDay in winDebtorInfo.TaskCountList)
        {
            if (oneDay.Key == content.Date)
            {
                content.Text += "(" + oneDay.Value + ")";
                return CustomTemplate;
            }
        }
        return DefaultTemplate;
    }
 
    public DataTemplate DefaultTemplate
    {
        get;
        set;
    }
 
    public DataTemplate CustomTemplate
    {
        get;
        set;
    }
}
>

winDebtorInfo.TaskCountList is source for days, for which there is number for showing.

This working, but sometimes there is exception:

System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Windows.WeakReferenceList`1.WeakReferenceEnumerator.get_Current() at Telerik.Windows.Controls.SelectionChanger`1.SynchronizeInternalSelection() at Telerik.Windows.Controls.SelectionChanger`1.End() at Telerik.Windows.Controls.SelectionChanger`1.AddJustThis(T item) at Telerik.Windows.Controls.RadCalendar.AddToSelection(DateTime selectedDate, Boolean controlKeyDown, Boolean shiftKeyDown) at Telerik.Windows.Controls.RadCalendar.Select(DateTime selectedDate, Boolean forceSelection) at Telerik.Windows.Controls.Calendar.CalendarView.AddDate(Object sender) at Telerik.Windows.Controls.Calendar.CalendarView.HandleMouseEvents(Object sender, MouseButtonEventArgs e) at Telerik.Windows.Controls.Calendar.CalendarView.CalendarButtonMouseLeftButtonDown(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(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)

What would it be?
Thank you.

Vladimir Stoyanov
Telerik team
 answered on 09 Jul 2020
1 answer
177 views

Hi there,

I'm trying to display a range series that is defined by a collection and a gap.

The ObservableCollection is defining the upper limit. The lower limit is defined by the upper limit minus the gap.

For this display I want to use a value converter that returns the lower limit for each upper limit.

<telerik:RadCartesianChart>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis />
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.Series>
        <telerik:RangeSeries ItemsSource="{Binding Path=SensorParameter.Range_UpperLimit}" HighBinding="Range_UpperLimit" CategoryBinding="RPM">
            <telerik:RangeSeries.LowBinding>
                <MultiBinding Converter="{StaticResource ConvertOKLowValue}">
                    <Binding Path="Range_UpperLimit" />
                    <Binding Path="Range_Gap" />
                </MultiBinding>
            </telerik:RangeSeries.LowBinding>
        </telerik:RangeSeries>
    </telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>

 

The SensorParameter struct looks like this:

01.public class RPM_Range : ObservableObject
02.{
03.    public float Range_Gap { get; set; }
04.    public ObservableCollection<Range_Limit> Range_UpperLimit { get; set; }
05.}
06. 
07.public class Range_Limit: ObservableObject
08.{
09.    public float RPM
10.    {
11.        get; set;
12.    }
13. 
14.    public float OK_Range_UpperLimit
15.    {
16.        get; set;
17.    }
18.}

 

The value converter is implemented like this:

01.public class RangeSeriesLowConverter : IMultiValueConverter
02.{
03.    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
04.    {
05.        double? _RangeUpperLimit = values[0] as double?;
06.        double? _RangeGap = values[1] as double?;
07.        if (_RangeUpperLimit - _RangeGap < 0)
08.            return 0;
09.       return _RangeUpperLimit - _RangeGap;
10.    }
11. 
12.    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
13.    {
14.        throw new NotImplementedException();
15.    }
16.}

 

UpperLimit binds correctly. But I'm not getting the binding to the lower limit correctly. While debugging the value converter is called, but the arguments are not passed correctly.

Is there a restriction using value converters for the low binding?

 

Thanks in advance for your help.

Kindly

Philipp

Martin Ivanov
Telerik team
 answered on 09 Jul 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?