Telerik Forums
UI for WPF Forum
1 answer
276 views

Is there any easy way to use style from filtering list (e.g in grid view filter - first picture) as default style for all scroll viewers (second picture) 

Thanks for help.

Jakub
Top achievements
Rank 1
 answered on 16 Jan 2012
1 answer
176 views
I am using the GridView to display up to 1,000 rows of data.  I am required to provide an elapsed time column.  I have found a similar thread here:http://www.telerik.com/community/forums/silverlight/gridview/updating-column-periodically-with-current-timespan-now-created.aspx .
I had the same thought of utilizing a Dispatch Timer in my ViewModel and updating each item in the data bound ItemSource collection.  However; I must display this elapsed time by second versus minute.  Updating each Model each second cannot be the best way to handle this.  I do not see an event I can respond to which would provide me a collection of those rows being displayed.  I assume that internally the GridView has such a collection for performance reasons.  Is this collection exposed or is there some other mechanism I should use?

Thanks

Pavel Pavlov
Telerik team
 answered on 16 Jan 2012
5 answers
376 views
Hi there, we're currently evaluating some controls in the RadControls library.

We can't get the "Drag and Drop Between ListBoxes - Basic" example http://www.telerik.com/help/wpf/raddraganddrop-between-listboxes.html working.  We've precisely followed the example, yet there is no effect when attempting to drag items from one listbox to the other.

Here's the C#

using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Telerik.Windows.Controls.DragDrop;
 
namespace RadDragDrop2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public ObservableCollection<CheckableItemsViewModel> List1 { get; set; }
        public ObservableCollection<CheckableItemsViewModel> List2 { get; set; }
 
        public MainWindow()
        {
            InitializeComponent();
 
            List1 = new ObservableCollection<CheckableItemsViewModel>();
            List2 = new ObservableCollection<CheckableItemsViewModel>();
 
            LayoutRoot.DataContext = this;
 
            listBox1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery));
            listBox1.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery));
            listBox1.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler<DragDropEventArgs>(OnDropInfo));
            listBox1.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnDragInfo));
            listBox2.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery));
            listBox2.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery));
            listBox2.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler<DragDropEventArgs>(OnDropInfo));
            listBox2.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnDragInfo));
 
            List1.Add(new CheckableItemsViewModel() { Name = "one", IsChecked = true });
            List1.Add(new CheckableItemsViewModel() { Name = "two", IsChecked = false });
            List1.Add(new CheckableItemsViewModel() { Name = "three", IsChecked = true });
 
            List2.Add(new CheckableItemsViewModel() { Name = "four", IsChecked = false });
            List2.Add(new CheckableItemsViewModel() { Name = "five", IsChecked = true });
            List2.Add(new CheckableItemsViewModel() { Name = "six", IsChecked = false });
        }
 
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            if (e.Options.Status == DragStatus.DragQuery)
            {
                var draggedItem = e.Options.Source;
                e.QueryResult = true;
                e.Handled = true;
                // Create Drag and Arrow Cue
                ContentControl dragCue = new ContentControl();
                dragCue.Content = draggedItem.DataContext;
                dragCue.ContentTemplate = this.Resources["DragCueTemplate"] as DataTemplate;
                e.Options.DragCue = dragCue;
                e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
                // Set the payload (this is the item that is currently dragged)
                e.Options.Payload = draggedItem.DataContext;
            }
            if (e.Options.Status == DragStatus.DropSourceQuery)
            {
                e.QueryResult = true;
                e.Handled = true;
            }
        }
 
        private void OnDragInfo(object sender, DragDropEventArgs e)
        {
            // if we are dropping on the appropriate listbox, then remove the item from the first listbox.
            if (e.Options.Status == DragStatus.DragComplete)
            {
                var itemsControl = e.Options.Source.FindItemsConrolParent() as ItemsControl;
                var itemsSource = itemsControl.ItemsSource as IList;
                itemsSource.Remove(e.Options.Payload);
            }
        }
 
        private void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            var destination = e.Options.Destination as ListBox;
            if (e.Options.Status == DragStatus.DropDestinationQuery &&
                destination != null)
            {
                e.QueryResult = true;
                e.Handled = true;
            }
        }
 
        private void OnDropInfo(object sender, DragDropEventArgs e)
        {
            // if we are dropping on the appropriate listbox, then add the dragged item to it.
            var destination = e.Options.Destination as ItemsControl;
            if (e.Options.Status == DragStatus.DropComplete &&
                 destination != null)
            {
                (destination.ItemsSource as IList).Add(e.Options.Payload);
            }
        }
    }
 
    public class CheckableItemsViewModel
    {
        public bool IsChecked { get; set; }
        public string Name { get; set; }
    }
 
    public static class ControlExtensions
    {
        public static ItemsControl FindItemsConrolParent(this FrameworkElement target)
        {
            ItemsControl result = null;
            result = target.Parent as ItemsControl;
            if (result != null)
            {
                return result;
            }
            result = ItemsControl.ItemsControlFromItemContainer(target);
            if (result != null)
            {
                return result;
            }
            return FindVisualParent<ItemsControl>(target);
        }
        public static T FindVisualParent<T>(FrameworkElement target) where T : FrameworkElement
        {
            if (target == null)
            {
                return null;
            }
            var visParent = VisualTreeHelper.GetParent(target);
            var result = visParent as T;
            if (result != null)
            {
                return result;
            }
            return FindVisualParent<T>(visParent as FrameworkElement);
        }
    }
}

Here's the XAML:

<Window x:Class="RadDragDrop2.MainWindow"
        xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
        Title="MainWindow" Width="320" Height="240">
     
    <Window.Resources>
        <DataTemplate x:Key="ItemTemplate">
            <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Name}" />
        </DataTemplate>
 
        <Style TargetType="Control" x:Key="DraggableItem">
            <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrag" Value="True" />
            <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
        </Style>
        <Style TargetType="ListBox" x:Key="DraggableListBox">
            <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
            <Setter Property="ItemContainerStyle" Value="{StaticResource DraggableItem}" />
        </Style>
 
        <DataTemplate x:Key="DragCueTemplate">
            <TextBlock Text="{Binding Name}"/>
        </DataTemplate>
    </Window.Resources>
 
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
 
        <ListBox x:Name="listBox1" Grid.Column="0" ItemsSource="{Binding Path=List1}" ItemTemplate="{StaticResource ItemTemplate}" Style="{StaticResource DraggableListBox}"/>
        <ListBox x:Name="listBox2" Grid.Column="1" ItemsSource="{Binding Path=List2}" ItemTemplate="{StaticResource ItemTemplate}" Style="{StaticResource DraggableListBox}"/>
    </Grid>
</Window>
Martin
Top achievements
Rank 1
 answered on 16 Jan 2012
1 answer
203 views
Hi,
I an trying to create a PieChart like:

<chart:RadChart
                                Name="qwe"
                                Content="RadChart"
                                ItemsSource="{Binding PieChartItems}">
                                <chart:RadChart.DefaultView>
                                    <charting:ChartDefaultView>
                                        <charting:ChartDefaultView.ChartArea/>
                                        <charting:ChartDefaultView.ChartTitle>
                                            <charting:ChartTitle Content="CHART TITLE"/>
                                        </charting:ChartDefaultView.ChartTitle>
                                        <charting:ChartDefaultView.ChartLegend>
                                            <charting:ChartLegend
                                                x:Name="ChartLegend2"
                                                Visibility="Visible"
                                                Header="ABC"
                                                Padding="0,0,5,0"
                                                HorizontalContentAlignment="Right"
                                                BorderThickness="0"
                                                Background="Transparent"/>
                                        </charting:ChartDefaultView.ChartLegend>
                                    </charting:ChartDefaultView>
                                </chart:RadChart.DefaultView>

The problem is where in the code I should add a manual series mapping in order to bind labels to a collection in VM.
Nikolay
Telerik team
 answered on 16 Jan 2012
5 answers
233 views
Hello,

Haven't found a specific case like mine on the forums, but I've tried several variances of code I've seen with no avail.

My problem is simple in nature, I have a data-bound GridViewComboBoxColumn that, when I load the program, doesn't display values synonymous with the data its bound to, or at all.  Data its bound to is correct on our other application using the same datasource, and the List<T> its bound to shows up when the combo box is clicked on, there are just no values initially in the grid.

XAML
<telerik:GridViewComboBoxColumn Header="Type" Width="160" UniqueName="Type" DataMemberBinding="{Binding Path=Type}" DisplayMemberPath="Name" /> 

C# on constructor call for the new view being created.
((GridViewComboBoxColumn)(Tasks.Columns[1])).ItemsSource = AdminHandler.GetQuestTaskTypes();

This is the ONLY instance of this in our tool, while every other GridViewComboBoxColumn is formatted the same way and working perfectly.  The only difference with this, is the C# is getting called inside the constructor of a new view, while the rest of the ItemsSource assignments are inside the LayoutRoot_Loaded event.

Thank you.
Maya
Telerik team
 answered on 16 Jan 2012
0 answers
145 views
I am working with Telerik WPF controls, RadGridView, RadDataPager and VirtualQueryableCollectionView<T>.
The PageCount of RadDataPager is incorrect once i filtered the data via RadGridView header. The PageCount  is  
always 1.  please find attached image screenshot.

I do not know how to fix this issue. In following code, i set the VirtualItemCount value as new value but the RadDataPager show me 1 as PageCount. I could not move to next page.  

Assembly version is: 2011.3.1220.40 

<telerik:RadGridView x:Name="GridView" ItemsSource="{Binding DataView}" Width="700" MinHeight="386" MaxHeight="500"
                .........
</telerik:RadGridView>
  
<telerik:RadDataPager PageSize="100" Grid.Row="1" Source="{Binding DataView}"  />

public VirtualQueryableCollectionView<VSOEChageItemViewModel> DataView
     {
         get
         {
             if (_DataView == null)
             {
                 _DataView = new VirtualQueryableCollectionView<VSOEChageItemViewModel>() { LoadSize = 40, VirtualItemCount = 40 };
                 _DataView.ItemsLoading += DataViewItemsLoading;
             }
             return _DataView;
         }
         private set
         {
             if (_DataView != null)
             {
                 _DataView.ItemsLoading -= DataViewItemsLoading;
             }
  
             _DataView = value;
  
             if (_DataView != null)
             {
                 _DataView.ItemsLoading += DataViewItemsLoading;
             }
         }
     }

private void DataViewItemsLoading(object sender, VirtualQueryableCollectionViewItemsLoadingEventArgs e)
     {
         string filertString = GetFilertString();
  
         var sort = DataView.SortDescriptors;
         var sortString = sort.ToDynamicLinq();
         if (!string.IsNullOrEmpty(sortString))
             sortString = sortString.Remove(0, sortString.IndexOf(".") + 1);
  
         int allCount = 0;
         List<VSOEChageItemViewModel> dd1 = LoadData(filertString, sortString, e.StartIndex, e.ItemCount, out allCount);
  
  
         if (allCount != DataView.VirtualItemCount)
         {
             DataView.VirtualItemCount = allCount;
         }
  
         DataView.Load(e.StartIndex, dd1);
  
     }
Srikrishna Illendula
Top achievements
Rank 1
 asked on 16 Jan 2012
4 answers
112 views
When I plot an OHLCSeries or CandlestickSeries on a ChartView, sometimes I have data points where the open, high, low, and close values are all the same.  In these cases, the data point doesn't show up at all -- no matter how far I may zoom in.  It seems that I should at least be able to see some small visual indicator of where the data point is instead of it being completely invisible.  This seems like a bug/usability issue, but I could be wrong.  Is this behavior by design?  

I'd like to request that such data points always be shown or that an option be provided to show them when each OHLC component value is the same.  Thanks!

Paul     
Paul
Top achievements
Rank 1
 answered on 14 Jan 2012
1 answer
258 views
Hello,
I'm developing a king of help in my WPF application... I've found no HTMLTextBox/TextBlock.... how can I present HTML just as Text inside WPF?

Thanks

RichTextBox doesn't seems to match my needs for showing just text

Thanks
Martin Ivanov
Telerik team
 answered on 13 Jan 2012
1 answer
116 views
Original code:
protected virtual double CalculateMaxValue()
{
    double maxValue = this.ActualMinValue;
 
    while ((decimal)maxValue < (decimal)this.SeriesMaxValue)
        maxValue += this.ActualStep;
 
    return maxValue;
}

If we have maxValue or SeriesMaxValue not in the decimal type range then we have an exception
"Value was either too large or too small for a Decimal.";

Stacktrace
System.OverflowException: Value was either too large or too small for a Decimal.
    Ð² System.Decimal..ctor(Double value)
    Ð² Telerik.Windows.Controls.Charting.AxisRange.CalculateMaxValue()
    Ð² Telerik.Windows.Controls.Charting.AxisRange.UpdateRange()
    Ð² Telerik.Windows.Controls.Charting.AxisRangeY.UpdateRange()
    Ð² Telerik.Windows.Controls.Charting.AxisY.InitializeAxisValuesForAutoRange()
    Ð² Telerik.Windows.Controls.Charting.Axis.BuildAxisData()
    Ð² Telerik.Windows.Controls.Charting.AxisY.BuildAxisData()
    Ð² Telerik.Windows.Controls.Charting.Axis2D`1.UpdateAxisData(Axis axis, Size newSize)
    Ð² Telerik.Windows.Controls.Charting.Axis2D`1.AxisSizeChanged(Object sender, SizeChangedEventArgs e)
    Ð² System.Windows.SizeChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    Ð² System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    Ð² System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    Ð² System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    Ð² System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    Ð² System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
    Ð² System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
    Ð² System.Windows.ContextLayoutManager.fireSizeChangedEvents()
    Ð² System.Windows.ContextLayoutManager.UpdateLayout()
    Ð² System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
    Ð² System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
    Ð² System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
    Ð² System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
    Ð² System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
    Ð² System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    Ð² MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

WPF 4.0
Telerik 2011.3.1116
Yavor
Telerik team
 answered on 13 Jan 2012
6 answers
271 views
I have a grid that I'm binding to an ObservableItemCollection and a separate toolbar that allows the user to perform Add, Delete, etc. operations on the data within the grid. The data going into the collection is not sorted. I'm setting the default sort on a column in the code behind. When I add a new row using the toolbar button or hitting Insert the new row is added underneath the last record in the ObservableItemCollection, not the end of the grid where I'd expect it to be. So the new row could show up anywhere within the grid. If I don't set the default sorting, it puts the row at the end. Is there a way to force the row to be inserted after the last record within the grid?

Also, I noticed when I don't set a default sort, then sort the grid on the client side I'm getting the same behavior. The insert it happening wherever the last item was put into the collection.

Thanks,
Karen
Jason
Top achievements
Rank 1
 answered on 13 Jan 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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?