Telerik Forums
UI for WPF Forum
3 answers
479 views

Hello,

I'm using: Telerik 2019.1.116.45

1. I'm looking to display code in a read only view.  I have found the RichTextBox API for insert code block and I like the formatting and key word coloring for the CSharp setting.  I am wondering how can I interact with the Codeblock through MVVM, instead of calling the insert code api.  

 

2.  I have found that it takes a bit of time to load when the code is perhaps around 60-70 lines.  Any way/settings I can set to increase the speed?

Tanya
Telerik team
 answered on 18 Sep 2020
3 answers
453 views

Hello 

I am trying to migrate a WPF app to PRISM 7. 

The MainWindow (Shell) is a RadRibbonWindow, hence it doe not migrate as it seems it is not of type Window.

I followed the instructions highlighted here (https://docs.telerik.com/devtools/wpf/knowledge-base/kb-radwindow-prismapplication-createshell), but I am missing a critical piece of information.

- Where do I find the "TelerikShell" type? Which dll, out of the many Telerik dlls that comes with WPF?

Also, if you have a working sample application that used PRISM 7 that you can sher would appreciate it.

 

Thanks

Herald

Dilyan Traykov
Telerik team
 answered on 18 Sep 2020
16 answers
1.3K+ views
Is it possible to use a separate TextBox for the full text search? I'd would like to put the search text box in a toolbar on the UI.

Thanks,
Richard
Dilyan Traykov
Telerik team
 answered on 18 Sep 2020
1 answer
221 views
Hello,

during our development process we've been facing some problems with
one of your products (RadTimeline for WPF).

Situation:
Using the RadTimeline in WPF we have been trying to display expandable/collapsible timeline items,
the general idea is that each timeline item consists of a label and a RadExpander which contains a list of additional information, the size of the list varies from each timeline item to the next.

And while the timeline items themselves work as intended, their positioning on the timeline doesn’t.

While all items are collapsed, their positioning on the timeline is correct,
but when one or more items are expanded, the positioning of these items gets inconsistent,
with some items overlapping others and/or items moving down horizontally.
The hight of the timeline itself seems to increase disproportionally when items are expanded, even if there would have been enough place for them to be displayed on the timeline without its height being increased.

We would like to know if it is possible for timeline items to have different sizes,
And should this not be supported by the RadTimeline out of the box,
is there a way to modify the behaviour based on which the items are positioned on the timeline.
Dilyan Traykov
Telerik team
 answered on 18 Sep 2020
1 answer
239 views
Hi,

Our application have predefined document variables and we put these variables inside documents. Some of the variables contains singleline text but some of them have multiline text. For multiline text we add \v vertical tab for line break. When we add line break RadRichTextBox UI shows as we expected.
For example we added a text "Progress Telerik\vVertical Tab Test Second Line\vThird Line" and RadRichTextBox UI shows as

Progress Telerik
Vertical Tab Test Second Line
Third Line

But when we exported these xaml file as xaml format, final xaml file is not the same as shown in RadRichTextBox UI. The last line repeated for all the lines. Exported xaml file repeates "Third Line" line as shown below.


<t:Paragraph TextAlignment="Center">
  <t:FieldRangeStart AnnotationID="1">
    <t:DocumentVariableField DateTimeFormatting="" DisplayMode="Result" GeneralFormatting="" NumericFormatting="" VariableName="D_ALICI" />
  </t:FieldRangeStart>
  <t:Span BaselineAlignment="Baseline" FontFamily="Times New Roman" FontSize="16" FontStyle="Normal" FontWeight="Bold" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Strikethrough="False" Text="Third Line" ThemeForeColorShade="" ThemeForeColorTint="" ThemeUnderlineColorShade="" ThemeUnderlineColorTint="" UnderlineColor="#FF000000" UnderlineDecoration="None" />
  <t:Break BreakType="LineBreak" Text="¬" />
  <t:Span BaselineAlignment="Baseline" FontFamily="Times New Roman" FontSize="16" FontStyle="Normal" FontWeight="Bold" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Strikethrough="False" Text="Third Line" ThemeForeColorShade="" ThemeForeColorTint="" ThemeUnderlineColorShade="" ThemeUnderlineColorTint="" UnderlineColor="#FF000000" UnderlineDecoration="None" />
  <t:Break BreakType="LineBreak" Text="¬" />
  <t:Span BaselineAlignment="Baseline" FontFamily="Times New Roman" FontSize="16" FontStyle="Normal" FontWeight="Bold" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Strikethrough="False" Text="Third Line" ThemeForeColorShade="" ThemeForeColorTint="" ThemeUnderlineColorShade="" ThemeUnderlineColorTint="" UnderlineColor="#FF000000" UnderlineDecoration="None" />
  <t:FieldRangeEnd AnnotationID="1" />
</t:Paragraph>


How can we solve this problem?

You can download sample application and final xaml file from  https://we.tl/t-KYQh8XpGfF

Martin
Telerik team
 answered on 16 Sep 2020
3 answers
1.1K+ views
Hello,

I am working on an MVVM application.I have in view a ListBox which is bound to an ObservableDictionary in VM as follows:

C# VM:

private ObservableDictionary<string, bool> mCategories;
public ObservableDictionary<string, bool> Categories
{
get { return mCategories; }
set { mCategories = value; FirePropertyChanged("Categories"); }
}

Categories = new ObservableDictionary<string, bool>()
{
{ "Allgemein", true},
{ "Dampf", false},
{ "Fernwärme", false},
{ "Prozessabhängig", false},
{ "Stromverbrauch", false}
};



XAML VIEW:

<telerik:RadListBox ItemsSource="{Binding Categories}">
    <telerik:RadListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <CheckBox IsChecked="{Binding Value, Mode=TwoWay}"/>
                <TextBlock Text="{Binding Key, Mode=OneWay}"/>
            </StackPanel>
        </DataTemplate>
    </telerik:RadListBox.ItemTemplate>
</telerik:RadListBox>



I have the following problem: Binding seems not to work in the direction View to VM, that when I check a Checkbox the Value of the corresponding dictionary element will not be set to true, while it works in the other direction (VM to View) that when I set the Value of a dictionary elemnt in C# code (VM) the CheckBx is checked in View.

Any suggestion?

Thanks
Dilyan Traykov
Telerik team
 answered on 15 Sep 2020
5 answers
345 views

Hi,

I'm using  grid.SelectedItems.Add(row); in a loop to select rows on a grid. However sometimes I need to select 10,000+ rows and this can take over 15 seconds. I have tired .AddRange() but that takes the same amount of time. 

Is there a faster way to select items, especially with a very large number of rows?

Thanks,

Richard

Dilyan Traykov
Telerik team
 answered on 15 Sep 2020
7 answers
468 views

Hello,

I don't get any rows displayed when filtering with popup mode, grouping with drag&drop and sorting either by clicking on the column header or programatically.

And I get all my rows back when clearing filter/grouping/sorting either directly on the UI or programatically. Could you please help me?

 

Designer.xaml

<telerik:RadGridView x:Name="AttributesTable" ItemsSource="{Binding Path=Items}" RowDetailsVisibilityMode="Collapsed"
                             ScrollViewer.CanContentScroll="False" AutoGenerateColumns="False" CanUserSortColumns="True"
                             Sorting="AttributesTable_Sorting" PreparedCellForEdit="AttributesTable_PreparedCellForEdit"
                             CellEditEnded="AttributesTable_CellEditEnded"
                             FilteringMode="Popup" IsFilteringAllowed="True" MouseLeftButtonDown="AttributesTable_MouseLeftButtonDown"
                             FieldFilterEditorCreated="OnRadGridViewFieldFilterEditorCreated">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Button Style="{StaticResource NoChromeButton}" Command="{base:XamlRoot Path=DataContext.Navigate}" CommandParameter="{Binding}">
                                <Image Source="/STTAR;component/Resources/Object_Globe_16xLG.png" ToolTip="{base:ResX ResKey=CenterMapToolTip}"/>
                            </Button>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

 

Code.cs

columns = (this.DataContext as AttributesTableViewModel)?.Columns;
items = (this.DataContext as AttributesTableViewModel)?.Items;
DynAdapter = (this.DataContext as AttributesTableViewModel)?.DynAdapter;

if (columns.Count == 0)
{
    var temp = AttributesTable.Columns[0];
    AttributesTable.Columns.Clear();
    AttributesTable.Columns.Add(temp);
    return;
}
 
var alreadyInsertedColsNames = (from col in (AttributesTable.Columns as ObservableCollection<GridViewColumn>).Where(col => col.DisplayIndex != 0) select col.Header as string).ToList();
var colsNames = (from col in columns select col.DisplayName).ToList();
var notInsertedColsNames = colsNames.Except(alreadyInsertedColsNames).ToList();
var toRemoveColsNames = alreadyInsertedColsNames.Except(colsNames).ToList();
 
if (notInsertedColsNames.Count > 0)
    foreach (string colName in notInsertedColsNames)
    {
        FeatureAttribute selectedCol = columns.Where(col => col.DisplayName == colName).FirstOrDefault();
        var gridViewColumn = new GridViewDataColumn();
 
        switch (selectedCol.Name)
        {
            case FeatureAttributes.Cost:
                string costUnit = String.Format(" ({0})", DynAdapter.Project.Settings.CurrencyCode);
                gridViewColumn.Header = selectedCol.DisplayName + costUnit;
                break;
            case FeatureAttributes.Length:
                string lengthUnit = " (m)";
                gridViewColumn.Header = selectedCol.DisplayName + lengthUnit;
                break;
            case FeatureAttributes.Id:
            case FeatureAttributes.Source:
            case FeatureAttributes.Support:
                gridViewColumn.IsReadOnly = true;
                gridViewColumn.Header = selectedCol.DisplayName;
                break;
            default:
                gridViewColumn.Header = selectedCol.DisplayName;
                break;
        }
 

                       // GetBindingStringForAttribute returns ".[propertyName]"

        gridViewColumn.DataMemberBinding = new Binding(GetBindingStringForAttribute(selectedCol));
        gridViewColumn.FilterMemberPath = GetBindingStringForAttribute(selectedCol);
        gridViewColumn.FilterMemberType = selectedCol.DataType;
        gridViewColumn.DataType = selectedCol.DataType;
        gridViewColumn.ShowDistinctFilters = false;
        gridViewColumn.CellTemplateSelector = (DataTemplateSelector)GridContainer.Resources["CellTemplateSelector"];
        gridViewColumn.CellEditTemplateSelector = (DataTemplateSelector)GridContainer.Resources["CellEditTemplateSelector"];
        AttributesTable.Columns.Add(gridViewColumn);
    }
 
    foreach (string toRem in toRemoveColsNames)
    {
        var colToRemove = (AttributesTable.Columns as ObservableCollection<GridViewColumn>)
        .FirstOrDefault(col => col.Header == toRem);
        if (AttributesTable.Columns.Contains(colToRemove))
            AttributesTable.Columns.Remove(colToRemove);
    }
Vladimir Stoyanov
Telerik team
 answered on 15 Sep 2020
3 answers
177 views

We have our custom class for saving the grid configuration, i.e sorting/grouping/resizing/column order and we add Unloaded event on our grid like so:

            public static void Persistence(/*params here*/)

                  grid.Unloaded += (sender, args) =>
                  {
                         var data = GenerateGridSettings(grid, whatToSave, column => column.UniqueName);
                         if (data != null)
                              // save settings goes here
                   };

             }

Although this looks good and I as developer and the QA team do not get error messages, our customers get error messages, specifically "Object was not set to an instance of an object". The error output is this:

    2020/09/03 09:36:17.259 29 - 17832 Client.Global.Dispatcher FATAL Object reference not set to an instance of an object.
       at Controls.RadGridSupport.<>c.<Persistence>b__26_4(GridViewColumn column)
       at Controls.RadGridSupport.GenerateGridSettings(RadGridView rgv, RadGridSettingSelection whatToSave, Func`2 mapColumnToName)
       at Controls.RadGridSupport.<>c__DisplayClass26_0.<Persistence>b__1(Object sender, RoutedEventArgs args)
       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.RaiseEvent(RoutedEventArgs e)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

 

As if the column in the lambda expression "column => column.UniqueName" gets deleted at some point before unloaded event.

 

Is this possible? Can the column be deleted before the unloaded event?


Dilyan Traykov
Telerik team
 answered on 15 Sep 2020
2 answers
615 views

I have a nested Dictionary with 5 levels.

I would like to show it in the TreeView but I only get the first layer.

<telerik:RadTreeView x:Name="myTreeView"
                             MinWidth="200px"
                             ItemsSource="{Binding Areas}"
                             ItemTemplate="{StaticResource BuildingHDT}"
                             ItemContainerStyle="{StaticResource ItemContainerStyle}"
                             MaxHeight="{Binding ElementName=host, Path=ActualHeight}"
                             Grid.IsSharedSizeScope="True"
                             HorizontalContentAlignment="Stretch"
                             IsVirtualizing="True"
                             TextSearch.TextPath="Value.Name"
                             extension:ContextMenuBehavior.ContextMenu="{Binding ElementName=TreeContextMenu}">

            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu x:Name="TreeContextMenu"/>
            </telerik:RadContextMenu.ContextMenu>

            <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding OpenSelectedItem}"
                                      EventName="MouseLeftButtonDown"
                                      RaiseOnHandledEvents="True"
                                      PassEventArgsToCommand="True" />
            </telerik:EventToCommandBehavior.EventBindings>

        </telerik:RadTreeView>

 

<HierarchicalDataTemplate x:Key="QualifierHDT"
                                  DataType="{x:Type models:Qualifier}"
                                  ItemsSource="{Binding Qualifier}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Value.Name}" />
                <TextBlock Text="{Binding Value.AnnotationCount}" Margin="5 0 0 0" />
            </StackPanel>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="ComponentHDT"
                                  DataType="{x:Type models:Component}"
                                  ItemsSource="{Binding Component}"
                                  ItemTemplate="{StaticResource QualifierHDT}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Key}" />
                <TextBlock Text="{Binding Value.AnnotationCount}" Margin="5 0 0 0" />
            </StackPanel>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="SystemCollectionHDT"
                                  DataType="{x:Type models:SystemCollection}"
                                  ItemsSource="{Binding SystemCollection}"
                                  ItemTemplate="{StaticResource ComponentHDT}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Value.Name}" />
                <TextBlock Text="{Binding Value.AnnotationCount}" Margin="5 0 0 0" />
            </StackPanel>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="BuildingHDT"
                                  DataType="{x:Type models:Building}"
                                  ItemsSource="{Binding Buildings}"
                                  ItemTemplate="{StaticResource SystemCollectionHDT}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Value.Name}" />
                <TextBlock Text="{Binding Value.AnnotationCount}" Margin="5 0 0 0" />
            </StackPanel>
        </HierarchicalDataTemplate>

Fredrik
Top achievements
Rank 1
Veteran
Iron
 answered on 14 Sep 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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?