Telerik Forums
UI for WPF Forum
2 answers
184 views
How can I show an image in the RadRadialMenuItem from code?
TRW
Top achievements
Rank 1
 answered on 23 Jul 2015
15 answers
440 views

Hi,

I've been trying the examples with Pivot Grid but any of them seems to work.
I don't get any error message but the control doesn't show. 
Does it need any prerequisites?

<Window x:Class="RadPivotGrid_GettingStarted.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:local="clr-namespace:WpfApplication1.RadPivotGrid_GettingStarted"
                xmlns:pivot="http://schemas.telerik.com/2008/xaml/presentation/pivot"
                Title="MainWindow" Height="350" Width="525" >
     
     
    <Window.Resources>
        <pivot:LocalDataSourceProvider x:Key="LocalDataProvider" AggregatesPosition="Rows">
            <pivot:LocalDataSourceProvider.RowGroupDescriptions>
                <pivot:PropertyGroupDescription PropertyName="Name" />
            </pivot:LocalDataSourceProvider.RowGroupDescriptions>
            <pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
                <pivot:DateTimeGroupDescription PropertyName="Date" Step="Month" />
            </pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
            <pivot:LocalDataSourceProvider.AggregateDescriptions>
                <pivot:PropertyAggregateDescription PropertyName="Price" StringFormat="C" AggregateFunction="Average" />
                <pivot:PropertyAggregateDescription PropertyName="Quantity"/>
            </pivot:LocalDataSourceProvider.AggregateDescriptions>
        </pivot:LocalDataSourceProvider>
    </Window.Resources>
 
    <Grid>
        <pivot:RadPivotGrid Name="radPivotGrid1" DataProvider="{StaticResource LocalDataProvider}" >
        </pivot:RadPivotGrid>
    </Grid>
</Window>


Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports Telerik.Pivot.Core
 
 
Namespace RadPivotGrid_GettingStarted
 
Public Class Product
        Public Property Name() As String
            Get
                Return m_Name
            End Get
            Set(ByVal value As String)
                m_Name = value
            End Set
        End Property
        Private m_Name As String
        Public Property Quantity() As Integer
            Get
                Return m_Quantity
            End Get
            Set(ByVal value As Integer)
                m_Quantity = value
            End Set
        End Property
        Private m_Quantity As Integer
        Public Property Price() As Double
            Get
                Return m_Price
            End Get
            Set(ByVal value As Double)
                m_Price = value
            End Set
        End Property
        Private m_Price As Double
        Public Property [Date]() As DateTime
            Get
                Return m_Date
            End Get
            Set(ByVal value As DateTime)
                m_Date = value
            End Set
        End Property
        Private m_Date As DateTime
    End Class
 
    Partial Public Class MainWindow
        Public Sub New()
            InitializeComponent()
            Try
                TryCast(Me.Resources("LocalDataProvider"), LocalDataSourceProvider).ItemsSource = GeneratePivotData()
            Catch ex As Exception
 
            End Try
 
        End Sub
 
        Private Shared Function GeneratePivotData() As IList(Of Product)
            Dim PivotData As IList(Of Product) = New List(Of Product)() From { _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 1, 1, 0, 0, 0), _
         .Price = 10.4, _
         .Quantity = 148 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 2, 1, 0, 0, 0), _
         .Price = 10.99, _
         .Quantity = 122 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 3, 1, 0, 0, 0), _
         .Price = 11.24, _
         .Quantity = 80 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 4, 1, 0, 0, 0), _
         .Price = 11.24, _
         .Quantity = 90 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 5, 1, 0, 0, 0), _
         .Price = 11.14, _
         .Quantity = 140 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 6, 1, 0, 0, 0), _
         .Price = 10.89, _
         .Quantity = 162 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 7, 1, 0, 0, 0), _
         .Price = 10.89, _
         .Quantity = 181 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 8, 1, 0, 0, 0), _
         .Price = 10.88, _
         .Quantity = 180 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 9, 1, 0, 0, 0), _
         .Price = 11.0, _
         .Quantity = 116 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 10, 1, 0, 0, 0), _
         .Price = 10.99, _
         .Quantity = 128 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 11, 1, 0, 0, 0), _
         .Price = 10.95, _
         .Quantity = 145 _
        }, _
        New Product() With { _
         .Name = "Pen", _
         .[Date] = New DateTime(2012, 12, 1, 0, 0, 0), _
         .Price = 10.45, _
         .Quantity = 189 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 1, 1, 0, 0, 0), _
         .Price = 5.22, _
         .Quantity = 100 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 2, 1, 0, 0, 0), _
         .Price = 5.99, _
         .Quantity = 85 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 3, 1, 0, 0, 0), _
         .Price = 6.04, _
         .Quantity = 80 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 4, 1, 0, 0, 0), _
         .Price = 6.28, _
         .Quantity = 72 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 5, 1, 0, 0, 0), _
         .Price = 6.12, _
         .Quantity = 99 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 6, 1, 0, 0, 0), _
         .Price = 6.59, _
         .Quantity = 40 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 7, 1, 0, 0, 0), _
         .Price = 6.29, _
         .Quantity = 68 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 8, 1, 0, 0, 0), _
         .Price = 5.99, _
         .Quantity = 95 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 9, 1, 0, 0, 0), _
         .Price = 5.89, _
         .Quantity = 120 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 10, 1, 0, 0, 0), _
         .Price = 5.99, _
         .Quantity = 105 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 11, 1, 0, 0, 0), _
         .Price = 5.96, _
         .Quantity = 111 _
        }, _
        New Product() With { _
         .Name = "Pencil", _
         .[Date] = New DateTime(2012, 12, 1, 0, 0, 0), _
         .Price = 5.99, _
         .Quantity = 108 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 1, 1, 0, 0, 0), _
         .Price = 22.86, _
         .Quantity = 88 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 2, 1, 0, 0, 0), _
         .Price = 23.02, _
         .Quantity = 95 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 3, 1, 0, 0, 0), _
         .Price = 23.22, _
         .Quantity = 102 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 4, 1, 0, 0, 0), _
         .Price = 21.99, _
         .Quantity = 95 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 5, 1, 0, 0, 0), _
         .Price = 22.45, _
         .Quantity = 84 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 6, 1, 0, 0, 0), _
         .Price = 22.56, _
         .Quantity = 96 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 7, 1, 0, 0, 0), _
         .Price = 22.88, _
         .Quantity = 88 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 8, 1, 0, 0, 0), _
         .Price = 22.42, _
         .Quantity = 99 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 9, 1, 0, 0, 0), _
         .Price = 22.56, _
         .Quantity = 111 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 10, 1, 0, 0, 0), _
         .Price = 22.18, _
         .Quantity = 102 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 11, 1, 0, 0, 0), _
         .Price = 22.93, _
         .Quantity = 105 _
        }, _
        New Product() With { _
         .Name = "Notebook", _
         .[Date] = New DateTime(2012, 12, 1, 0, 0, 0), _
         .Price = 22.89, _
         .Quantity = 122 _
        } _
       }
 
            Return PivotData
        End Function
    End Class
 
 
End Namespace

Cecilia
Top achievements
Rank 1
 answered on 23 Jul 2015
1 answer
625 views

Hi,

I Use radgridview with virtualization (not paging) to show data.

I want to put a busy indicator on my rad grid view that will not freeze the whole grid when loading , as the facebook / gmail apps.

 When i Use radbusyindicator as the parent of the grid or use the is busy property , the grid freeze while loading.

Thank you

 

 

Nasko
Telerik team
 answered on 23 Jul 2015
7 answers
285 views

Hi,

following the demo I've created an attached property to my RadGridView that adds a column that displays the number of the row.

Everything works fine, but if my grid has a group descriptor defined in xaml or loaded from the custom settings saved by the user, then the numbers appear not sorted.

It seems like the numeration happens before the grouping, but I don't know how to fix it.

Here's my code:

public class RowNumeratorBehavior
    {
        public static bool GetRowNumerator(RadGridView grid)
        {
            return (bool)grid.GetValue(RowNumeratorProperty);
        }

        public static void SetRowNumerator(RadGridView grid, bool value)
        {
            grid.SetValue(RowNumeratorProperty, value);
        }

        public static readonly DependencyProperty RowNumeratorProperty =
            DependencyProperty.RegisterAttached("RowNumerator", typeof(bool), typeof(RowNumeratorBehavior), new UIPropertyMetadata(OnAutoSelectedChanged));

        static void OnAutoSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RadGridView source = (sender as RadGridView);
            if (source == null) return;
            if ((bool)e.NewValue)
            {
                source.DataContextChanged += source_DataContextChanged;
                Telerik.Windows.Persistence.Services.ServiceProvider.RegisterPersistenceProvider<Telerik.Windows.Persistence.Services.ICustomPropertyProvider>(typeof(RadGridView), new GridViewCustomPropertyProvider());
            }
            else
            {
                source.DataContextChanged -= source_DataContextChanged;
            }
        }

        private static void source_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            RadGridView source = (sender as RadGridView);

            var numerator = new RowNumberColumn();
            numerator.Header = "";
            numerator.Name = "Numerator";
            numerator.UniqueName = "Numerator";
            numerator.IsReorderable = false;
            numerator.Background = System.Windows.Media.Brushes.White;
            source.Columns.Insert(0,numerator);
        }
    }

 

 public class RowNumberColumn : Telerik.Windows.Controls.GridViewDataColumn
    {        
        public override System.Windows.FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            TextBlock textBlock = cell.Content as TextBlock;

            if (textBlock == null)
            {
                textBlock = new TextBlock();
            }

            textBlock.Text = ((this.DataControl.ItemsSource as IList).IndexOf(dataItem) + 1).ToString();

            return textBlock;
        }

        protected override void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args)
        {
            base.OnPropertyChanged(args);

            if (args.PropertyName == "DataControl")
            {
                if (this.DataControl != null && this.DataControl.Items != null)
                {
                    this.DataControl.Items.CollectionChanged += (s, e) =>
                    {
                        if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
                        {
                            this.Refresh();
                        }
                    };
                }
            }
        }
    } 

 

Thanks in advance,

Matteo

Dimitrina
Telerik team
 answered on 23 Jul 2015
1 answer
167 views

We are using implicit styles like this:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.xaml"/>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/System.Windows.xaml"/>
    ...
    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
    ...
    ...
</ResourceDictionary.MergedDictionaries>
  

Now we want just one control (GridView) to be displayed with another theme (Windows8). What is the most efficient and easiest way to display all GridViews in our application (and there are a lot of them) with the design of the Windows8-theme?

TIA
Neils

Masha
Telerik team
 answered on 23 Jul 2015
18 answers
669 views
Hi,
I'm currently using Telerik RadDocking to create an application which uses Prism, and MEF.
I'm using the region adapter recommended for adapting RadPanes to "regions".
I have two panes that are correctly added to the "bottom" region:
1)  First pane (Console) has a TextBox which is bound to a string property, StringContent, in the data context.
2)  Second pane (Errors List) has a DataGrid which is bound to an IEnumerable property, Errors, in the data context.
The panes have their data context set using MEF Import statements, in the XAML code behind:
[Import]
[SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly", Justification = "Needs to be a property to be composed by MEF")]
SampleViewModel ViewModel
{
    set
    {
        this.DataContext = value;
    }
}

When I first launch the application, the Console pane is selected in the bottom region, and the StringContent is correctly displayed in the TextBox.  When I select the Errors List pane (clicking the tab), the datagrid is properly filled.

However, when I go BACK to the Console pane, it is no longer updating/showing the StringContent value in the TextBox.  Similarly, if I navigate BACK to the Errors List pane, it is no longer showing the Errors contents.  Using Snoop, I was able to find the following error:
System.Windows.Data Error: 40 : BindingExpression path error: 'StringContent' property not found on 'object' ''ErrorListViewModel' (HashCode=14361357)'. BindingExpression:Path=StringContent; DataItem='ErrorListViewModel' (HashCode=14361357); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')

You can see here, that it appears that the data context of the panes are somehow getting switched during tab navigation.  Obviously this bug breaks both panes, as they are no longer capable of displaying the correct data to the end user.
What do you recommend for resolving this?

Thanks.
Dietmar
Top achievements
Rank 1
 answered on 23 Jul 2015
1 answer
73 views

 hi

i have problem with clippanel

i want to use one color for part 1 and 2 in photo

i want my background chart is one color

my code use two way but nothing help me

01.<Style x:Key="ClipPanelStyle"
02.TargetType="telerik:ClipPanel">
03.     <Setter Property="Background">
04.         <Setter.Value>
05.             <SolidColorBrush Color="#096bb3"></SolidColorBrush>
06.             <!--<LinearGradientBrush EndPoint="1,0"
07.                          StartPoint="0,1"
08.                          SpreadMethod="Pad">
09.                 <GradientStop Color="Black"
10.                       Offset="0" />
11.                 <GradientStop Color="#FF00B4FF"
12.                       Offset="1" />
13.             </LinearGradientBrush>-->
14.         </Setter.Value>
15.     </Setter>
16. </Style>

i want part 1 and 2 be one color not be two color 

 

 

Petar Marchev
Telerik team
 answered on 23 Jul 2015
2 answers
120 views

Hi,
I have a combobox that has the ItemsSource bound to an observablecollection of Priority objects. Priority objects have and ID and a Description.
My combobox is in a DataTemplate for a listBoxItem that is bound to another collection of objects. Filter objects, which have a FilterPriorityID property
I set the combobox.DisplayMemberPath="Description" which seems fine.
I set the SelectedValuePath="{Binding FilterPriorityID}" expecting the combobox to auto select the correct Priority using the FilterPriorityID. but this is not the case.
Seems i am missing something, coming from Winforms.
Gary

<telerik:RadComboBox ItemsSource="{Binding Path=DataContext.EventFilterPriorites, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                     SelectedValuePath="{Binding Path=EventFilterPriorityID}"
                                     DisplayMemberPath="Description"
                                     VerticalAlignment="Top"
                                     HorizontalAlignment="Left"
                                     Height="25"
                                     Margin="3"
                                     Width="100"/>

Kalin
Telerik team
 answered on 23 Jul 2015
3 answers
140 views

I am using RadTab Control and one of the tab item host a Rad Schedule view, I have a event handler for calendar loaded event.

I want the event to be called only for the first time the tab is loaded, for that i have set IscontentPreserved = true for the tab control, but still the loaded event gets called every time.

Vikas

 

Martin Ivanov
Telerik team
 answered on 23 Jul 2015
3 answers
133 views

Hi,

 

in my usercontrol I'm trying to use a RadImageEditorUI and when I try to compile I have the following message:

Error 7 The type or namespace name 'Windows' does not exist in the namespace 'ChristieInnoMed.Framework.UI.Telerik' (are you missing an assembly reference?) D:\Developpement\TFS\ChristieInnoMed.Framework\ChristieInnoMed.Framework.UI.ChristieControls\Controls\SketchDrawer.xaml 13 26 ChristieInnoMed.Framework.UI.ChristieControls

 If I comment the "<telerik:RadImageEditorUI x:Name="ImageEditorUI" />" line, the compile was ok...

 

Thank's

Alain


Todor
Telerik team
 answered on 23 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?