Telerik Forums
UI for WPF Forum
1 answer
233 views

 

Hello,

Is it possible to perform validation on keypress instead of lost focus, similar to UpdateSourceTrigger in WPF?

I'm using the WPF RadPropertyGrid control with AutoGeneratePropertyDefinitions set to true.

 

                    <t:RadPropertyGrid Name="VdiPropertyGrid"  Grid.Column="2" 
                                      Item="{Binding Path=DataContext.SelectedPropertyInspector, RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type UserControl}}}"
                                      HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"    IsGrouped ="True"                        
                                      ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                      DescriptionPanelVisibility="Visible" SearchBoxVisibility="Visible" ForceCursor="True" SelectionMode="Single" 
                                      AutoGeneratePropertyDefinitions="True"                                   
                                      AutoGeneratingPropertyDefinition="RadPropertyGrid_OnAutoGeneratingPropertyDefinition" ItemChanged="VdiPropertyGrid_ItemChanged"    >

                        <t:RadPropertyGrid.Resources>
                            <Style TargetType="{x:Type TextBox}">
                                <Style.Triggers>
                                    <Trigger Property="Validation.HasError" Value="True">
                                        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>


                        </t:RadPropertyGrid.Resources>
                    </t:RadPropertyGrid>

 

Regards,
Canice.

Dinko | Tech Support Engineer
Telerik team
 answered on 05 Sep 2019
4 answers
2.1K+ views

I need to step through a call stack to determine why an unexpected event is being fired in my code. I am unable to do so in the Telerik libraries (e.g. Telerik.Windows.Controls.dll).

How do I go about getting the source code or debug symbols for UI for WPF?

Martin Ivanov
Telerik team
 answered on 04 Sep 2019
4 answers
183 views
I have read every bit of information there is on the RadCollectionNavigator, not much out there, so now I have to ask (-:

I would like to:
- Validate before accepting a new item
- Undo a new item
- Ask fro delete confirmation
- Know how to set focus on the new item in a rad listbox

Can I do this with the RadCollectionNavigator or do I have to find another solution?
Amit
Top achievements
Rank 1
 answered on 04 Sep 2019
19 answers
2.4K+ views
Is there a way to bind the double click command of a RadGridView to a command on the ViewModel instead of to an event?

<Controls:RadGridView.InputBindings> 
    <MouseBinding Gesture="LeftDoubleClick" Command="{Binding RecipeSelectedCommand}"/>  
</Controls:RadGridView.InputBindings> 
 


I'm getting

System.Windows.Markup.XamlParseException occurred
  Message="A 'Binding' cannot be set on the 'Command' property of type 'MouseBinding'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject."
  Source="PresentationFramework"
  LineNumber=0
  LinePosition=0
  StackTrace:
       at MS.Internal.Helper.CheckCanReceiveMarkupExtension(MarkupExtension markupExtension, IProvideValueTarget provideValueTarget, DependencyObject& targetDependencyObject, DependencyProperty& targetDependencyProperty)
       at System.Windows.Data.BindingBase.ProvideValue(IServiceProvider serviceProvider)
       at System.Windows.Markup.BamlRecordReader.ProvideValueFromMarkupExtension(MarkupExtension markupExtension, Object obj, Object member)
       at System.Windows.Markup.BamlRecordReader.SetClrComplexPropertyCore(Object parentObject, Object value, MemberInfo memberInfo)
       at System.Windows.Markup.BamlRecordReader.SetClrComplexProperty(Object parentObject, MemberInfo memberInfo, Object o)
       at System.Windows.Markup.BamlRecordReader.SetPropertyValueToParent(Boolean fromStartTag, Boolean& isMarkupExtension)
       at System.Windows.Markup.BamlRecordReader.ReadElementEndRecord(Boolean fromNestedBamlRecordReader)
       at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
       at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
       at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
       at System.Windows.Markup.TreeBuilder.Parse()
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at CakeBoss.WPF.RecipeListView.InitializeComponent() in c:\Dev\CakeBoss2009\trunk\code\CakeBoss.WPF\RecipeList\RecipeListView.xaml:line 1
       at CakeBoss.WPF.RecipeListView..ctor() in C:\Dev\CakeBoss2009\trunk\code\CakeBoss.WPF\RecipeList\RecipeListView.xaml.cs:line 13
  InnerException:
paul
Top achievements
Rank 1
 answered on 03 Sep 2019
1 answer
1.6K+ views

I was previously using the Telerik EventToCommandBehavior to capture the double-click event for my GridView, but as others have discovered  I had the issue that it also triggered when a user clicked on the scrollbar quickly:

<telerik:EventToCommandBehavior.EventBindings>
  <telerik:EventBinding EventName="MouseDoubleClick" Command="{Binding ShowEditWindowCmd}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadGridView}}}" />
</telerik:EventToCommandBehavior.EventBindings>

 

So now I've switched over to another solution using the code-behind, but it feels like it breaks the MVVM model too much in my case.  I realize I'm splitting hairs because this does what I want, but is there maybe a better (cleaner) way to do this?  I would love to use the EventToCommandBehavior on the row, but couldn't figure out how.

public partial class PackageBoardsGrid : UserControl
{
    PackageBoardsPage pageVM;
 
    public PackageBoardsGrid()
    {
        InitializeComponent();
        this.DataContextChanged += ( o, e ) =>
        {
            if( e.NewValue is PackageBoardsPage )
                pageVM = (PackageBoardsPage)e.NewValue;
        };
    }
 
    private void Grid_RowLoaded( object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e )
    {
        if( e.Row is GridViewRow ) {
            e.Row.AddHandler(GridViewRow.MouseDoubleClickEvent, new MouseButtonEventHandler(OnRowMouseDoubleClick), true);
        }
    }
 
    private void OnRowMouseDoubleClick( object sender, MouseButtonEventArgs args )
    {
        if( pageVM != null ) {
 
            var gridViewRow = sender as GridViewRow;
            if( gridViewRow != null ) {
                var data = gridViewRow.DataContext as LiveBoard;
                if( data != null )
                    pageVM.ShowEditWindowCmd.Execute(data);
            }
        }
    }
}
Martin Ivanov
Telerik team
 answered on 03 Sep 2019
3 answers
88 views

Hi,

I want to restrict which shapes can be connected. In my application there are rules of which shapes may be connected. What I want is that if a user tries to connect two shapes, that cannot be connected (incompatible?) it will reject the connection or display an error on the connection.

Can I do this?

Thx

Rob

Mark
Top achievements
Rank 1
 answered on 02 Sep 2019
1 answer
868 views

Hello, please i need your help,

 

I have a RadGridView and the rows have different types, for example: Type A, Type B, .... and sometimes there is a relation between rows, and if a user try to delete a row (for example row A) I check if there is a relation between the row that the user want to delete (row A) and all the rows of the RadGridView, and if there is a relation I propose to the user if he want to delete the row (Row B for example) (or rows) who the row A have a relation.


I used the event RowsChanging to get the index of the rows that the user wants to delete, like this, and then I can delete the rows who have a relation with the row A.

 

private void radGridView_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Remove)  // The Action is to delet the row A
            {

              //  if(I check if row A have a relation with another row)

             {

             //i delet this rows

        radGridView .Rows.RemoveAt(indexoftherowiwanttodelet);

             }         

      }

}

 

My problem is:


If the index of the row A is smaller than the index of the row B, the code works very well.
But if the index of the row A is bigger than the row B, I have an exception: 

'System. ArgumentOutOfRangeException' occurred in mscorlib.dll

 

I need your help and thank you.

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Aug 2019
15 answers
1.1K+ views
We are getting System.ComponentModel.Win32Exception error while  converting XAML to PDF at WCF WebSevice. Interestingly WCF Service sometimes getting this error, sometimes not. Also this code working inside a Thread otherwise it gives a STA Thread Exception . 

Telerik dll version : 2013.1.527.45  AND .Net 4.5

Code and detailed error is shown below. Please immediate help.

byte[] XAMDataToBeConverted;

 var xamlProvider = new Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider();
 radDocument = xamlProvider.Import(XAMDataToBeConverted); //Getting Error on this line
 xamlProvider = null;

The Error detail is 

'The invocation of the constructor on type 'Telerik.Windows.Documents.Model.RadDocument' that matches the specified binding constraints threw an exception.' Line number '1' and line position '569'. System.Windows.Markup.XamlParseException Seneka.Ebdys.Server.Services.HelperClasses.RadRichTextBoxHelperServer CreatePdfSimple "System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'Telerik.Windows.Documents.Model.RadDocument' that matches the specified binding constraints threw an exception.' Line number '1' and line position '569'. ---> System.ComponentModel.Win32Exception: The operation completed successfully
   at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
   at System.Windows.Threading.Dispatcher..ctor()
   at Telerik.Windows.Documents.Model.MailMergeDataSource..ctor()
   at Telerik.Windows.Documents.Model.RadDocument..ctor()
   at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
   at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
   at Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Import(Stream input)
   at Telerik.Windows.Documents.FormatProviders.DocumentFormatProviderBase.Import(Byte[] input)
   at Seneka.Ebdys.Server.Services.HelperClasses.RadRichTextBoxHelperServer.CreatePdfSimple()"







Boby
Telerik team
 answered on 30 Aug 2019
3 answers
141 views

Hi,

I want to save selections like shape border thickness as settings so when the user work with the tool again the last selected thickness should be selected instead of the default value.

How do I approach and solve this?

 

Best regards

Dilyan Traykov
Telerik team
 answered on 30 Aug 2019
1 answer
84 views

Hi,

is it possible to save the image editor settings I used last? I would like to have the same StrokeColor, Shape and StrokeThickness again if I open another picture with the imageeditor.

Best regards.

Dinko | Tech Support Engineer
Telerik team
 answered on 30 Aug 2019
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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?