Telerik Forums
UI for WPF Forum
9 answers
350 views

Hello,

I have Windows 10 in English, but the date display in Swiss French.

In the save dialog (not checked the other ones, but it should be the same), the date and time are displayed in the US format, with AM/PM).

You must use the Windows settings to display the date and time correctly.

Dinko | Tech Support Engineer
Telerik team
 answered on 15 Jul 2020
4 answers
209 views

Hello,

I am trying to give my CodeBlocks inside a RichTextBox.Document a certain style.

Every character inside the CodeBlock should have the same FontFamily and FontSize.

To do this I am going the following way:

1.) Clear all existing styles inside the RichTextBox.CodeFormatter.

2.) Add my own styles.

The code looks like this:

            StyleDefinition styleWhite = new StyleDefinition(cl.GetCodeLanguage.Name + "StyleWhite", StyleType.Character);
            styleWhite.SpanProperties.ForeColor = Colors.White;
            styleWhite.SpanProperties.FontFamily = Wpf.Fonts.Fonts.GetFont(eFont.Consolas);
            styleWhite.SpanProperties.FontSize = Unit.PointToDip(fontSize);


            StyleDefinition styleKeyWord = new StyleDefinition(cl.GetCodeLanguage.Name + "StyleKeyword", StyleType.Character);
            styleKeyWord.SpanProperties.ForeColor  = colorKeyWord;
            styleKeyWord.SpanProperties.FontFamily = Wpf.Fonts.Fonts.GetFont(eFont.Consolas);
            styleKeyWord.SpanProperties.FontSize   = Unit.PointToDip(fontSize);

            StyleDefinition styleString = new StyleDefinition(cl.GetCodeLanguage.Name + "StyleString", StyleType.Character);
            styleString.SpanProperties.ForeColor = colorKeyWord;
            styleString.SpanProperties.FontFamily = Wpf.Fonts.Fonts.GetFont(eFont.Consolas);
            styleString.SpanProperties.FontSize = Unit.PointToDip(fontSize);

            StyleDefinition styleMethod = new StyleDefinition(cl.GetCodeLanguage.Name + "styleMethod", StyleType.Character);
            styleMethod.SpanProperties.ForeColor = colorKeyWord;
            styleMethod.SpanProperties.FontFamily = Wpf.Fonts.Fonts.GetFont(eFont.Consolas);
            styleMethod.SpanProperties.FontSize = Unit.PointToDip(fontSize);

            StyleDefinition styleComment = new StyleDefinition(cl.GetCodeLanguage.Name + "StyleComment", StyleType.Character);
            styleComment.SpanProperties.ForeColor = colorKeyWord;
            styleComment.SpanProperties.FontFamily = Wpf.Fonts.Fonts.GetFont(eFont.Consolas);
            styleComment.SpanProperties.FontSize = Unit.PointToDip(fontSize);



            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Comment);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Keyword);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Method);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.StringLiteral);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Attributes);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.CharacterLiteral);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Constants);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Data);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.ExcludedCode);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Identifier);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.NumberLiteral);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Operator);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.PreprocessorKeyword);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Variable);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.WhiteSpace);
            doc.CodeFormatter.UnregisterClassificationType(ClassificationTypes.Literal);

 

            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Comment, styleComment);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Keyword,  styleKeyWord);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Method,  styleMethod);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.StringLiteral,  styleString);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Attributes,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.CharacterLiteral,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Constants,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Data,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.ExcludedCode,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Identifier,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.NumberLiteral,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Operator,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.PreprocessorKeyword,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Variable,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.WhiteSpace,  styleWhite);
            doc.CodeFormatter.RegisterClassificationType(ClassificationTypes.Literal,  styleWhite);

 

The result of this code is, that I get different FontSizes inside the CodeBlock. See attached *.gif.

So my question is: Which styles do I need to change or add, to give CodeBlocks a consitent look?

Max
Top achievements
Rank 1
 answered on 15 Jul 2020
9 answers
516 views

Hello,

In the file dialogs, there is no shortcut for the controls. For example Alt+N to go to the "File name:" text box.

Martin Ivanov
Telerik team
 answered on 14 Jul 2020
4 answers
827 views

I updated my DLLs to the newest version  Telerik_UI_for_WPF_2020_2_617_Dev_Hotfix and now I get a reference conflict:

Severity    Code    Description    Project    File    Line    Suppression State
Warning        Could not resolve this reference. Could not locate the assembly "Telerik.Pivot.Core, Version=2019.2.618.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.            

Please refer to the attached image files for more details.

ClausDC
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 13 Jul 2020
1 answer
174 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
467 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
141 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
114 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
271 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
656 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
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?