Telerik Forums
UI for WPF Forum
2 answers
362 views
Good afternoon,

I'm having an issue with RadComboBox binding. I'm implementing iNotifyPropertyChanged which works with both get and set properties.
When I change my selection in the RadComboBox the propertychanged event is raised and works fine.
However, I have IsEditable="True" & IsReadOnly="True" set
telerik:RadComboBox x:Name="comboCounties" Grid.Row="4" Grid.Column="1" MinWidth="200" IsEditable="True"
                                     IsReadOnly="True" StaysOpenOnEdit="True" EmptyText="Please select a county" SelectedIndex="-1"
                                     DisplayMemberPath="County" SelectedValuePath="ID" Margin="5"
                                     Style="{StaticResource ComboBoxErrorToolTip}">
                    <telerik:RadComboBox.SelectedValue>
                        <Binding Path="CountyID" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                                <DataErrorValidationRule></DataErrorValidationRule>
                            </Binding.ValidationRules>
                        </Binding>
                    </telerik:RadComboBox.SelectedValue>
                </telerik:RadComboBox>


When I delete all of the text in the ComboBox using the keyboard "back space" key the property changed event isn't raised.
i.e. I would expect the selected index to be -1 again and the selected value to clear to some default.

Any idea how I can get around this?

This problem came to light because my DataErrorValidationRule isn't working properly if the selected ComboBox text has been fully deleted after a selection was made.

When viewing the Validation Error in a message box it reads 'Value " could not be converted.'

Here's my validation code for your reference:

private void GetErrors(StringBuilder sb, DependencyObject obj)
{
    foreach (object child in LogicalTreeHelper.GetChildren(obj))
    {
        if (child is TextBox)
        {
            TextBox element = child as TextBox;
            if (element == null) continue;
 
            if (Validation.GetHasError(element))
            {
                sb.Append(element.Text + "Missing detail:\r\n");
                foreach (ValidationError error in Validation.GetErrors(element))
                {
                    sb.Append(error.ErrorContent.ToString());
                    sb.Append("\r\r");
                }
            }
            //Check the children of this object for errors
            GetErrors(sb, element);
        }
        if (child is RadComboBox)
        {
            RadComboBox element = child as RadComboBox;
            if (element == null) continue;
 
            if (Validation.GetHasError(element))
            {
                sb.Append("Missing detail:\r\n");
                foreach (ValidationError error in Validation.GetErrors(element))
                {
                    sb.Append(error.ErrorContent.ToString());
                    sb.Append("\r\r");
                }
            }
            //Check the children of this object for errors
            GetErrors(sb, element);
        }
    }
}


//DataErrorValidationRule
public string this[string propertyName]
{
    get
    {
        if (propertyName == "Address1")
        {
            if (string.IsNullOrEmpty(Address1))
            {
                return "Line 1 is required.";
            }
        }
        if (propertyName == "Postcode")
        {
            if (string.IsNullOrEmpty(Postcode))
            {
                return "Postcode is required.";
            }
        }
        if (propertyName == "CountyID")
        {
            if (CountyID <= 0)
            {
                return "County is required.";
            }
        }
        return null;
    }
}
//WPF Doesn't use this property
public string Error
{
    get { return null; }
}

Thank you for your time,

Rob
Konstantina
Telerik team
 answered on 06 Apr 2012
1 answer
313 views

Q1 2012

I have a RadGridView that I am binding to a DataTable. The DataTable is dynamically generated in code. In the first column of the DataTable there is an object. I have an event attached to the RowLoaded event. In the RowLoaded event I want to set the template of the first cell to a Resource Template. This is the code I am using but the cell is always empty.

XAML Template

<ControlTemplate x:Key="FluidEditorTemplate">
                <shared:PopupButton PopupHorizontalOffset="0" HorizontalContentAlignment="Left" BorderThickness="0" BorderBrush="Transparent" PopupContent="{Binding}" Foreground="Black"  FontWeight="Bold" VerticalContentAlignment="Center" Margin="0,0,10,0" Background="Transparent" IsRounded="True" Grid.Column="1" Grid.Row="1" DisplayMode="Merged" >
                    <shared:PopupButton.PopupContentTemplate>
                        <DataTemplate>
                            <StackPanel Background="DarkGray" >
                                <Button ToolTip="Cancel" Tag="{Binding}" Style="{DynamicResource GreenGlassButtonStyle}" Margin="2" Height="24"  Width="110" Foreground="White" Content="Cancel" HorizontalAlignment="Right" />
                                <Button ToolTip="Modify" Tag="{Binding}" Style="{DynamicResource RedGlassButtonStyle}" Margin="2" Height="24" Width="110" Foreground="White" Content="Modify" HorizontalAlignment="Right"  />
                                <Button ToolTip="Stop" Tag="{Binding}" Style="{DynamicResource RedGlassButtonStyle}" Margin="2" Height="24" Width="110" Foreground="White" Content="Stop" HorizontalAlignment="Right"  />
                            </StackPanel>
                        </DataTemplate>
                        </shared:PopupButton.PopupContentTemplate>
                </shared:PopupButton>
            </ControlTemplate>

XAML GridView

<telerik:RadGridView RowLoaded="FluidsGridRowLoaded"Grid.Row="1" AutoGenerateColumns="True" ItemsSource="{Binding FluidsDataSource}" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" />

Code

private void FluidsGridRowLoaded(object sender, RowLoadedEventArgs e)
{
    if (!DesignerProperties.GetIsInDesignMode(this))
    {
        if (e.Row.Cells.Count > 0)
            e.Row.Cells[0].Template = Application.Current.Resources["FluidEditorTemplate"] as ControlTemplate;
    }
}

Thanks,

Billy Jacobs



StevenDale
Top achievements
Rank 2
 answered on 05 Apr 2012
2 answers
172 views
I have a form with some fields.  One of the fields is an ordinary TextBox that is bound to a variable of type Decimal.

When I type letters into the field, it's highlighted in red, to indicate that it has failed validation, but the validation error is not added to the form's ValidationSummary, and ValidationSummary.HasErrors remains True.

Am I simply misunderstanding what ValidationSummary is supposed to do?
Jeff
Top achievements
Rank 1
 answered on 05 Apr 2012
17 answers
503 views
I'm getting an application crash when I drag a row from a RadGridView and drop it into an open doc in WordPad.  I don't get a crash when I drop it into an open doc in Notepad, Word 2003, or Excel 2003.  Drag and drop within the application seems to work fine.

Exception:
  • {"Error HRESULT E_FAIL has been returned from a call to a COM component."}
  • -2147467259

Here's the stack trace:
  •    at MS.Win32.UnsafeNativeMethods.DoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
  •    at System.Windows.OleServicesContext.OleDoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
  •    at System.Windows.DragDrop.OleDoDragDrop(DependencyObject dragSource, DataObject dataObject, DragDropEffects allowedEffects)
  •    at System.Windows.DragDrop.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects)
  •    at Telerik.Windows.DragDrop.DragDropManager.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects, DragDropKeyStates initialKeyState, Object dragVisual, Point relativeStartPoint, Point dragVisualOffset) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\DragDropManager\DragDropManager.cs:line 1012
Bill
Top achievements
Rank 1
 answered on 05 Apr 2012
4 answers
173 views
We have an application that uses RadGridView.
We use RadGridView collection of objects that have attributes of validation.
There is also a button on the ToolBar that switches on edit mode of objects (editing is disabled by default).
The problem is that when you add a new object that does not pass validation and disable the editing mode, the application crashes with StackOverflowException.
If the button Edit Mode is not on the ToolBar everything works fine.

List the steps to repeat this behavior:
1) Press the Edit Mode (on the toolbar)
2) Add a new blank line (by pressing Ins)
3) Cancel the edit mode by clicking the Edit Mode (on the toolbar)
4) Click on any item on the main window
5) get the exception

If in p.3) you press the the EditMode button not on the toolbar everything will work fine without any exceptions.

UPD Sample project in archive 
Denis
Top achievements
Rank 1
 answered on 05 Apr 2012
0 answers
100 views
Hello,

I'm  having a tough time getting a List box to Drag and Drop onto a RadDataForm

the RadListBox has a different type object bound to the collection than the RadDataForm , however both share a single common field

any examples would be greatly appreciated i have included a snapshot of the application along with the offending issue


Kris
Top achievements
Rank 1
 asked on 05 Apr 2012
0 answers
190 views
Hi,

i use the "RadMaskedTextInput" and Text={Binding nn} to show a Adress. The Content should be "Österreich". But it shows me something like a "?" instat of the "Ö". How can i solve this?

<telerik:RadMaskedTextInput Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="0" Grid.Column="1" Name="KundenAns_txt" Value="{Binding Anschrift}" telerik:StyleManager.Theme="Summer"
TextMode="PlainText" VerticalContentAlignment="Top" SelectionOnFocus="SelectAll" />

Thanks
Regards
ww
ITA
Top achievements
Rank 1
 asked on 05 Apr 2012
1 answer
228 views
Hi,

It appears that if you remove the Telerik.Windows.Controls.GridView.pdb from a project and then run the project in debug mode, an exception is thrown when you try to insert a row into an instance of the RadGridView control.

I'm just concerned about this because our application allows end users to create plug-in components, and some of them do this using Telerik controls, but they don't always provide the .pdb files. Since this is only happening in debug mode, it's probably not an issue, but I am curious why this is happening?

To reproduce:

Create a simple WPF application and add a RadGridView to the main window.

Create a simple data structure, example:

public class MyRecord
{
    public string MyField { get; set; }
}


Bind the grid to an observable collection of that data structure:

//...
public class MyWidget : UserControl
{
    public class MyRecord
    {
        public string MyField { get; set; }
    }
 
    public ObservableCollection<MyRecord> _items = new ObservableCollection<MyRecord>();
 
    public MyWidget()
    {
        InitializeComponent();
 
        this.myRadGridView.ItemsSource = this._items;
    }
}

Build the application in "Debug" mode, and then run it.

You should be able to insert rows into the RadGridView just fine.

Now, go into the output directory for the application and delete this file:

Telerik.Windows.Controls.GridView.pdb

Don't rebuild the application, just run it again, in debug mode.

If you try to insert a row into the grid, the system throws an exception and complains about a data binding object of some sort.

Any idea as to why this is happening? I thought .pdb files were only used in the event that an exception was thrown, so I'm a little unclear as to why RadGridView would crash *because* there is no .pdb file available...

Thanks.
Vlad
Telerik team
 answered on 05 Apr 2012
3 answers
138 views
Hi,

I have an issue where I have groupDescriptors defined on a Grid.
I added a GridViewExpressionColumn with a custom AggregateFunction using the code provided in this thread:
http://www.telerik.com/community/forums/wpf/gridview/aggregate-column-footers-don-t-sum-on-data-change-caliburn-micro-mvvm.aspx 

The AggregateFunction calculation works at the Grand Total level, but not at the GroupDescriptor level.

See screenshot attached. (2nd one)

Did somebody ever encountered the problem before?

Thank you,
Alan
Alan
Top achievements
Rank 1
 answered on 04 Apr 2012
4 answers
203 views
Hello Telerik Team,

I have small doubt in wpf rating,
     How to bind rad rating? Bcoz i want to store the rated value in database.
our telerik version is 2010_2_0723_DEV.

Dan
Top achievements
Rank 1
 answered on 04 Apr 2012
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
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?