Telerik Forums
UI for WPF Forum
1 answer
217 views
I have a DataGrid that i have a TimePicker column in.  I manipulated the sample custom column to just include a TimePicker element.  It works fine except for when the element tries to validate the input selected.  I have bound it to a TimeSpan item, but it gives me the validation error "Object of System.DateTime cannot be converted to TimeSpan".  So im unsure where to bind the TimeSpan item to get the selected DateTime.TimeOfDay??

 

 

 

<telerik:RadGridView AutoGenerateColumns="False" NewRowStyle="{StaticResource NewRowStyle}" RowStyle="{StaticResource RowStyle}" Foreground="White" HorizontalGridLinesBrush="White" Margin="10,10,210,22" Name="groupGrid" SelectionMode="Single" SelectionUnit="FullRow" VerticalGridLinesBrush="White" SelectionChanged="groupGrid_SelectionChanged" CellEditEnded="groupGrid_CellEditEnding" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False" ShowInsertRow="True" RowEditEnded="groupGrid_RowEditEnded">

 

 

 

 

<telerik:RadGridView.Columns>

 

 

 

 

<telerik:GridViewDataColumn Header="Task Name: " DataMemberBinding="{Binding Name}" />

 

 

 

 

<telerik:GridViewDataColumn Header="Description: " DataMemberBinding="{Binding Description}" />

 

 

 

 

<telerik:GridViewDataColumn Header="Solution: " DataMemberBinding="{Binding Solution}" />

 

 

 

 

<my:TimePickerColumn DataMemberBinding="{Binding StartTime}" Header="Start Time" TimeInterval="0:30:0"/>

 

 

 

 

 

<telerik:GridViewDataColumn Header="End Time: " DataMemberBinding="{Binding EndTime}" />

 

 

 

 

<telerik:GridViewDataColumn Header="Elapsed:" UniqueName="Elapsed" DataMemberBinding="{Binding ElapsedTime}" />

 

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

</telerik:RadGridView>

 

public class TimePickerColumn : GridViewBoundColumnBase
    {
        public TimeSpan TimeInterval
        {
            get
            {
                return (TimeSpan)GetValue(TimeIntervalProperty);
            }
            set
            {
                SetValue(TimeIntervalProperty, value);
            }
        }
  
        public static readonly DependencyProperty TimeIntervalProperty =  DependencyProperty.Register("TimeInterval", typeof(TimeSpan), typeof(TimePickerColumn), new PropertyMetadata(TimeSpan.FromHours(1d)));
  
        public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            this.BindingTarget =  RadTimePicker.SelectedValueProperty;
  
            RadTimePicker picker = new RadTimePicker();
            picker.IsTooltipEnabled = false;
  
            picker.TimeInterval = this.TimeInterval;
             
            picker.SetBinding(this.BindingTarget, this.CreateValueBinding());
  
            return picker;
        }
  
        public override object GetNewValueFromEditor(object editor)
        {
            RadTimePicker picker = editor as RadTimePicker;
            if (picker != null)
            {
                picker.DateTimeText = picker.SelectedTime.Value.ToString();
            }
  
            return base.GetNewValueFromEditor(editor);
        }
  
        private Binding CreateValueBinding()
        {
            Binding valueBinding = new Binding();
            valueBinding.Mode = BindingMode.TwoWay;
            valueBinding.NotifyOnValidationError = true;
            valueBinding.ValidatesOnExceptions = true;
            valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;
            valueBinding.Path = new PropertyPath(this.DataMemberBinding.Path.Path);
  
            return valueBinding;
        }
    }

Vanya Pavlova
Telerik team
 answered on 24 Jan 2011
1 answer
542 views

Good day,

I am using RadGridView control using 2009 Q2 version of Telerik. And i have the following problem.

I am using bindings for having some control on some behavior into the Grid. My idea is, binding the column to a property, set unable and disable the checkbox we have in the column. For that i use RelativeSource FindAncestor

<telerik:GridViewDataColumn UniqueName="List" IsFilterable="False" Width="100">
    <telerik:GridViewColumn.HeaderCellStyle>
        <Style TargetType="telerik:GridViewHeaderCell">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:GridViewHeaderCell">
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="Edit" HorizontalAlignment="Center"></TextBlock>
                            <CheckBox x:Name="AllEdited" HorizontalAlignment="Center" VerticalAlignment="Center" Click="AllEdited_Click" Validation.ErrorTemplate="{x:Null}" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=DataContext.EditMode}"></CheckBox>
                        </StackPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </telerik:GridViewColumn.HeaderCellStyle>
    <telerik:GridViewColumn.CellStyle>
        <Style TargetType="telerikGridView:GridViewCell">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerikGridView:GridViewCell">
                        <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding CuestionarioVisible}" Validation.ErrorTemplate="{x:Null}" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=DataContext.EditMode}"></CheckBox>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </telerik:GridViewColumn.CellStyle>
</telerik:GridViewDataColumn>

As you can see in the code, I have binding on "IsEnabled" property for allowing or not to check on the checkboxes which was edited or not.
The binding works great in the header but, it ignores in the cell!

Any ideas? Why is that happening? Any solution for making the cells work in the same way as the header?

Thanks in advance.

Regards,
Alvaro
Alvaro
Top achievements
Rank 1
 answered on 24 Jan 2011
7 answers
251 views
Hello!

I can't find any obvious documentation about my specific use case, so please help me along here:

I have a class such as this:

    public class ProductPrognosis
    {
        public string PartNumber { get; set; }
        public Dictionary<DateTime, int> Prognosis { get; set; }
    }

This class gets filled with data extracted from an Excel document.
I then have a list of these objects that I use as my ItemsSource on a chart control:

<telerik:RadChart  ItemsSource="{Binding Prognoses}" Grid.Row="1" Margin="4,0" Background="#66ffffff" />

My problem is, I cannot find a way to tell RadChart how to get at the series in the collection..
I would have expected some properties, such as SeriesNameProperty and SeriesDataProperty that when defined made RadChart auto-create series based on the set of data presented..

Looking at the samples you have published, I only see manual definition of series using quite verbose XML. And I fear that is not an acceptable solution. WPF UIs are meant to be data driven, not tersely defined in XAML.

I hope someone can solve this with a simple solution, I would hate to have to create a whole suite of magical tools that generate irrelevant objects (to me) on the fly..

Regards, Morten
Evgenia
Telerik team
 answered on 24 Jan 2011
1 answer
132 views
hey guys,

I'm experiencing a problem with Drag And Drop within my RadTreeView...  This worked fine under 2010 Q3, just since installing the SP1 I am getting this bug.. the code from the RadTreeView is below.... 

the error i'm receving is..

"An exception of type 'System.InvalidOperationException' occurred in Telerik.Windows.Controls.dll but was not handled in user code

Additional information: Root AdornerLayer Not Found. Please make sure that your root visual is Window or other element that has an adorner layer. Alternatively, wrap your root panel in an <AdornerDecorator> element."

further info...

"Error. Root AdornerLayer Not Found. Please make sure that your root visual element is window or other element that has an adorner layer alternatively wrap your root panel in an <AdornerDecorator> element.

When attempting to drag an element..

<DockPanel LastChildFill="True">
<telerikNavigation:RadTreeView x:Name="uiActivitiesList" IsDragDropEnabled="True" Margin="-20,0,0,0"
BorderThickness="0" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" TextDropAfter="Drop After" TextDropBefore="Drop Before"
SelectionChanged="uiActivitiesList_SelectionChanged" SelectionMode="Multiple" dragDrop:RadDragAndDropManager.AllowDrop="True" IsDragPreviewEnabled="False"
IsDragTooltipEnabled="True" DragEnded="uiActivitiesList_DragEnded" SourceUpdated="uiActivitiesList_SourceUpdated"
ItemsSource="{Binding ActivityModelViewCollection, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True,Mode=OneWay}"/>
</DockPanel>


I'm unsure if this is a bug or if i just need to wrap my user control in an AdornerDecorator, but some further information would be great.
http://eeuauaughhhuauaahh.ytmnd.com/
Tsvyatko
Telerik team
 answered on 24 Jan 2011
2 answers
139 views
Hi,
     I am using MVVM pattern. I have a telrik gridview and i want to capture its CellLostFocus event,for that i am using CellEditEnded event. But problem is that this event is firing when i am tabbing out of the cell,not on lost focus of the cell. Is there any way to capture CellLostFocus event of gridview. Since I am using MVVM pattern so I also dont want to write any code in code behind.

Thanks
apoorv
Top achievements
Rank 1
 answered on 24 Jan 2011
1 answer
349 views
Hi,
Is it possible to remove a RadPane from a RadDocking, instead of hiding it?
Ideally, I'd like to wire up the Close so that it removes the "closed" pane from the control.  Is this possible?

Thanks.
George
Telerik team
 answered on 24 Jan 2011
0 answers
172 views
How to make a custom shape of progressbar?For example,change the shape of progressbar from rectangle to triangle.
Best regards.
xjgs_xhj@163.com
Top achievements
Rank 1
 asked on 24 Jan 2011
1 answer
115 views
Hi,
just recently started evaluating your products. The demo page is excellent, but i ran into an error of some sort.
On the wpf demos i was trying out the GridView -> Performance -> Client binding to 1 mil. records, i get an error when i start scrolling the data by using the scrollbar slider. It doesn't go to an error if i use either the page down area or the arrows.

I'm using IE 8

-Matti
Vlad
Telerik team
 answered on 24 Jan 2011
1 answer
120 views
Hi,

Is is possible to used a custom sort order to perform a column sort in a GridView column?

For example,  I want to use a custom sort to sort text column row values 1,2,10,3 to have a sort order of 1,2,3,10 rather then 1,10,2,3

Thanks
Daniel
Vlad
Telerik team
 answered on 24 Jan 2011
5 answers
175 views
I want to change the datatemplate of the DragCue (I mean i want to change the image source of the image tag applied in datatemplate in XAML). I used the following event but it didn't help me out. please help ASAP.

      private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            cue = new ContentControl();
            e.QueryResult = true;
            cue.MouseUp += new MouseButtonEventHandler(cue_MouseUp);
           
            e.Options.DragCue = cue;

            ImageSource IMGSOURCE = new BitmapImage(new Uri("/Images/header_idea.png",UriKind.Relative));

            DataTemplate dt = new DataTemplate();
          
            FrameworkElementFactory ef = new FrameworkElementFactory(typeof(Image));
            ef.SetValue(Image.SourceProperty, IMGSOURCE);

            dt.VisualTree = ef;
            cue.ContentTemplate = dt;
                        
            e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
            e.Handled = true;
        }
Tsvyatko
Telerik team
 answered on 21 Jan 2011
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?