Telerik Forums
UI for WPF Forum
8 answers
390 views
Hello,

I implemented a type converter for RadPropertyGrid but it's not working.
As can be seen in the attached 'winform property grid', if a line is selected then the 'linetype' cell displays the types for various lines.
I implemented the type converter for this as the below code, but it seems RadPropertyGrid doesn't recognize it.
Can this be fixed? And can you inform me any other fundamental limits of RadPropertyGrid compared to Winform property grid?


        [TypeConverter(typeof(LineTypeConverterNoExpand)), GlobalizedCategory("Misc"), GlobalizedDisplayName("LineType"), GlobalizedDescription("Get/Set the vdLinetype object that the vdFigure will be drawn with."), ScriptSerialize]
        public vdLineType LineType
        {
            get
            {
                return this.mLineType;
            }
            set
            {
                if ((this.mLineType != value) && base.RaiseOnBeforeModify("LineType", value))
                {
                    if ((!this.Deleted && (value != null)) && value.Deleted)
                    {
                        value.Deleted = false;
                    }
                    base.AddHistory("LineType", value);
                    this.mLineType = value;
                    base.RaiseOnAfterModify("LineType");
                }
            }
        }

namespace VectorDraw.Professional.vdPrimaries
{
    using System;
    using System.ComponentModel;
    using System.Globalization;
    using VectorDraw.Professional.Utilities;
    using VectorDraw.Professional.vdObjects;

    public class LineTypeConverterNoExpand : TypeConverter
    {
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            if (context == null)
            {
                return false;
            }
            return ((sourceType == typeof(string)) || base.CanConvertFrom(context, sourceType));
        }

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                try
                {
                    string name = (string) value;
                    vdDocument document = TypeConverterUtilities.getDocument(context);
                    object solid = null;
                    if (document != null)
                    {
                        solid = document.LineTypes.FindName(name);
                    }
                    if (solid == null)
                    {
                        solid = document.LineTypes.Solid;
                    }
                    return solid;
                }
                catch
                {
                    throw new NotSupportedException("Can not convert '" + ((string) value) + "' to type LineType");
                }
            }
            return base.ConvertFrom(context, culture, value);
        }

        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            vdDocument document = TypeConverterUtilities.getDocument(context);
            if (document == null)
            {
                return new TypeConverter.StandardValuesCollection(new string[0]);
            }
            return new TypeConverter.StandardValuesCollection(document.LineTypes.GetNotDeletedItemsAndVisibleOnForms());
        }

        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }
    }
}

Ivan
Top achievements
Rank 1
 answered on 20 Nov 2013
1 answer
672 views

Hi,

I have only one column in grid view and I do not want to show any grid lines and row/column headers. When I set 
GridLinesVisibility="None" ShowColumnHeaders="False" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed". I can see vertical grid line (or it may be something else) only before first column. Do we have any direct way or some workaround to hide that?


I have attached a screenshot for this.

Thanks and regards,

Shiv

Yoan
Telerik team
 answered on 20 Nov 2013
1 answer
246 views
Hello,

i have any Problems with the MaskedInput Control.

Scenario 1:

Validation Error Messages not showed by Application Start.
My Custom ControlTemplate for Validation.ErrorTemplate is showed,
but the ErrorMessage is Empty. This is a little bit funny.

You can see the Validation Methods in my TestModel Code.

Scenario 2:
My TestModel-Object has ProjectDescription Property as string with MaximumLength 80 and MinimumLength of 5.
Enter 5 Characters in the MaskedInput Field, you can not deleting this Characters.
Only overwrite from first Position is allowed.

But... you can deleting the Characters, when the Count of Characters in the Field < Definition of MinimumLength is.
All other Characters at Position > MinimumLength is deletable.

MainWindow.xaml

<Window
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Telerik_Forum.MainWindow"
        xmlns:numericinput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
        Title="MainWindow" Height="150" Width="525">
    <Window.Resources>
        <ControlTemplate x:Key="CustomErrorTemplate">
            <StackPanel Orientation="Horizontal">
                <Border Margin="-1"
                    VerticalAlignment="Center">
 
                    <AdornedElementPlaceholder x:Name="Holder" />
                </Border>
 
                <Border Margin="3 1 0 1" HorizontalAlignment="Left" VerticalAlignment="Center" >
                    <StackPanel >
 
                        <TextBlock Text="!!!" ToolTip="{Binding ElementName=Holder,  Path=AdornedElement.DisplayErrorMessage}" />
                    </StackPanel>
                </Border>
 
            </StackPanel>
 
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Text="Project Number:"/>
        <telerik:RadMaskedNumericInput Grid.Column="1" Grid.Row="0" Width="100" Validation.ErrorTemplate="{StaticResource CustomErrorTemplate}" HorizontalAlignment="Left" VerticalAlignment="Top" Value="{Binding ProjectNumber, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsClearButtonVisible="False" Mask="#4" AutoFillNumberGroupSeparators="False" Placeholder=" "/>
        <TextBlock Grid.Column="0" Grid.Row="1" Text="Cost Summary:"/>
        <telerik:RadMaskedNumericInput Grid.Column="1" Grid.Row="1" Width="100" Validation.ErrorTemplate="{StaticResource CustomErrorTemplate}" HorizontalAlignment="Left" VerticalAlignment="Top" Value="{Binding CostSummary, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsClearButtonVisible="False" Mask="#9.2" AutoFillNumberGroupSeparators="False" Placeholder=" "/>
        <TextBlock Grid.Column="0" Grid.Row="2" Text="Project Description:"/>
        <telerik:RadMaskedTextInput Grid.Column="1" Grid.Row="2" Width="300" AllowInvalidValues="True" UpdateValueEvent="PropertyChanged" Validation.ErrorTemplate="{StaticResource CustomErrorTemplate}" HorizontalAlignment="Left" VerticalAlignment="Top" Value="{Binding ProjectDescription, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Mask="" IsClearButtonVisible="False" numericinput:MaskedInputExtensions.MinTextLength="5" numericinput:MaskedInputExtensions.MaxTextLength="80" Placeholder=" "/>
    </Grid>
</Window>

MainWindow.cs

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
 
        TestModel m_Model = new TestModel(0, 0, "Test");
 
        this.DataContext = m_Model;
 
    }
}

TestModel.cs

public class TestModel : IDataErrorInfo
{
    public TestModel()
    { }
 
    public TestModel(int project_number, double cost_summary, string project_description)
    {
        this.ProjectNumber = project_number;
        this.CostSummary = cost_summary;
        this.ProjectDescription = project_description;
    }
 
    public int ProjectNumber { get; set; }
    public double CostSummary { get; set; }
 
    [StringLength(10,  MinimumLength = 5)]
    public string ProjectDescription { get; set; }
 
    public string Error
    {
        get { return this[string.Empty]; }
    }
 
    public string this[string propertyName]
    {
        get
        {
            string validationResult = null;
            switch (propertyName)
            {
                case "ProjectNumber":
                    validationResult = Validate_ProjectNumber();
                    break;
 
                case "CostSummary":
                    validationResult = Validate_CostSummary();
                    break;
 
                case "ProjectDescription":
                    validationResult = Validate_ProjectDescription();
                    break;
 
                default:
                    throw new ApplicationException("Unknown Property being validated on Product.");
            }
 
            return validationResult;
        }
    }
 
    private string Validate_ProjectNumber()
    {
        string Result = "";
 
        if (ProjectNumber == 0)
        {
            Result = "Please Enter a Project Number.";
        }
 
        if (ProjectNumber < 1 || ProjectNumber > 9999)
        {
            Result = "Only ProjectNumber Between 1 and 9999";
        }
 
        return Result;
    }
 
    private string Validate_CostSummary()
    {
        string Result = "";
 
        if (CostSummary == 0)
        {
            Result = "Please Enter Cost Summary Value.";
        }
        else if (CostSummary < 0.0)
        {
            Result = "Cost Summary allows only positive Values.";
        }
 
        return Result;
    }
 
    private string Validate_ProjectDescription()
    {
        string Result = "";
 
        if (ProjectDescription.Length == 0)
        {
            Result = "Please Enter a Project Description";
        }
        else if (ProjectDescription.Length < 5)
        {
            Result = "You must enter a Project Description with 5 Characters.";
        }
 
        return Result;
    }
}
Petar Mladenov
Telerik team
 answered on 20 Nov 2013
10 answers
428 views
We need our RadGridView to simply show text (e.g., True/False) instead of a checkbox for boolean values. The grid is read-only, we're binding it to a DataView, and we need to continue to let it auto-generate the columns at runtime.

I assume we just need to prevent the grid from using a GridViewCheckBoxColumn for boolean-typed columns when it auto-generates its columns. What's the best way to do that, with performance being really important? I've tried overriding templates and styles to no avail. Right now I have it working by using a style that overrides the CheckBox's control template and puts a TextBlock there, using a boolean-to-string converter we wrote, but that's not ideal. I really hope I missed something simple!

BTW, the main reason we want to NOT show checkboxes is performance -- we've found that a lot of checkboxes really slow down rendering of the grid. If that problem has been solved, we might leave the checkboxes in there, though I'd still like the option to just show text instead.

Thanks.
Dimitrina
Telerik team
 answered on 19 Nov 2013
2 answers
193 views
Hi,

I'm trying to draw a CustomLine on a add, I want it styled so it appears dashed.

I am creating the line in code here....
CustomLine line = new CustomLine();
line.Style = (Style)Application.Current.FindResource("DashedCustomLine");
line.Stroke = Brushes.Black;
line.StrokeThickness = 1;
line.YIntercept = 0;
line.Slope = 1;

The style is then....
<Style x:Key="DashedCustomLine" TargetType="telerikCharting:CustomLine">
    <Setter Property="StrokeDashArray" Value="5,2" />
</Style>

However it seems there isn't a StrokeDashArray property on CustomLine, what property should I be using, or how should I be achieving this.

I only wish to draw a simple line of identity on the chart, ie. x = y.

Thanks
Evgenia
Telerik team
 answered on 19 Nov 2013
7 answers
197 views
Hi everyone,

I am developing a WPF application in which I use RadControls including RadDocking.

Here is my Docking's layout :

<?xml version="1.0" encoding="utf-8"?>
    <RadDocking>
      <DocumentHost>
        <RadSplitContainer SerializationTag="m_splitContainer2" Orientation="Vertical">
          <Items>
            <RadPaneGroup SerializationTag="m_paneGroup2" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
            <RadPaneGroup SerializationTag="m_paneGroup3" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
      </DocumentHost>
      <SplitContainers>
        <RadSplitContainer SerializationTag="m_splitContainer1" Dock="DockedLeft" Width="240">
          <Items>
            <RadPaneGroup SerializationTag="m_paneGroup1" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
      </SplitContainers>
    </RadDocking>

A method is executed at run time to perform the following actions :
- Create a Pane and place content inside
- Set the Pane's floating size
- Dock the Pane into m_paneGroup1

After the execution of the method I have manually undocked the Pane to make it floating.
But the Pane's size was not the floating size set in the method.

Have I misunderstood the behavior of the floating size of a Pane ?

Thank in advance for your answer.
Vladi
Telerik team
 answered on 19 Nov 2013
3 answers
253 views
I have a RadDataForm bound to a single DataRowView of a DataTable.  If I allow the form to auto-generate the editor fields, the "Cancel" function works as advertised.  That is, I can edit any number of the fields, press Cancel, and their original values are returned prior the the form shifting back to ReadOnly mode.

However, if I supply a custom template for the same DataRowView, when I edit some data and press Cancel, the original values are not put back into the editor fields.  The form is placed back in ReadOnly mode (as expected), but the modified values are still there.

How can I get a custom template to play nicely with the Cancel function?  I see no mention of this anomaly in the docs or on the forums.

Jeff
Dimitrina
Telerik team
 answered on 19 Nov 2013
1 answer
84 views
Hi,

I'm using the ScheduleView control with a WeekViewDefinition and I would like to know if it's possible to have the viewdefinition allways without any scrollbars. I mean, whatever the size of the control, I want the view content always visible in the current view area.

Thank's
Alain
Rosi
Telerik team
 answered on 19 Nov 2013
1 answer
150 views
Hello,

I have a RadGridView that i bind to custom objects and those objects have a property which is a list of child objects.  All works fine, except I cannot figure out how to capture child grid/table edit events. For instance in the code behind I have this:

          this.radGridView.RowEditEnded += radGridView_RowEditEnded;


so I can respond and call some other services when a row edit ends on a parent row.  But how to attach handlers to my child table definitions?

Thanks!
Yoan
Telerik team
 answered on 19 Nov 2013
3 answers
226 views

Hello, I have a problem with a Hierarchical GridView.
Both my father grid and child one have dataset as datasource.
When I'm going to add a new row in child gridview i should populate the fields with a value taken from a textbox.
To populate cells of the new row I used the sub SubGrids_AddingNewDataItem or SubGrids_BeginningEdit to assign values to each cell.
The process seems to work, I can see the new added row but i can't see assigned values of each gridview cells immediatly, I have to click 2 times over each cell to see the values.
Once the new row is added to my gridview i don't see any value even if the item contains the value in code behind. The second time I enter the cell I can see the value I set in code behind.
I need your help to know how to add a new row in my child gridview, setting values from code behind and get them immediately visible when creating new row process ends.


Best Regards
Dimitrina
Telerik team
 answered on 19 Nov 2013
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
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
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
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
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?