Telerik Forums
UI for WPF Forum
10 answers
470 views
Is it possible to disable the horizontal scrollbar? If yes how do I do this?
(RadPanelBar is bound to a HierarchicalDataTemplate).

Peter Chapman
Top achievements
Rank 1
 answered on 26 Aug 2010
2 answers
80 views
Hi!

I've a  Tree, that has a RadContextMenu(Telerik's version of Context Menu). On every ItemMenu, I've an action.

I need to know, on which element of my Tree i've right clicked. How can I do this?

I tried to use the "SelectItem", but it seems the tree doesn't select on right click.

Thank you!

<Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.Resources>
<HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding SubNodes}">
                                <StackPanel  Orientation="Horizontal">
                                        <TextBlock Text="{Binding Name}"/>
                                </StackPanel>                               
                            </HierarchicalDataTemplate>
                        </Grid.Resources>
<telerik:RadTreeView Name="uxRadTreeView" ItemsSource="{Binding RootFolder.SubNodes}" ItemTemplate="{StaticResource NodeTemplate}" AllowDrop="False" IsDragDropEnabled="True" DragEnded="uxRadTreeView_DragEnded" MouseRightButtonUp="uxRadTreeView_MouseRightButtonUp">
                            <telerik:RadContextMenu.ContextMenu>
                                <telerik:RadContextMenu IsEnabled="{Binding MainTree.CurrentItem.IsFolder, Mode=OneWay}"  >
                                    <telerik:RadMenuItem Header="Create new folder" Icon="/GuiResources;component/ActionsIcons/newFolder.png" Click="NewFolder" />
                                    <telerik:RadMenuItem Header="Create new file"  Icon="/GuiResources;component/ActionsIcons/newFile.png" Click="NewFile"/>
                                    <telerik:RadMenuItem Header="Add a new version of this file" Icon="/GuiResources;component/ActionsIcons/newFileVersion.png" Click="NewFileVersion"/>
                                    <telerik:RadMenuItem Header="Delete" Icon="/GuiResources;component/ActionsIcons/delete.png" Click="Delete"/>
                                </telerik:RadContextMenu>
                            </telerik:RadContextMenu.ContextMenu>
                        </telerik:RadTreeView>
                    </Grid>
Julien
Top achievements
Rank 1
 answered on 26 Aug 2010
1 answer
129 views
Hi All,

I am using the RadChart for WPF in my project for displaying the Chart as LineSeries, my requirment is like this:
 1) I need to add dataPoints dynamically by reading the output file for each Dataseries
  2) I need to add AdditionalYAxes for each Dataseries
  3) I need to Apply ForeGround color for each DataSeries
   4)And the same DataSeires color i need to apply color for related AdditionalYAxes
 
I have done upto the Above Three Steps and i am able to add AdditionalYAxes. But i am not able to Apply the color Style for the AdditionYAxes line and also the AdditionalYAxes is not start from X-axes, for now it is starting from X-axes one Step above.

I need to apply the color for AdditionaYAxes for the relating DataSeries and The Line should Start from X-Axes position.

i have attached my codeSnippet below:
.XAML file

<

 

 

UserControl x:Class="TabControl.MainWindow"

 

 

 

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

 

 

 

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

 

 

 

xmlns:telerikChart="http://schemas.telerik.com/2008/xaml/presentation"

 

 

 

xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"

 

 

 

Height="Auto" Width="Auto">

 

 

 

 

<Grid>

 

 

 

 

<Grid.Resources>

 

 

 

 

<Style x:Name="CustomAxisLineStyle" TargetType="Line">

 

 

 

 

<Setter Property="Stroke" Value="Red" />

 

 

 

 

<Setter Property="StrokeThickness" Value="5" />

 

 

 

 

</Style>

 

 

 

 

</Grid.Resources>

 

 

 

 

<telerikChart:RadChart x:Name="_myChart">

 

 

 

 

</telerikChart:RadChart>

 

 

 

 

</Grid>

 

</

 

 

UserControl>

 


.Xaml.cs file

 

 

private void GenerateSeries(string target, ref DateTime timeStamp, double avgVal, string counterName)

 

{

 

 

int _minsOffSet=0;

 

 

 

DateTime minDate = DateTime.MaxValue;

 

 

 

DateTime maxDate = DateTime.MinValue;

 

 

 

double minVal = double.MaxValue;

 

 

 

double maxVal = double.MinValue;

 

 

 

DataSeries counterSeries = new DataSeries();

 

counterSeries.Definition =

 

new LineSeriesDefinition() { ShowItemLabels = false, ShowItemToolTips = true };

 

counterSeries.Definition.ItemToolTipFormat =

 

"#SERIESLABEL\n#Y";

 

counterSeries.Definition.AxisName = counterName;

 

 

AxisY yAxis = new AxisY();

 

yAxis.AxisName = counterName;

 

 

string legendName = string.Format("{0}", counterName);

 

SetLegendDetails(legendName,

 

ref counterSeries, ref yAxis);

 

 

 

DateTime time = timeStamp.AddMinutes(_minsOffSet);

 

 

minVal =

 

Math.Min(minVal, avgVal);

 

maxVal =

 

Math.Max(maxVal, avgVal);

 

 

 

DataPoint dp = new DataPoint(time.ToOADate(), avgVal);

 

dp.IsDateTime =

 

true;

 

counterSeries.Add(dp);

 

 

if (time > maxDate)

 

maxDate = time;

 

 

if (time < minDate)

 

minDate = time;

 

 

if (avgVal > maxVal)

 

maxVal = avgVal;

 

 

if (avgVal > minVal)

 

minVal = avgVal;

_myChart.DefaultView.ChartArea.AxisX.MinValue = minDate.ToOADate();

_myChart.DefaultView.ChartArea.AxisX.MaxValue = maxDate.ToOADate();

_myChart.DefaultView.ChartArea.AxisY.MinValue = minVal;

_myChart.DefaultView.ChartArea.AxisY.MaxValue = maxVal;

_myChart.DefaultView.ChartArea.DataSeries.Add(counterSeries);

_myChart.DefaultView.ChartArea.AdditionalYAxes.Add(yAxis);

 

 

double graphVariation = maxVal - minVal;

 

 

 

if ((graphVariation > 2) & (graphVariation <= 9))

 

{

_myChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat =

 

"n1";

 

}

 

 

else if (graphVariation <= 2)

 

{

_myChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat =

 

"n3";

 

}

 

 

else

 

{

_myChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat =

 

"n0";

 

_myChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat =

 

"0";

 

}

}

 

 

private void SetLegendDetails(string legendName, ref DataSeries dataSeries, ref AxisY yAxis)

 

{

_myChart.DefaultView.ChartLegend.Header =

 

"";

 

_myChart.DefaultView.ChartLegend.UseAutoGeneratedItems =

 

true;

 

dataSeries.LegendLabel = legendName;

dataSeries.Definition.Appearance.Foreground =

 

new SolidColorBrush(Colors.Green);

 

 

 

Style customAxisYStyle = this.Resources["CustomAxisYStyle"] as Style;

 

_myChart.DefaultView.ChartArea.AxisY.AxisStyles.AxisLineStyle = customAxisYStyle;

 

}

I have attaching the Chart ScreenShot what i implemented.
Please see in Attachments
i am  calling the GenerateSeries Method every time for loading the X-Axis value and Y-Axes value.
Please any one help me how to apply color and starting position of AdditionaYAxes.
This is very urgent Requirment.

Thanks and Regards
Satish
Sia
Telerik team
 answered on 26 Aug 2010
6 answers
147 views
Hi,

On my RadChart i would like to "control" x labelstep thank to a property in a ViewModel (as you see I'm using MVVM pattern).

But when i try to use this mehod, i've got this message :

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Intervalle; DataItem=null; target element is 'AxisX' (HashCode=6253391); target property is 'LabelStep' (type 'Int32')

It seems that RadChart is loosing DataContext juste for this property. Any idea ? :D I probably should affect DataContext to "AxisX" but i don't know how to do it.

Here is my code :

<telerik:ChartArea LegendName="CustomLegend" Name="chArea" NoDataString="Aucune données" DataContext="{Binding ElementName=brd1,Path=DataContext}">
                              <telerik:ChartArea.AxisX>
                                  <telerik:AxisX MajorGridLinesVisibility="Collapsed"
                                                 Title="Heures"
                                                 IsZeroBased="True" AutoRange="True" LabelStep="{Binding Intervalle}" />
                              </telerik:ChartArea.AxisX>
                              <telerik:ChartArea.AxisY>
                                  <telerik:AxisY MajorGridLinesVisibility="Visible"
                                                 MinorTicksVisibility="Visible"
                                                 Title="Hits Lus" AutoScale="True" />
                              </telerik:ChartArea.AxisY>
                          </telerik:ChartArea>


Thank's !
Yves
Top achievements
Rank 1
 answered on 26 Aug 2010
9 answers
409 views
HI.

I am building a grid in code, and needs to add rows ( and populate theirs cells ) in runtime.

Creating the columns was easy, but I battle to edit the cell values.

This is what I have tried.

grid.Items.AddNew()  creates a new row in the grid. I would now like to assign a value to cell[0] in the new row.
grid.Items[0] does not contain a method to access the cells.

How do I get to the cells?

I know that binding the grid to a datatable will be much easier, but I was hoping to access the cells directly, without having to create a table for the data first.

Thx!

 

 

Pavel Pavlov
Telerik team
 answered on 26 Aug 2010
1 answer
174 views
I am unable to centre a child dialog window of type RadWindow. I create the window as following:

NewGoalWindow view = new NewGoalWindow();
view.WindowStartupLocation = WindowStartupLocation.CenterOwner;
view.Owner = WindowHelper.MainWindow;
NewGoalViewModel model = new NewGoalViewModel();
model.RequestClose += delegate
{
  view.Close();
};
view.DataContext = model;
view.ShowDialog();

The window is always located in the top left corder. WindowHelper.MainWindow is a reference to a RadWindow, which I have checked is the main window of the application.

I need help. Am I overlooking something?
David
Top achievements
Rank 1
 answered on 25 Aug 2010
2 answers
105 views
I've got a RadPanelBar with the Vertical/Horizontal Visibility properties set to Auto, which has been working initially when I display a user-control, but has some issues with resizing:

If I increase the height of my window, the vertical scrollbar's height seems to be aware of the increased height, and accounts for this, however, when I decrease the height of the window, the vertical scrollbar remains at the largest height it had reached previously. 

I recall some properties in WinForms you had to set in order to resize for grow-and-shrink, but I don't see anything like this in the WPF stack.  Is this resize behavior a known issue, or have I missed a setting that would make the scrollbar work as expected?

BTW - we're using version 2010.1.515.35 currently

Thanks,
Tony
Tony Mocella
Top achievements
Rank 1
 answered on 25 Aug 2010
6 answers
287 views
Hi:
I need to design a cell template only for one column of the radgridview, How can do that? and
the cell template change depending the value of other column of the radgridview (in code behind).

please help me!
my Best Wishes
Oscar Zapata.
 

Daniel Meland
Top achievements
Rank 1
 answered on 25 Aug 2010
3 answers
97 views
The RadTimePicker doesn't work correctly when it is placed inside a listbox. When you select a time from the dropdown, then the dropdown closes, but the binding is not updated.

The following snippet shows the problem:
<ListBox x:Name="multipleItemsPresenter" ItemsSource="{Binding}">
 <ListBox.ItemTemplate>
  <DataTemplate>
   <StackPanel Orientation="Horizontal">
    <telerik:RadTimePicker Width="80" SelectedTime="{Binding Path=Time, Mode=TwoWay}"/>
    <TextBlock Margin="20,0,0,0" Text="{Binding Path=Time, Mode=OneWay}">
   </StackPanel>
  </DataTemplate>
 </ListBox.ItemTemplate>
</ListBox>

I guess the ListBox and/or ListView intercepts the click, because it does work fine with an ItemsControl.
Konstantina
Telerik team
 answered on 25 Aug 2010
1 answer
211 views
Is it possible to sort a GridViewDataColumn by the result of the converter rather than the object the column is bound to?
Maya
Telerik team
 answered on 25 Aug 2010
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?