Telerik Forums
UI for WPF Forum
2 answers
449 views

Hi,

I created a new net5.0 WPF application in Visual Studio (16.9.6) and installed the Progress UI for WPF Extension. I added the Telerik Nuget source and installed the package "Telerik.UI.for.Wpf.NetCore.Xaml". I added the Telerik namespace (http://schemas.telerik.com/2008/xaml/presentation) to my main view and I am able to add controls from that namespace in the XAML code just fine including Intellisense support. I also see all the Telerik controls in the VS Toolbox and I can drag controls onto my view in the designer.

But, all the controls are invisible in the designer and also at runtime. No errors during design time or compilation whatsoever. Seems like there is no default theme applied at all. I already tried to explicitly set a theme but all the controls stay invisible. Default WPF controls work without any issue...

I've been working with Telerik and WPF for 10 years now and I never had a similar issue so far. Docs and forums did not lead me on the right trace unfortunately. Help would be much appreciated!

Thanks!

Marcel
Top achievements
Rank 1
Iron
 answered on 20 May 2021
1 answer
666 views

 I would like to set the value of the RadRichTextBox to a property in the view Model. and similarly I would like to get the valueof the Property and bind it to the RadRichTextBox in the WPF UI.

What would be the Syntax used in the XAML file?

I have something like this below in the XAML file.

 <telerik:RadRichTextBox x:Name="radRichTextBox" DocumentInheritsDefaultStyleSettings="True" AcceptsTab="True" AcceptsReturn="True" ScrollViewer.VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" Language="en-US" IsContextMenuEnabled="True" Margin="250,190,121,70" VerticalScrollBarVisibility="Hidden"/>
  <telerik:TxtDataProvider Source="{Binding Path=Customer.Notes,ElementName=radRichTextBox, Mode=TwoWay}"/>

 

But the value is not bound to the Path "Customer.Notes" in the viewmodel.

Tanya
Telerik team
 answered on 19 May 2021
0 answers
226 views

Hi,

My ViewModel implements INotifyDataErrorInfo

I want to use an attached property Validation.ValidationAdornerSiteFor

RadComboBox highlights an error but tooltip is empty

Is there something I need to enable?

                            <telerik:RadComboBox
                                ItemsSource="{Binding Path=ItemsSource}" Validation.ValidationAdornerSiteFor="{Binding ElementName=selectorBehavior}"
                                AllowMultipleSelection="True"
                                MultipleSelectionSeparator=";">
                                <b:Interaction.Behaviors>
                                    <behaviors:SelectedItemsMultiSelectorBehavior x:Name="selectorBehavior" SelectedItems="{Binding Path=SelectedItems, Mode=TwoWay}" />
                                </b:Interaction.Behaviors>
                            </telerik:RadComboBox>


Alex
Top achievements
Rank 1
 asked on 19 May 2021
2 answers
293 views

Hi to all,

Maybe someone can help me with my problem. Thank you all in advance for any suggestions.

When I programmatically add a row/item to the RadGridView I have always am empty row above the last row:

 

Here is my XAML code:

            <Border x:Name="m_borderOperands" BorderThickness="3" CornerRadius="5" >
                <telerik:RadGridView x:Name="m_dgOperands" Margin="1" Background="#FF2C2C2C" CanUserGroupColumns="False" 
                                     telerik:StyleManager.Theme="Expression_Dark" BorderThickness="0"
                                     SelectionMode="Extended" SelectionUnit="Mixed" CanUserSortColumns="False" 
                                     CanUserSelectColumns="True" ShowColumnFooters="False" ShowColumnHeaders="True" 
                                     IsFilteringAllowed="False" CanUserFreezeColumns="False" CanUserDeleteRows="False" 
                                     ClipboardPasteMode="Cells" ClipboardCopyMode="Cells" 
                                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                     ScrollViewer.VerticalScrollBarVisibility="Visible" 
                                     ShowGroupPanel="false" EditTriggers="TextInput" GroupRenderMode="Flat" 
                                     FontSize="14" MaxWidth="2560" MaxHeight="1600" ValidatesOnDataErrors="InEditMode" 
                                     EnableColumnGroupsVirtualization="True" EnableColumnVirtualization="True" 
                                     EnableRowVirtualization="True" CanUserInsertRows="False" EnableStickyGroupHeaders="False" 
                                     ColumnsSelectionButtonVisibility="Collapsed" ShowGroupFooters="True"
                                     FrozenColumnsSplitterVisibility="Collapsed" />
            </Border>

Here are my GridView styles:

    <UserControl.Resources>
        <Style TargetType="telerik:GridViewHeaderCell">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <RotateTransform Angle="-90" />
                </Setter.Value>
            </Setter>
            <EventSetter Event="PreviewMouseUp" Handler="GridViewHeaderCell_PreviewMouseUp"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="Margin" Value="1,10,1,3"/>
        </Style>

        <Style TargetType="telerik:GridViewHeaderRow">
            <Setter Property="MinHeight" Value="10"/>
        </Style>
        <Style TargetType="telerik:GridViewFooterRow">
            <Setter Property="Background" Value="#FF303030"/>
        </Style>
        <Style TargetType="telerik:GridViewCell">
            <Style.Triggers>
                <Trigger Property="Value" Value="1">
                    <Setter Property="Background" Value="#4CFFFF00" />
                </Trigger>
                <Trigger Property="Value" Value="2">
                    <Setter Property="Background" Value="#4C32CD32" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="telerik:CommonColumnHeader">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontWeight" Value="Bold"></Setter>
            <Setter Property="Background" Value="#FF303030" />
        </Style>
        <DataTemplate x:Key="GridViewCellImageTextTemplate">
            <StackPanel Orientation="Horizontal">
                <Image Source="{Binding Image}" Margin="0,0,5,0" MaxHeight="16" MaxWidth="16" />
                <TextBlock Text="{Binding InfoText}"/>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>

And here my c# code:
        private void AddStepToDataGrid(SelmoCreatorStepBase stepBase, int idxInsert)
        {
            if (idxInsert >= 0)
            {
                m_dgOperands.Items.Insert(idxInsert, stepBase);
            }
            else
            {
                m_dgOperands.Items.Add(stepBase);
            }
        }

I appreciate any help.

Best regards

Christoph

cwider
Top achievements
Rank 1
Iron
 answered on 18 May 2021
1 answer
233 views

Hey,

I am using DataForm with custom field to display one of my complex properties for editing.
I am having an issue with Null reference exceptions from within the Telerik DataForm code when my control extends from a textbox. 

I have reproduced the issue in a small sample app that doesn't have any of the complexities of my actual application.
What happens is if you run the application and click Ok or Cancel on the dataform buttons it will through a null reference exception.
This only happens if the HotKeyInputBox extens from a TextBox, if it extends from a Button or other type of control it doesn't throw the exception. Based on my implementation I need to extend it from a TextBox. I can't see any reason it should be throwing an exception.

Any help with getting this working would be fantastic.

MainWindow.xaml

<Window x:Class="DataFormBugDemo.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:local="clr-namespace:DataFormBugDemo"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 mc:Ignorable="d"
                 Title="MainWindow" Height="450" Width="800">
    <Grid>
        <telerik:RadDataForm CurrentItem="{Binding Source={x:Static local:Setting.Instance}}" 
                             AutoEdit="True" AutoGenerateFields="True" AutoGeneratingField="RadDataForm_OnAutoGeneratingField"/>
    </Grid>
</Window>

MainWindow.xaml.cs

using System.Windows;
using System.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Data.DataForm;

namespace DataFormBugDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        public MainWindow()
        {
            StyleManager.ApplicationTheme = new Office2019Theme();
            Office2019Palette.LoadPreset(Office2019Palette.ColorVariation.Dark);
            InitializeComponent();
        }

        private void RadDataForm_OnAutoGeneratingField(object sender, AutoGeneratingFieldEventArgs e)
        {
            e.DataField.DataMemberBinding.NotifyOnSourceUpdated = true;
            e.DataField.DataMemberBinding.NotifyOnValidationError = true;
            e.DataField.DataMemberBinding.ValidatesOnDataErrors = true;
            e.DataField.DataMemberBinding.ValidatesOnNotifyDataErrors = true;
            e.DataField.DataMemberBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            if (e.PropertyType == typeof(HotKey))
            {
                var dataField = new DataFormHotKeySettingsField()
                {
                    Label = e.DataField.Label,
                    DataMemberBinding = e.DataField.DataMemberBinding,
                    Description = e.DataField.Description
                };
                e.DataField = dataField;
            }
        }
    }
}

DataFormHotKeySettingsField.cs

using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using Telerik.Windows.Controls;

namespace DataFormBugDemo
{
    public class DataFormHotKeySettingsField : DataFormDataField
    {
        protected override DependencyProperty GetControlBindingProperty()
        {
            return HotKeyInputBox.HotKeyProperty;
        }

        protected override Control GetControl()
        {
            var dependencyProperty = GetControlBindingProperty();
            var inputBox = new HotKeyInputBox();
            if (DataMemberBinding != null)
            {
                var binding = DataMemberBinding;
                binding.Mode = BindingMode.TwoWay;
                inputBox.SetBinding(dependencyProperty, binding);
            }
            inputBox.SetBinding(IsEnabledProperty, new Binding("IsReadOnly") { Source = this, Converter = new InvertedBooleanConverter() });
            return inputBox;
        }
    }
}

HotKeyInputBox.cs

using System.Windows;
using System.Windows.Controls;

namespace DataFormBugDemo
{
    class HotKeyInputBox : TextBox
    {
        public static readonly DependencyProperty HotKeyProperty = DependencyProperty.Register(
            "HotKey", typeof(HotKey), typeof(HotKeyInputBox), new PropertyMetadata(default(HotKey)));

        public HotKey HotKey
        {
            get { return (HotKey)GetValue(HotKeyProperty); }
            set { SetValue(HotKeyProperty, value); }
        }

        public static readonly DependencyProperty DisplayTextProperty = DependencyProperty.Register(
            "DisplayText", typeof(string), typeof(HotKeyInputBox), new PropertyMetadata(default(string)));

        public string DisplayText
        {
            get { return (string)GetValue(DisplayTextProperty); }
            set { SetValue(DisplayTextProperty, value); }
        }

        public HotKeyInputBox()
        {
            DisplayText = "None";
        }
    }
}

HotKey.cs

using System.Windows.Input;

namespace DataFormBugDemo
{
    public class HotKey
    {
        public bool IsEnabled { get; set; }

        public Key Key { get; set; }
    }
}

Setting.cs

using PropertyChanged;

namespace DataFormBugDemo
{
    [AddINotifyPropertyChangedInterface]
    public class Setting
    {
        public static Setting Instance { get; }
        static Setting()
        {
            Instance = new Setting();
        }

        public string Name { get; set; } = "Test Name";

        public HotKey HotKey { get; set; } = new HotKey();
    }
}

App.xaml

<Application x:Class="DataFormBugDemo.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:DataFormBugDemo"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
      <!-- HotKeyInputBox -->
      <ControlTemplate x:Key="HotKeyInputBoxTemplate" TargetType="local:HotKeyInputBox">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <Border Grid.Column="0" BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
                  Padding="0" Name="PART_Border" VerticalAlignment="Center">
            <StackPanel Orientation="Horizontal">
              <TextBlock Text="{TemplateBinding DisplayText}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding Foreground}"
                         MinWidth="150" Margin="0" />
            </StackPanel>
          </Border>
        </Grid>
      </ControlTemplate>

      <Style TargetType="local:HotKeyInputBox">
        <Setter Property="Template" Value="{StaticResource HotKeyInputBoxTemplate}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="BorderBrush" Value="{telerik:Office2019Resource ResourceKey=MainBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Background" Value="{telerik:Office2019Resource ResourceKey=SecondaryBackgroundBrush}" />
        <Setter Property="Foreground" Value="{telerik:Office2019Resource ResourceKey=MainForegroundBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />

      </Style>
    </Application.Resources>
</Application>


Vladimir Stoyanov
Telerik team
 answered on 18 May 2021
1 answer
224 views

I have a Winforms App Where I am binding Telerik WPF ReportViewer control onto a Winforms app....

It quite nearly works.

All the Binding Works for my Telerik report But 'Find' ComboBox Is not working as well as when we embed into a WPF Application?

**** UPDATE I found that the Find COMBO Box is Enabled It is, however, Only accepting <SPACE> <BACKSPACE> <CTRL-V> of course I want this limitation removed.  Meaning if I pasted any Search Terms in to the Dialog box Telerik will find the items in the Report****

I have proven binding by using Visual Property Live Inspector to modify Token Value at runtime. When I modify Token in Visual Studio Live Property Editor it searches report and then highlights as requested. If you can tell me what i must do to enable the Find Text Box the Software will be now be deliverable. Follow the Yellow Higlighted areas in attached pic with word "When" in the Live Visual Property Editor

*** UPDATE ***

I have since learned that where Modeless Operations are required when WPF is being embedded in a Winforms App The Modeless Window (ie your Find Window) must Call  the static Method

ElementHost.EnableModelessKeyboardInterop(Window) Method

Does the Telerik.Reporting.Wpf Have property that in turn issues this important API Call so that the Search Window will work modelessly and correctly inside a Winforms Host?

Kind Regards,

Mark

 

 

 

Todor
Telerik team
 answered on 17 May 2021
1 answer
193 views

See the attached video. 

I am using SaveFileDialog to select a folder to save my object. It works great but it seems there is a delay to invoke the dialog and VS shows there is a binding error when the SaveFileDialog Showed. But I don't have anything bind with SaveFileDialog.

If you need any extra code. I can attach it here. it is a very simple Invoke function to show the dialog.

Martin Ivanov
Telerik team
 answered on 17 May 2021
3 answers
758 views

Hello.

Look at my image. Is it possible to have rowspan and columnspan in grid?

There were a lot of examples in which empty space was left above when only the column span was used.
I confirmed that the previous post was not implemented. Is it possible now? Is it still?

Thanks.

Martin Ivanov
Telerik team
 answered on 17 May 2021
5 answers
147 views

Hi,

I have a step line chart with the trackball enabled. The ChartTrackBallBehavior is like this.

<telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="True" SnapMode="None" SnapSinglePointPerSeries="True"/>

 

My problem is that the closest point can be on the left or on the right of the trackball line. I need the closest point to be always the one on the left. Is there a way to change the default behavior so that I can programmatically set the closest point when trackball line moves? I have attached an image to better explain my problem.

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 14 May 2021
1 answer
334 views

Hello,

I've built an application that uses .Net Core 3.1 and the Prism MVVM package.

I have a RadPdfViewerToolBar and a RadPdfViewer on the view. I generate documents and render the output using the following logic. This logic works fine repeatedly for every document I generate. However, if I click the Save button in the RadPdfViewerToolBar, the RadPdfViewer stops updating. I have to restart the program to get the controls working again.

Xaml:


<Grid>
	<telerik:RadPdfViewerToolBar x:Name="pdfViewerToolbar" RadPdfViewer="{Binding ElementName=pdfViewer, Mode=OneTime}" Margin="0" FocusManager.IsFocusScope="False"
				HasClockwiseButton="False" HasCounterclockwiseButton="False" HasOpenButton="True" HasSaveButton="True" HasSignatureButton="False" />
	<telerik:RadButton Command="{Binding CommandCopy}" Margin="0 -4 8 0" Padding="0" Height="26" Width="24" HorizontalAlignment="Right">
		<Image Margin="0" Height="16" Width="16" Source="{telerik:RadGlyph Glyph={StaticResource GlyphCopy}, Foreground=Black}" HorizontalAlignment="Left" />
	</telerik:RadButton>
</Grid>
<ScrollViewer Grid.Row="1" Margin="0">
	<telerik:RadPdfViewer x:Name="pdfViewer"
			DocumentSource="{Binding PdfDocument}"
			RenderOptions.BitmapScalingMode="HighQuality"
			Height="580"
			Margin="0 -2 0 0"
			DocumentChanged="pdfViewer_DocumentChanged"/>
</ScrollViewer>
<telerik:RadBusyIndicator Grid.Row="1" IsBusy="{Binding IsBusy}"/>


Code-behind:


private PdfDocumentSource _pdfDocument;
public PdfDocumentSource PdfDocument
{
	get => _pdfDocument;
	set
	{
		SetProperty(ref _pdfDocument, value);
	}
}

 

protected override async Task LoadViewModel() { IsBusy = true; PdfDocument = null; await Task.Delay(10); try { var sc = System.Threading.SynchronizationContext.Current; System.Threading.ThreadPool.QueueUserWorkItem(_ => { PdfDocumentSource documentSource = null; RadFixedDocument document = CreateDocument(); if (document != null) { MemoryStream stream = new MemoryStream(); PdfFormatProvider provider = new PdfFormatProvider(); provider.Export(document, stream); stream.Position = 0; documentSource = new PdfDocumentSource(stream); } sc.Post(delegate { PdfDocument = documentSource; IsBusy = false; }, null); }); } catch (Exception ex) { ShowDialog($"{Constants.EXCEPTION} in LoadViewModel: {ex.Message}"); IsBusy = false; } }

 

Does anyone have a suggestion on how I might resolve this issue? Is it a bug in the RadPdfViewer?

Any help would be greatly appreciated.


Dimitar
Telerik team
 answered on 14 May 2021
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?