Telerik Forums
UI for WPF Forum
1 answer
536 views
Hi,

I have a situation where I need to hide series on a bar chart.

I can hide the series by doing this...
//hide unused series
barChart.DefaultView.ChartArea.DataSeries[1].Definition.Visibility = SeriesVisibility.Collapsed;

however, the series stays in the legend. So I need to remove it there too.

But this doesn't work... how do I hide the series from the legend as well?
barChart.DefaultView.ChartLegend.Items[1].Visibility = Visibility.Collapsed;

Here's my XAML where I specify 2 series...
<telerikControls:RadChart x:Name="barChart" Grid.Column="1" Grid.Row="3" Height="475" Width="720" HorizontalAlignment="Left" Background="Transparent" BorderThickness="0" AxisForeground="White" AxisElementBrush="White" >
            <telerikControls:RadChart.PaletteBrushes>
                <SolidColorBrush   Color="#009ad4" />
                <SolidColorBrush   Color="#bfe9f5" />
            </telerikControls:RadChart.PaletteBrushes>
            <telerikControls:RadChart.DefaultView>
                <telerikCharting:ChartDefaultView ChartLegendPosition="Top">
                    <telerikCharting:ChartDefaultView.ChartArea>
                        <telerikCharting:ChartArea LegendName="ChartLegend1"></telerikCharting:ChartArea>
                    </telerikCharting:ChartDefaultView.ChartArea>
                    <telerikCharting:ChartDefaultView.ChartLegend>
                        <telerikCharting:ChartLegend BorderThickness="0" Header="" x:Name="ChartLegend1" Background="Transparent">                           
                        </telerikCharting:ChartLegend>
                    </telerikCharting:ChartDefaultView.ChartLegend>
                </telerikCharting:ChartDefaultView>
            </telerikControls:RadChart.DefaultView>
 
            <!--SERIES MAPPING -->
            <telerikControls:RadChart.SeriesMappings>
                <telerikCharting:SeriesMapping LegendLabel="2011" >
                    <telerikCharting:SeriesMapping.SeriesDefinition>
                        <telerikCharting:BarSeriesDefinition ItemStyle="{StaticResource BarStyle}"></telerikCharting:BarSeriesDefinition>
                    </telerikCharting:SeriesMapping.SeriesDefinition>
                    <telerikCharting:SeriesMapping.ItemMappings>
                        <telerikCharting:ItemMapping FieldName="Title" DataPointMember="XCategory"></telerikCharting:ItemMapping>
                        <telerikCharting:ItemMapping FieldName="Dec" DataPointMember="YValue"></telerikCharting:ItemMapping>
                    </telerikCharting:SeriesMapping.ItemMappings>
                </telerikCharting:SeriesMapping>
                <telerikCharting:SeriesMapping LegendLabel="2010">
                    <telerikCharting:SeriesMapping.SeriesDefinition>
                        <telerikCharting:BarSeriesDefinition ItemStyle="{StaticResource BarStyle}"></telerikCharting:BarSeriesDefinition>
                    </telerikCharting:SeriesMapping.SeriesDefinition>
                    <telerikCharting:SeriesMapping.ItemMappings>
                        <telerikCharting:ItemMapping FieldName="Title" DataPointMember="XCategory"></telerikCharting:ItemMapping>
                        <telerikCharting:ItemMapping FieldName="Dec" DataPointMember="YValue"></telerikCharting:ItemMapping>
                    </telerikCharting:SeriesMapping.ItemMappings>
                </telerikCharting:SeriesMapping>
            </telerikControls:RadChart.SeriesMappings>
        </telerikControls:RadChart>

And my onload where I hide the series...

private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //perform extra styling on load
            barChart.DefaultView.ChartTitle.Visibility = Visibility.Collapsed;
            barChart.DefaultView.ChartArea.AxisY.StripLinesVisibility = Visibility.Hidden;
            barChart.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
            barChart.DefaultView.ChartArea.AxisY.AxisStyles.ItemLabelStyle = this.Resources["AxisYLabelStyle"] as Style;
            
            //attach click event
            barChart.DefaultView.ChartArea.ItemClick +=new EventHandler<ChartItemClickEventArgs>(ChartArea_ItemClick);
 
            //Set itemsource
            barChart.ItemsSource = ItemsSource.Items;
 
            //hide unused series
            barChart.DefaultView.ChartArea.DataSeries[1].Definition.Visibility = SeriesVisibility.Collapsed;
   
//doesn't hide legend item...
barChart.DefaultView.ChartLegend.Items[1].Visibility = Visibility.Collapsed;
        }


Thanks!

Ken
Evgenia
Telerik team
 answered on 29 Aug 2011
3 answers
209 views
I'm somewhat new to WPF so I could just be doing something stupid - if so please forgive me.
I'm trying to use the RadRibbonView control to display a QAT and backstage menu and I've bound the typical Save, Open, New, etc. buttons to a Command which I've set up to call a CanExecute and Executed event in the code behind of my application. The problem I'm having is that whenever I navigate to the backstage all of the QAT buttons become disabled (despite my configuring them to always be enabled) and *some* of the buttons in the backstage don't work (they show as enabled but some of them just don't call the Executed handler). I've been pulling my hair out trying to figure out what's going on and I'm getting nowhere with it. I've posted a sample app that reproduces the issue to my site: http://www.falchionconsulting.com/wpfribbontest.zip. Here's the core pieces of code that you'll see in there:

Update: I found that if I have CloseOnClick="False" for the RadRibbonBackstageItem button then the event fires but the QAT buttons are still disabled (and of course the backstage is still visible).

MainWindow.xaml:
<telerik:RadRibbonWindow x:Class="WpfRibbonTest.MainWindow" xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonView" Title="Ribbon Test" Height="350" Width="525" >

<Window.CommandBindings>

<CommandBinding Command="ApplicationCommands.Close" CanExecute="CloseButton_CanExecute" Executed="CloseButton_Executed" />

<CommandBinding Command="ApplicationCommands.Save" CanExecute="SaveButton_CanExecute" Executed="SaveButton_Executed" />

<CommandBinding Command="ApplicationCommands.SaveAs" CanExecute="SaveAsButton_CanExecute" Executed="SaveAsButton_Executed" />

<CommandBinding Command="ApplicationCommands.Open" CanExecute="OpenButton_CanExecute" Executed="OpenButton_Executed" />

<CommandBinding Command="ApplicationCommands.New" CanExecute="NewButton_CanExecute" Executed="NewButton_Executed" />

</Window.CommandBindings>

 

<Grid>

<Grid.RowDefinitions>

<RowDefinition Height="Auto"></RowDefinition>

<RowDefinition></RowDefinition>

</Grid.RowDefinitions>

<telerik:RadRibbonView Grid.Row="0" ApplicationButtonContent="File" IsBackstageOpen="False" x:Name="ribbon" ApplicationName="App Name" Title="App Title">

<telerik:RadRibbonView.QuickAccessToolBar>

<telerik:QuickAccessToolBar>

<telerik:RadRibbonButton Text="New" Size="Small" SmallImage="Icons/Icon.ico" Command="ApplicationCommands.New" />

<telerik:RadRibbonButton Text="Open" Size="Small" SmallImage="Icons/Open.png" Command="ApplicationCommands.Open" />

<telerik:RadRibbonButton Text="Save" Size="Small" SmallImage="Icons/Save.ico" Command="ApplicationCommands.Save" />

</telerik:QuickAccessToolBar>

</telerik:RadRibbonView.QuickAccessToolBar>

<telerik:RadRibbonView.Backstage>

<telerik:RadRibbonBackstage>

<telerik:RadRibbonBackstageItem Header="New" Icon="Icons/New.png" IsSelectable="False" Command="ApplicationCommands.New" />

<telerik:RadRibbonBackstageItem Header="Open" Icon="Icons/Backstage/Open.png" IsSelectable="False" Command="ApplicationCommands.Open" />

<telerik:RadRibbonBackstageItem CloseOnClick="False" Header="Save" Icon="Icons/Backstage/Save.png" IsSelectable="False" Command="ApplicationCommands.Save" />

<telerik:RadRibbonBackstageItem Header="Save As" Icon="Icons/Backstage/SaveAs.png" IsSelectable="false" Command="ApplicationCommands.SaveAs" />

<telerik:RadRibbonBackstageItem Header="Separator" IsGroupSeparator="True" />

<telerik:RadRibbonBackstageItem Header="Exit" Icon="Icons/Backstage/Exit.png" IsSelectable="False" Command="ApplicationCommands.Close" />

</telerik:RadRibbonBackstage>

</telerik:RadRibbonView.Backstage>

<telerik:RadRibbonTab Header="Home" x:Name="homeTab">

<telerik:RadRibbonGroup Header="Group 1">

<telerik:RadRibbonGroup.Variants>

<telerik:GroupVariant Variant="Large" Priority="1" />

</telerik:RadRibbonGroup.Variants>

</telerik:RadRibbonGroup>

</telerik:RadRibbonTab>

</telerik:RadRibbonView>

</Grid>

</telerik:RadRibbonWindow

 

 

 

Codebehind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
 
namespace WpfRibbonTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : RadRibbonWindow
    {
        public static RoutedCommand OpenMruFileCommand = new RoutedCommand();
 
        public MainWindow()
        {
            InitializeComponent();
        }
 
        #region New Menu Event Handler
 
        private void NewButton_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }
 
        private void NewButton_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            NewFile();
        }
 
        private void NewFile()
        {
            MessageBox.Show("New File called");
        }
 
        #endregion
 
        #region Open Menu Event Handler
 
        private void OpenButton_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }
 
        private void OpenButton_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFile();
        }
 
        private void OpenFile()
        {
            MessageBox.Show("Open File called");
        }
        private void OpenFile(string fileName)
        {
            MessageBox.Show("Open File called (" + fileName + ")");
        }
 
 
        #endregion
 
        #region Save Menu Event Handler
 
        private void SaveButton_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }
 
        private void SaveButton_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFile(false);
        }
 
        private void SaveAsButton_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }
 
        private void SaveAsButton_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFile(true);
        }
 
 
        private void SaveFile(bool saveAs)
        {
            MessageBox.Show("Save File called (SaveAs=" + saveAs + ")");
        }
 
        #endregion
 
 
        #region Close Button Event Handler
 
        private void CloseButton_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }
 
        private void CloseButton_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            MessageBox.Show("Close App called");
        }
 
 
        #endregion
    }
}
Petar Mladenov
Telerik team
 answered on 29 Aug 2011
2 answers
78 views
Is there a way programmaticly open a given columns filter input?
Rossen Hristov
Telerik team
 answered on 29 Aug 2011
3 answers
86 views
Hi, 
I'm experiencing now the trial version of Telerik.Windows.Controls DLL V2011, in order to decide whether to upgrade from V2009,
and unfortunately encountered several problems which I'll appreciate your help solving them.

1. Can't select nodes in the hierarchical tree from code behind if the node isn't in the view,
Because the TreeViewItem is null after trying getting it from the ItemContainerGenerator:
var treeItem = (RadTreeViewItem)control.ItemContainerGenerator.ContainerFromItem(myVMObject);

And I'm using virtualizing

VirtualizingStackPanel.IsVirtualizing="True"  VirtualizingStackPanel.VirtualizationMode="Recycling"












2. When sometimes the TreeViewItem is not null, then trying to bring it into view, the previous code no longer works.
                        ItemsControl control = treeView;
                        control.UpdateLayout();
                        var treeItem = (RadTreeViewItem)control.ItemContainerGenerator.ContainerFromItem(myVMObject);
                        if (treeItem != null)
                        {
                                treeItem.Focus();
                                treeItem.IsSelected = true;
                                treeItem.IsExpanded = true;                          
                        }

3. By clicking on a node and then switching to other node,
sometimes the last clicked node, even that is selected, not visualy looks like selected,
and the previous one looks like it still selected.

 











Thanks in advance,
Merav


Petar Mladenov
Telerik team
 answered on 29 Aug 2011
6 answers
314 views
I am implementing a RadDataForm and even though the data binds, the New button is disabled and the Cancel button (while editing) is disabled also.

I have tried creating Templates (with AutoGenerateFields="False") but it did not make a difference.
Marcelo
Top achievements
Rank 1
 answered on 29 Aug 2011
1 answer
82 views
Hi,

I have a list of objects that has MaxValue = 680334468, MinValue = -680334468, I need to set a custom range on my axis to show rounded off value. Right now my axis is shown like this,

http://dl.dropbox.com/u/23500975/Telerik/chartaxis.png

I have a step value of 27213378 (MaxValue / (half of objects list)). I tried to round off the axis as,

max = ceil( maxValue / 500000 ) * 500000
min = ceil( minValue / 500000 ) * 500000
step = 500000

I'm assuming the chart will render if the axis is bigger than the data, and it gives me this axis results as,

http://dl.dropbox.com/u/23500975/Telerik/chartaxis2.png

I would like to know how to round-off my cusotm axis range to  properly visualize it. Please let me know any sample / code to do this.

-Fahad
Nikolay
Telerik team
 answered on 29 Aug 2011
1 answer
95 views
Since the last release (2011.2) the method for drop is not called anymore (drop=...).
In version 2010.3 it is working.

Are there any changes that needs to be done?

With kind regards,
Rob
        <telerik:RadTreeView Height="683" Margin="12,34,0,0" Name="ServicesTree" Width="342"
            Background="White"
            Foreground="Black"
            IsLineEnabled="True"
            AllowDrop="True"
            IsRootLinesEnabled="True" DragEnter="ServicesTree_DragEnter" Drop="ServicesTree_Drop"/>

Petar Mladenov
Telerik team
 answered on 29 Aug 2011
1 answer
166 views
Do telerik WPF controls support XBAP in medium trust mode? I found no info about it on telerik.com, neither XBAP online demos, only ClickOnce demos. However I've found some links in old forum threads leading to the XBAP demos (http://demos.telerik.com/wpf#Telerik.Windows.Examples.xbap for example), none of them working now.
Valeri Hristov
Telerik team
 answered on 29 Aug 2011
1 answer
93 views
I have a combobox displaying 3 separate fields from the data source (using data template)

I would like to have autocomplete search any of these fields as the user types.

Is there a way to customize the way autocomplete works or modify the source of data which it is searching through to get this to work?

For example I am displaying first name, last name, and id in the combo box

and I would like the user to be able to start typing the first name or the last name or the id and have autocomplete select hits from any of those fields as the user types.
Valeri Hristov
Telerik team
 answered on 29 Aug 2011
1 answer
62 views
I have a schedule view control that I have in timeline view, however, the slots are far too small to be of use.  I have noticed that the scheduler control had a property you could set on the timeline view called 'numberofslots'  This seemed to set the exact number of visible slots and they would grow to fill the space.  Is there a property that would accomplish the same thing for the schedule view control?
Yana
Telerik team
 answered on 29 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?