Telerik Forums
UI for WPF Forum
2 answers
268 views
Hi All,
    I have an issue where I am binding my ViewModel to the TreeView and using a hierarchical data template to allow a self referencing list of items.

I have got this all working fine - however, when I add a new item to the source list, it causes the itemssource on the treeview to be re-evaluated. This in turn calls the converter (which is using a linq query to find the top level of the tree and children).

I think that by calling this converter, the TreeView is losing track of which items were expanded because when the control refreshes, the TreeView is collapsed

This is my converter code (pretty simple):
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
       {
           var item = value as Structure;
           var items = value as SturctureCollection;
 
           if (items != null)
           {
               return items.Where(i => i.ParentID == 0);
           }
           else if (item != null)
           {
               var parent = (item.Parent as StructureCollection);
 
               return parent.Where(i => i.ParentID == item.ID);
           }
 
           return null;
       }

Any idea if this is easily recitified with an option on the control? If not I assume I will need to track which items are expanded (I was thinking about just putting the IDs in a list and iterating), if so which event is best to use when the underlying itemssource is re-evaluated?

Thanks,
Charles
Petar Mladenov
Telerik team
 answered on 03 Aug 2012
1 answer
102 views
We have started using the Telerik RadControls in our latest WPF application, but our test team are having a few issues when using QTP 11.0 to create automated UI tests for some of the controls.

Specifically, when a RadComboBox is made editable, they can't get QTP to enter text with the 'type' command (which works with a regular WPF ComboBox) as it complains it can't focus on the control. Also with the RadGridView control it doesn't seem to pick the grid up at all, just individual cells.

Has anyone else had any luck using QTP with the WPF RadControls? Any tips or QTP plugins that anyone is aware of?

Thanks for any help,

John
Ivan Ivanov
Telerik team
 answered on 03 Aug 2012
1 answer
87 views
I want to add user control in grid view header template. please guid
Shradha
Top achievements
Rank 1
 answered on 03 Aug 2012
1 answer
362 views
Hello,

I'm using Telerik RadControls for WPF 2012.2.725.40. I have a RadListBox with a DataTemplate for the items. In the DataTemplate I have a TextBox and I want to achieve that when the user clicks inside the TextBox, the ListBoxItem gets selected. So, I made a Style:

<Style TargetType="{x:Type telerik:RadListBoxItem}">
    <Style.Triggers>
        <Trigger Property="IsKeyboardFocusWithin" Value="True">
            <Setter Property="IsSelected" Value="True" />
        </Trigger>
    </Style.Triggers>
</Style>

This works fine with standard WPF ListBox but not with RadListBox/RadListBoxItems.

The full source:
<Window x:Class="IsKeyboardFocusWithin.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <DataTemplate x:Key="ListBoxItemTemplate">
            <TextBox Text="aasdf asdf asdf asdf asf " />
        </DataTemplate>
 
        <Style TargetType="{x:Type ListBoxItem}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocusWithin" Value="True">
                    <Setter Property="IsSelected" Value="True" />
                </Trigger>
            </Style.Triggers>
        </Style>
 
        <Style TargetType="{x:Type telerik:RadListBoxItem}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocusWithin" Value="True">
                    <Setter Property="IsSelected" Value="True" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
         
        <ListBox x:Name="lstList" ItemTemplate="{StaticResource ListBoxItemTemplate}" VerticalContentAlignment="Stretch" ItemsSource="{Binding}"
                            SelectionMode="Single" />
 
        <telerik:RadListBox x:Name="lstTelerikList"
                            ItemTemplate="{StaticResource ListBoxItemTemplate}" VerticalContentAlignment="Stretch" ItemsSource="{Binding}"
                            SelectionMode="Single"
                            Grid.Row="1"/>
    </Grid>
</Window>

and the code-behind:

public partial class MainWindow : Window
{
    public MainWindow()
    {
        Items = new ObservableCollection<string>() { "Item 1", "Item 2", "Item 3" };
        InitializeComponent();
        lstList.DataContext = Items;
        lstTelerikList.DataContext = Items;
    }
 
    public ObservableCollection<string> Items
    {
        get;
        set;
    }
}

Am I doing something wrong?
Masha
Telerik team
 answered on 03 Aug 2012
10 answers
316 views
I've got data loaded in the RadGridView control that I want to export to Excel. This is working just fine, using the .ToCSV method. However what I'm searching for is way to tell Excel to treat a column as a Text instead of General.

One of the columns is a bar code number. This number can start with a zero, like 0123456789.

After the export Excel cuts off the first zero because it is formatting it as a General and I get 123456789. I know I can reformat in Excel to custom format. But this should not be necessary.

Any recommendations?

I've tried setting DataFormatString to "{}{0:000000000000}", but this does not work. I did see a previous post that describes a bug in DataFormatString and I'm using 2010_1_0309 version of RadControls, which I think is a older version.

Thanks ...
Nikita
Top achievements
Rank 1
 answered on 03 Aug 2012
5 answers
489 views
Hi,

I'm trying to make a line chart with multiple series with the Y-Axis being an integer value and the X-Axis being a date value. However, I need to display something custom for the X-Axis item labels - not the date. So far I have been able to do everything except to get the X-Axis item labels to show the custom label values. Any help would be appreciated.

Thanks.
Rosko
Telerik team
 answered on 03 Aug 2012
2 answers
752 views
Hello!!

So, I blew up your ChartView by having fun with animating heights.  In my live application, I have two ChartViews on different rows of a Grid and the row heights are animated to show/collapse a chart.  If the window size is small enough, I will get a  "'-1' is not a valid value for property 'Height'." exception with this stack trace:
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.FrameworkElement.set_Height(Double value)
at Telerik.Windows.Controls.ChartView.PresenterBase.ArrangeUIElement(FrameworkElement presenter, RadRect layoutSlot, Boolean setSize) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\PresenterBase.cs:line 297
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateYStripes() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 479
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateVisuals(ChartLayoutContext context) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 421
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateUICore(ChartLayoutContext context) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 296

I have been able to reproduce this issue in its own project by forcefully setting the chart Height property to a small value and then adding a series (line/bar doesn't matter).  This is done in a Command executed by pressing a button.  Here is the relevant reproduction code:

View:
<Window x:Class="TinyChart.MainWindow"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
    <telerik:RadCartesianChart x:Name="chart" telerik:StyleManager.Theme="Metro">
        <telerik:RadCartesianChart.TrackBallInfoStyle>
            <Style TargetType="telerik:TrackBallInfoControl">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" Foreground="Black" HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </telerik:RadCartesianChart.TrackBallInfoStyle>
        <telerik:RadCartesianChart.Behaviors>
            <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="True" SnapMode="AllClosePoints" />
        </telerik:RadCartesianChart.Behaviors>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:DateTimeCategoricalAxis LabelFormat="dd MMM yyyy" Title="Date Processed" DateTimeComponent="DayOfYear" LabelFitMode="Rotate" LabelInterval="3" LastLabelVisibility="Visible">
                <telerik:DateTimeCategoricalAxis.LabelTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding}" HorizontalAlignment="Center" />
                        </StackPanel>
                    </DataTemplate>
                </telerik:DateTimeCategoricalAxis.LabelTemplate>
            </telerik:DateTimeCategoricalAxis>
        </telerik:RadCartesianChart.HorizontalAxis>
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis Title="# Documents Processed" />
        </telerik:RadCartesianChart.VerticalAxis>
        <telerik:RadCartesianChart.Grid>
            <telerik:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y" />
        </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>
        <Button Command="{Binding MyCommand}" Width="64" Height="64" VerticalAlignment="Top" HorizontalAlignment="Right" Content="..." />
    </Grid>
</Window>

View Model:

public class MainWindowViewModel
    {
        public ObservableCollection<Item> Items { get; set; }
        public ICommand MyCommand { get; set; }
        public MainWindow View { get; set; }
 
        public MainWindowViewModel()
        {
            MyCommand = new RelayCommand(OnMyCommand);
 
            Items = new ObservableCollection<Item>();
 
            Items.Add(new Item { Date = DateTime.Now, Number = 1 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(1), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(2), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(3), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(4), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(5), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(6), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(1), Number = 1 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(7), Number = 0 });
        }
 
        private void OnMyCommand()
        {
            View.chart.Height = 100;
            View.chart.Series.Add(new BarSeries
                        {
                            //StrokeThickness = 4,
                            //Stroke = Brushes.Red,
                            ItemsSource = Items,
                            CategoryBinding = new PropertyNameDataPointBinding("Date"),
                            ValueBinding = new PropertyNameDataPointBinding("Number"),
                            ShowLabels = false
                        });
        }
    }
 
    public class Item
    {
        public DateTime Date { get; set; }
        public int Number { get; set; }
 
        public override string ToString()
        {
            return Date.ToString() + " - " + Number.ToString();
        }
    }

I require this situation to work.  Although it may seem silly to set height before adding a series, this should not cause a crash.  If a workaround can't be found, I will require a hotfix.  This occurs with the latest version Q2 2012 SP1 (also Q1 2012).

The series is added after user invokes a command, so I know what data to display.  There can be multiple series in a chart also, hence the programmatic approach.

I am at a loss to figure out how to solve this problem as I can find nothing wrong with my code and it works fine when the screen size is sufficiently large enough.

Thank you very much!
Petar Kirov
Telerik team
 answered on 03 Aug 2012
1 answer
146 views
I'm trying to create a simple horizontal bar chart that contains 3 data items and corresponding values. I've been working through the Help files on the website to get started with a RadCartesianChart.
I have the dlls,  Telerik.Windows.Controls, Telerik.Windows.Controls.Chart, and Telerik.Windows.Data included as referenced libraries within the WPF project. Any ideas what I am doing wrong?

I have the following references setup in XAML:
xmlns:chart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:charting="clr-namespace:Telerik.Charting;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartView="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"

I have the chart declared as shown below. The LinearAxis and CategoricalAxis are displaying messages that state; The type 'chart:LinearAxis' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
<ContentControl Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="300"
                 x:Name="chartPlaceHolder">
    <chart:RadCartesianChart x:Name="speedometerChart">
        <chart:RadCartesianChart.HorizontalAxis>
            <chart:LinearAxis/>
        </chart:RadCartesianChart.HorizontalAxis>
        <chart:RadCartesianChart.VerticalAxis>
            <chart:CategoricalAxis/>
        </chart:RadCartesianChart.VerticalAxis>
    </chart:RadCartesianChart>
</ContentControl>
Rosko
Telerik team
 answered on 03 Aug 2012
2 answers
214 views
Hi there,

I've got the WPF telerik controls which is great, but I'm new to WPF so many of the controls and usages are still a bit of a mystery.
If I wanted a static main form and when different buttons (almost like a menu, but each button represents a section of the application) are clicked then I want to load another form into the main form, kind of like old MDI forms.

What's the right tool for the job here. I almost thought the Tileview might do the job, but then it seems more like the tile view is more there to dislpay small chunks of data to the user and have them be able to move it around.

Thanks,
Jacques
Jacques
Top achievements
Rank 2
 answered on 03 Aug 2012
3 answers
156 views
Hi,

I've been using the RowReordering tutorials to implement my drag & drop functionality and I'm trying to prevent certain grids from dropping their draggedItems into a grid. I'm thinking all I need is the target and source grid references, performing a simple comparison or test and show the "disabled" drag effect. I can get the target grid object but not the source grid object from inside the OnDragOver or OnDrop event handlers.

How can I do this? 

Thanks
Dimitrina
Telerik team
 answered on 03 Aug 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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?