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 }}
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

<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"/>

<telerik1:RadGridView Name="bareDriveCostsListRadGridView" DataContext="{StaticResource bareDriveCostsListViewModelModelViewSource}" ItemsSource="{Binding ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True}" AutoGenerateColumns="False" CanUserDeleteRows="False" AutoExpandGroups="True" DataLoaded="bareDriveCostsListRadGridView_DataLoaded" SelectionUnit="Cell" IsReadOnly="{Binding Source={StaticResource bareDriveCostsListViewModelViewSource}, Path=CanEdit, Converter={StaticResource NotConverter}}">
<telerik1:GridViewMaskedTextBoxColumn Name="HistoryColumn4" DataFormatString="{}{0:n}" MaskType="Numeric" Mask="n" Header="{Binding Path=HistoryName4}" Background="LightGray" DataMemberBinding="{Binding Path=History4.Cost}" IsReadOnly="True" TextAlignment="Right" IsFilterable="False" IsSortable="False" />and some like this
<telerik1:GridViewMaskedTextBoxColumn Name="BareDriveCostColumn" Header="Bare Drive Cost" DataMemberBinding="{Binding Path=Cost}" DataFormatString="{}{0:n}" TextAlignment="Right" MaskType="Numeric" Mask="n" IsFilterable="False" IsSortable="False" > <telerik1:GridViewMaskedTextBoxColumn.CellTemplate> <DataTemplate> <Grid MouseRightButtonDown="Cell_MouseRightButtonDown" DataContext="{Binding}" ToolTip="{DynamicResource toolTipTemplate}"> <TextBlock Text="{Binding Cost}"/> <Border VerticalAlignment="Top" Width="5" Height="5" HorizontalAlignment="Right" Background="Red" Visibility="{Binding Comments,Converter={StaticResource MyConverter}}"/> </Grid> </DataTemplate> </telerik1:GridViewMaskedTextBoxColumn.CellTemplate> </telerik1:GridViewMaskedTextBoxColumn>it errors on any of them.