Telerik Forums
UI for WPF Forum
4 answers
230 views
Hello,
I referred to a MVVM RadRibbonView example and I tried to implement RadRibbonComboBox in RibbonView with MVVM method.
But it doesn't work normally.
Please see a attached screenshot image.

I make a DataTemplate as follows.

Case1 -- use RadComboBox in RibbonView

    <!-- 
    <DataTemplate x:Key="ComboBoxItemTemplate">
        <Grid>
            <TextBlock Text="{Binding Text}" />
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="ComboBoxTemplate">
        <telerik:RadComboBox 
            ItemsSource="{Binding Items}" 
            ItemTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectionBoxTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectedIndex="{Binding SelectedIndex}"/>
    </DataTemplate>
    -->


Case 2. use RadRibbonComboBox and RadRibbonComboBoxItem 

    <DataTemplate x:Key="ComboBoxItemTemplate">
        <telerik:RadRibbonComboBoxItem Content="{Binding Text}" />
    </DataTemplate>

    <DataTemplate x:Key="ComboBoxTemplate">
        <telerik:RadRibbonComboBox 
            ItemsSource="{Binding Items}" 
            ItemTemplate="{StaticResource ComboBoxItemTemplate}"
            SelectedIndex="{Binding SelectedIndex}"/>
    </DataTemplate>
Hyunho
Top achievements
Rank 1
 answered on 16 Apr 2013
3 answers
310 views
There appears to be a memory leak when a DocumentRuler is associated to a RadRichTextBox.  The following is code for a demo WPF Application project that can demonstrate this issue:

MainWindow.Xaml:
<Window x:Class="RulerMemoryLeakDemo.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>       
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button Click="ButtonBase_OnClick">New Editor</Button>
        </StackPanel>
        <StackPanel Grid.Row="1" Name="editHost"></StackPanel>
    </Grid>
</Window>

MainWindow.xaml.cs:
using System.ComponentModel;
using System.Windows;
 
namespace RulerMemoryLeakDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public class EditorViewModel : INotifyPropertyChanged
        {
            private string _rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 RTF File - Hello World\par
}";
            public string Rtf
            {
                get { return _rtf; }
                set
                {
                    _rtf = value;
                    OnPropertyChanged("Rtf");
                }
            }
 
            public event PropertyChangedEventHandler PropertyChanged;
 
            protected virtual void OnPropertyChanged(string propertyName)
            {
                var handler = PropertyChanged;
                if (handler != null)
                    handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
 
        public MainWindow()
        {
            InitializeComponent();
        }
 
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            editHost.Children.Clear();
            var viewModel = new EditorViewModel();
            var view = new EditorView {DataContext = viewModel};
            editHost.Children.Add(view);           
        }
    }
}

EditorView.xaml:
<UserControl
    x:Class="RulerMemoryLeakDemo.EditorView"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="1000"
    FontFamily="Arial" FontSize="11">   
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>   
        <telerik:DocumentRuler Grid.Row="0" AssociatedRichTextBox="{Binding ElementName=editor, Mode=OneTime}"/>
        <telerik:RadRichTextBox x:Name="editor"     
                                Margin="24 24 0 0"
                                Grid.Row="0"
                                LayoutMode="Flow"/>
        <telerik:RtfDataProvider x:Name="rtfProvider"                                 
                                 RichTextBox="{Binding ElementName=editor}"
                                 Rtf="{Binding Path=Rtf, Mode=TwoWay}"  />
    </Grid>
</UserControl>

EditorView.xaml.cs:
using System.Windows.Controls;
namespace RulerMemoryLeakDemo
{
    public partial class EditorView : UserControl
    {
        public EditorView()
        {
            InitializeComponent();         
        }
    }
}


The demo app has a button "New Editor" which will create a new usercontrol with a RadRichTextBox and associated DocumentRuler and add it to the main window.  If you keep pressing the New Editor button you will see that the memory usage of the application keeps growing.  Repeatedly creating new editors on my desktop caused the application memory usage to grow to over 4GB.

However, in EditorView.xaml, if you comment out the DocumentRuler declaration and repeat the test you will find that the memory usage of the application no longer grows unbound.  On my desktop the memory usage of the application after commenting out this line stayed under 400MB.

My desktop is running Win 7 x64, though this problem was observed on a number of different systems.
Boby
Telerik team
 answered on 16 Apr 2013
1 answer
162 views
HI,

 I was wondering if it was possible to use a combination of properties in GroupDescriptor.

For example:

I have the data set: 
new DummyModel { Name = "Bob", Test = "A", Part = "i", Score = 12},
new DummyModel { Name = "Bob", Test = "A", Part = "ii", Score = 11},
new DummyModel { Name = "Bob", Test = "B", Part = "i", Score = 15},
new DummyModel { Name = "Bob", Test = "B", Part = "ii", Score = 16},
new DummyModel { Name = "Sue", Test = "A", Part = "i", Score = 6},
new DummyModel { Name = "Sue", Test = "A", Part = "ii", Score = 14},
new DummyModel { Name = "Sue", Test = "B", Part = "i", Score = 22},
new DummyModel { Name = "Sue", Test = "B", Part = "ii", Score = 18},

I would like to group by Name and Test and show the sum of the two parts (ordered by Name, then Test).

I recently had this working by adding a property to DummyModel that had both a Name and Test Properties and implemented IComparable and overwrote Equals and GetHashCode which allowed the grouping and sorting as I desired.I used this property as the Member property of the GroupDescriptor.

However this stopped working when we upgraded to v4.0.30319.

Any help on this issue would be greatly appreciated.

Thanks,

Steven
Steven
Top achievements
Rank 1
 answered on 16 Apr 2013
3 answers
153 views
Hello,

I'm using a custom DragVisualProvider with the ListBoxDragDropBehavior and I can't seem to figure out how to offset the mouse position within the dragVisual. I know you can get the RelativeStartPoint from DragVisualProviderState, but how do you set that on the newly created dragVisual (ContentControl, in this case). 

Here is my custom DragVisualProvider code:

public FrameworkElement CreateDragVisual(DragVisualProviderState state)
{
     
    var visual = new ContentControl();
     
    var theme = StyleManager.GetTheme(state.Host);
    if (theme != null)
    {
        StyleManager.SetTheme(visual, theme);
    }
 
    var draggedItem = state.DraggedItemContainers.First() as FrameworkElement;
    visual.Height = draggedItem.ActualHeight;
    visual.Width = draggedItem.ActualWidth;
     
    visual.Content = state.DraggedItems.OfType<object>().FirstOrDefault();
    visual.ContentTemplate = this.DragVisualTemplate;
     
    return visual;
}

Thanks in advance
Vladi
Telerik team
 answered on 16 Apr 2013
3 answers
508 views
Hey there. I have a project with a RadMenu and it's menu Items are defined like so:


        <Style x:Key="MenuItemBaseStyle" TargetType="telerik:RadMenuItem">
            <Setter Property="Header" Value="{Binding Content}" />
            <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
            <Setter Property="ItemsSource" Value="{Binding}" />
        </Style>

        <Style x:Key="MenuItemLinkStyle" TargetType="telerik:RadMenuItem" BasedOn="{StaticResource MenuItemBaseStyle}">
            <Setter Property="Template" Value="{StaticResource MenuItemLinkControlTemplate}" />
            <Setter Property="Margin" Value="4 3 4 2" />
        </Style>

And the Template is defined:

        <ControlTemplate x:Key="MenuItemLinkControlTemplate" TargetType="telerik:RadMenuItem">
            <StackPanel>
                <Button Click="ButtonBase_OnClick" Content="{Binding Content}" Style="{StaticResource LinkButtonMenu}" />
            </StackPanel>
        </ControlTemplate>


I know it looks weird that It's a button, but there's a very specific reason we're doing that due to some issues we had after the last release. It was working fine prior to having to change it and I need it to work with the current Template I have defined for it. I tried setting the StaysOpenOnClick  property to false in the style as well and the issue still persisted. Thanks in advanced for the help.
Rosen Vladimirov
Telerik team
 answered on 16 Apr 2013
1 answer
165 views
Hi,

i want to order my columns in a custom way ("B", "A", "C" for example) Is this possible?

Best Regards,
Thomas
Rosen Vladimirov
Telerik team
 answered on 16 Apr 2013
0 answers
73 views
Hi Experts,

I am doing validation using CurrentCellvalidating event and by using CellEditEnded event i am reloading my Grid's Itemsource. At that time the CurrentCellValidating event gets fired and also the CellEditEnded event gets called once again(both the events are fired 2 times) and after the execution of these events i am getting an null reference exception.

Note: If i didnt reload the Grid ItemSource(Applying new values) then the exception is not occuring.

Please help me anybody, what is going wrong.

Ramesh,
velusamyr@hcl.com
Ramesh
Top achievements
Rank 1
 asked on 16 Apr 2013
3 answers
224 views
Hi Support Team,

I am showing two series data in chartview.I want to show trackball to only one series.
How can i hide the trackball to other(second) series.

Please find attached screenshot for your reference.



Thanks&Regards
Obalesu.N
Todor
Telerik team
 answered on 16 Apr 2013
1 answer
158 views
Hello,

I have a RadGridView where I am autogenerating columns from a datatable. Some columns need a converter on the values, and the conversion logic is different from column to column.

I am using the following code in the autogenerating column event to set the template to an object with a textblock and the right converter.

                var cellStyle = new Style();
                Setter setter = new Setter();
                setter.Property = TemplateProperty;
                var template = new ControlTemplate();
                var index = "[" + ((RadGridView)sender).Columns.Count.ToString() + "]";
                FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(System.Windows.Controls.ListBox));

                var value = new MultiBinding();
                value.Bindings.Add(new Binding(index));
                var columnBinding = new Binding();
                columnBinding.Source = e.Column.Header.ToString();
                value.Bindings.Add(columnBinding);
                value.Converter = (IMultiValueConverter)this.FindResource("TupleCreator");

                spFactory.SetValue(DataContextProperty, value);
                spFactory.SetValue(TemplateProperty, (ControlTemplate)this.FindResource("DataTemplate"));

                template.VisualTree = spFactory;
                setter.Value = template;
                cellStyle.Setters.Add(setter);

                e.Column.CellStyle = cellStyle;

This works fine for actually viewing the cells in the grid, and using visualization so that not all of the conversions are done at once. What I need to be able to do is filter and sort by these values, as well as have them in the cells of export to excel.

I have seen something similar done in another control using an unbound column data event.

Thanks,

Eli
Rossen Hristov
Telerik team
 answered on 16 Apr 2013
8 answers
224 views
Hi,
We are using SparkLine in one column of GridView, we are getting issue that when user scrolls the grid down and move back then extra dots are visible in the grid. Please find the issue in attached image and we have also attached the sample code to regenerate the issue.
we are using 2011.2.712.40 library build.

Image file
sparkline.jpg

Sample code
how can we attach the code?
Thanks
Tsvetie
Telerik team
 answered on 16 Apr 2013
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?