Telerik Forums
UI for WPF Forum
3 answers
134 views
Like the pic,because the part which shows 1 is two small,I hardly click on it,so I choose the spider mode,but I do wanna do something when clicking it,But how can I raise an event when I click the number,not on the part of the pie?
Petar Marchev
Telerik team
 answered on 06 Nov 2013
3 answers
119 views
Hello.

Could you help to resolve my issue. My application is similar VS. I have panes like Project Explorer, Database Explorer etc. All those panes are not in DocumentHost. DocumentHost is empty by default (see code):

<telerikDocking:RadDocking.DocumentHost><br>
            <telerikDocking:RadSplitContainer x:Name="selectedItemBinder"><br>
                <b><telerik:RadPaneGroup DataContext="{Binding Panes}" x:Name="radPaneGroup" SelectedItem="{Binding ElementName=selectedItemBinder, Path=DataContext.SelectedPane, Mode=TwoWay}" local:RadPaneExtension.ItemsSource="{Binding}"/></b><br>
            </telerikDocking:RadSplitContainer><br>
        </telerikDocking:RadDocking.DocumentHost>


So, you can see the content of DocumentHost is binded to property in my viewmodel. When I try to save layout all document panes are included too into xml, but I do not need them. And after, when I try to load back my layout the Documents pane are restoring too with no content (just empty).

How to supress loading DocumentHost when restoring layou?

Thanks in advance!
Vladi
Telerik team
 answered on 06 Nov 2013
1 answer
357 views
Hi everyone,

I have developped a sample application showing an issue I have in a real application.
Here is the markup of the sample application's main window :

<Window x:Class="DockedPaneOverflow.MainWindow"
        xmlns:sample="clr-namespace:DockedPaneOverflow"
        Title="MainWindow" Height="350" Width="525">
    <telerik:RadDocking>
        <telerik:RadSplitContainer InitialPosition="DockedLeft" Width="240">
            <telerik:RadPaneGroup>
                <telerik:RadPane>
                    <sample:UserControl1></sample:UserControl1>
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
         
        <telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>
</Window>

Here is the markup of UserControl1 :

<UserControl x:Class="DockedPaneOverflow.UserControl1"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:sample="clr-namespace:DockedPaneOverflow"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <sample:RadGridViewSampleData x:Key="DataSource"/>
    </UserControl.Resources>
 
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="15px"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
 
        <Canvas Grid.Column="0" Grid.Row="0">
            <Menu>
                <MenuItem Header="Level 1">
                    <MenuItem Header="Level 1.1"/>
                </MenuItem>
            </Menu>
        </Canvas>
 
        <Canvas Grid.Column="0" Grid.Row="1">
            <telerik:RadGridView x:Name="radGridView" Margin="8"
                                ItemsSource="{Binding Source={StaticResource DataSource}, Path=Cars}"
                                Width="600px" Height="394px"/>
        </Canvas>
    </Grid>
</UserControl>

The user control's grid overflows the pane as shown on the attached picture.
Is it a bug ?

I use the 2012.2.912.40 version of Telerik assemblies.

Thank you in advance for your answer.
Vladi
Telerik team
 answered on 06 Nov 2013
6 answers
421 views

Hi,

I am still rather new to WPF in general but trying to come up to speed.  I am using RadTileList in an app.  I am using it for "recent items" in an application.  Those items point to different modules.  These modules are color coded.  So when the tile renders, I want to select a particular background color of the tile, e.g. Employees = green, Crm = blue, etc.

I am using ItemsSource to a view model property

Here is the main radTileList

 <telerik:RadTileList
            CanUserSelect="False"
            x:Name="HomeTileList"
            ItemsSource="{Binding Path=RecentItems}"
            GroupTemplate="{StaticResource GroupTemplate}"
            Margin="5,5,0,0"
            TileReorderMode="None"
            ScrollViewer.HorizontalScrollBarVisibility="Auto">
....

I put in this style
  <Style TargetType="telerik:Tile" >
                <Setter Property="TileType" Value="Single" />
                <Setter Property="Group" Value="{StaticResource tgRecent}" />
                <!--<Setter Property="Background" Value="{Binding ModuleCode, Converter={StaticResource StringToTileBackgroundConverter}}"/>-->
                <Setter Property="Background" Value="{StaticResource ModuleSolicitation}" />
                <Setter Property="Background" Value="Black" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding EntityId}" Value="1">
                        <Setter Property="Background" Value="Red" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>


I have tried a value converter and a dataTrigger.  In the current form, the app picks up the "black" background, but it does not seem to be checking against the EntityId field to render a Red tile.

Note: I eventually want to tied the background color based on the ModuleCode which is an enum.  But I am doing EntityId for testing so that that I can have 1=1 so to speak while I figure this out.

this is "RecentItems" as the collection from the dataContext of the view.

 public ObservableCollection<RecentItemViewModel> RecentItems { get; private set; }

and here is the class

 public class RecentItemViewModel : ViewModelBase
    {
        private int _entityId;
        private string _entityName;
        private Enums.Module _moduleCode;

        public int EntityId
        {
            get { return _entityId; }
            set
            {
                if ((_entityId != value))
                {
                    _entityId = value;
                    RaisePropertyChanged("EntityId");
                }
            }
        }

        public string EntityName
        {
            get { return _entityName; }
            set
            {
                if ((_entityName != value))
                {
                    _entityName = value;
                    RaisePropertyChanged("EntityName");
                }
            }
        }

        public Enums.Module ModuleCode
        {
            get { return _moduleCode; }
            set
            {
                if ((_moduleCode != value))
                {
                    _moduleCode = value;
                    RaisePropertyChanged("ModuleCode");
                }
            }
        }
    }


any ideas?

Maya
Telerik team
 answered on 06 Nov 2013
4 answers
93 views
The RotatorExtensions.cs sample, do not work when used with more than one TransitionControl.
(Probably because of "private static DependencyObject element;" ???)

namespace Examples.TransitionControl.Common
{
    public static class RotatorExtensions
    {
        public static readonly DependencyProperty ItemsSourceProperty =
            DependencyProperty.RegisterAttached("ItemsSource", typeof(IEnumerable), typeof(RotatorExtensions), new PropertyMetadata(null,  OnItemsSourceChanged));
 
        public static readonly DependencyProperty ItemChangeDelayProperty =
            DependencyProperty.RegisterAttached("ItemChangeDelay", typeof(Duration), typeof(RotatorExtensions), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(0.3))));
 
        public static readonly DependencyProperty CurrentSelectedIndexProperty =
            DependencyProperty.RegisterAttached("CurrentSelectedIndex", typeof(int), typeof(RotatorExtensions), new PropertyMetadata(-1, OnCurrentSelectedIndexChanged));
 
        private static readonly DependencyProperty TimerProperty =
            DependencyProperty.RegisterAttached("Timer", typeof(DispatcherTimer), typeof(RotatorExtensions), null);
 
        public static IEnumerable GetItemsSource(DependencyObject obj)
        {
            return (IEnumerable)obj.GetValue(ItemsSourceProperty);
        }
 
        public static void SetItemsSource(DependencyObject obj, IEnumerable value)
        {
            obj.SetValue(ItemsSourceProperty, value);
        }
 
        public static Duration GetItemChangeDelay(DependencyObject obj)
        {
            return (Duration)obj.GetValue(ItemChangeDelayProperty);
        }
 
        public static void SetItemChangeDelay(DependencyObject obj, Duration value)
        {
            obj.SetValue(ItemChangeDelayProperty, value);
        }
 
        public static int GetCurrentSelectedIndex(DependencyObject obj)
        {
            return (int)obj.GetValue(CurrentSelectedIndexProperty);
        }
 
        public static void SetCurrentSelectedIndex(DependencyObject obj, int value)
        {
            obj.SetValue(CurrentSelectedIndexProperty, value);
        }
 
        private static DispatcherTimer GetTimer(DependencyObject obj)
        {
            return (DispatcherTimer)obj.GetValue(TimerProperty);
        }
 
        private static void SetTimer(DependencyObject obj, DispatcherTimer value)
        {
            obj.SetValue(TimerProperty, value);
        }
 
        private static void OnCurrentSelectedIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UpdateCurrentlySelectedItem(d);
        }
 
        private static void MoveToNextElement(DependencyObject element)
        {
            IEnumerable source = GetItemsSource(element);
            if (source != null)
            {
                IEnumerable<object> convertedSource = source.Cast<object>();
                int currentIndex = GetCurrentSelectedIndex(element);
 
                currentIndex = ++currentIndex % convertedSource.Count();
                SetCurrentSelectedIndex(element, currentIndex);
            }
        }
 
        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement element = d as FrameworkElement;
            ItemsControl itemsControl = d as ItemsControl;
 
            IEnumerable oldValue = e.OldValue as IEnumerable;
            IEnumerable newValue = e.NewValue as IEnumerable;
 
            if (element != null)
            {
                if (oldValue != null)
                {
                    // Detach the Ad Rotator functionality.
                    element.Loaded -= OnElementLoaded;
                    element.Unloaded -= OnElementUnloaded;
 
                    // If there is a timer attached, stop it.
                    DispatcherTimer timer = GetTimer(element);
                    if (timer != null)
                    {
                        timer.Stop();
                    }
                }
 
                if (newValue != null)
                {
                    // Attach the Ad Rotator functionality.
                    element.Loaded += OnElementLoaded;
                    element.Unloaded += OnElementUnloaded;
 
                    // If the target is an ItemsControl and its ItemsSource is not set, set it.
                    if (itemsControl != null && itemsControl.ItemsSource == null && itemsControl.Items.Count == 0)
                    {
                        itemsControl.ItemsSource = newValue;
                    }
                }
            }
        }
 
        private static DependencyObject element;
 
        private static void OnElementLoaded(object sender, RoutedEventArgs args)
        {
             element = sender as DependencyObject;
 
            // Create the timer and hook-up to the events.
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = GetItemChangeDelay(element).TimeSpan;
            SetTimer(element, timer);
 
            timer.Tick += new EventHandler(timer_Tick);        
 
            timer.Start();
 
            // Make sure the currently pointed element is selected.
            UpdateCurrentlySelectedItem(element);
        }
 
        static void timer_Tick(object sender, EventArgs e)
        {
            MoveToNextElement(element);
        }
 
        private static void OnElementUnloaded(object sender, RoutedEventArgs args)
        {
            FrameworkElement element = sender as FrameworkElement;
            if (element != null)
            {
                DispatcherTimer timer = GetTimer(element);
                if (timer != null)
                {
                    timer.Stop();
                }
            }
        }
 
        private static void UpdateCurrentlySelectedItem(DependencyObject element)
        {
            ContentControl contentControl = element as ContentControl;
 
            IEnumerable source = GetItemsSource(element);
 
            // If there is no source we shouldn't do anything.
            if (source == null) return;
 
            // Find the actual index to be selected (if outside the boundaries of the collection)
            // and find the actual element to be selected.
            IEnumerable<object> convertedSource = source.Cast<object>();
            int currentIndex = GetCurrentSelectedIndex(element);
            object elementToSelect = convertedSource.ElementAtOrDefault(currentIndex);
 
            // Update the cotnent of the ContentControl if attached to a ContentControl.
            if (contentControl != null)
            {
                contentControl.Content = elementToSelect;
            }
        }
    }
}

 

Konstantina
Telerik team
 answered on 05 Nov 2013
1 answer
90 views
Hi,
I'm new to the diagram control and I've reached the point where I need assistance.

The application that I'm working on is intensively used over remote connection - the users are seldom on site (plants located all over the world) and most of the time they need to configure certain parameters of the application remotely.

Seen as a whole - the window contains a huge tab control for different settings and one of the tabs contains a diagram.
The application behaves all right even through the remote connection until the user switches to the tab with the RadDiagram - when the app becomes unresponsive - or at least sluggish - regardless of how many items that diagram contains.

Beside all the Remote Desktop Protocol Settings that we can change, what other options do I have to improve the responsiveness of my app in this situation?

Roxana
Pavel R. Pavlov
Telerik team
 answered on 05 Nov 2013
1 answer
99 views
I am having an issue with grouping, if I group by a column that contains a null value all is fine in this case the middle names have  a lot of nulls, but if I group by another column afterwards I get a crash, InvalidOpertationException Collection was modified; enumeration operation may not execute.  I am using entity framework bound directly to the grid.  Simple code below attached to an older version of adventure works, but anything with a column with nulls in it should work.  Just xaml.  Curious how to fix this or am I doing something completely wrong somewhere else?

<Window x:Class="GridGroupingTest.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:entites="clr-namespace:GridGroupingTest"
                xmlns:system="clr-namespace:System;assembly=mscorlib"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <telerik:RadEntityFrameworkDataSource Name="AIMEntityFrameworkDataSource" QueryName="DimCustomers">
            <telerik:RadEntityFrameworkDataSource.ObjectContext>
                <entites:AdventureWorksDW2008R2Entities1/>
            </telerik:RadEntityFrameworkDataSource.ObjectContext>
        </telerik:RadEntityFrameworkDataSource>
 
        <Border Grid.Column="0" BorderBrush="Black" BorderThickness="2" Margin="2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
 
                <Label Content="Columns Shown:" Grid.Row="0" Grid.Column="0"/>
                <StackPanel  Background="White" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" >
                    <ListBox ItemsSource="{Binding Columns, ElementName=RadGridView1}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <CheckBox Content="{Binding Header}" IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
 
                <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
                    <Label Content="Filters"/>
                    <telerik:RadComboBox Margin="2" Width="150" DisplayMemberPath="name" ItemsSource="{Binding Filters}"
                            SelectedItem="{Binding SelectedFilter, Mode=TwoWay}"/>
                    <Button Command="{Binding LoadFilterCommand}" Content="Load"/>
                    <Button Command="{Binding DeleteFilterCommand}" Content="Delete"/>
                    <Label Content="Save Filter Name:"/>
                    <TextBox x:Name="SaveNameTextbox" Text="{Binding SaveNameText, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150"/>
                    <Button Command="{Binding SaveFilterCommand}" Content="Save"/>
                    <Button  Content="Default"/>
                    <Button  Content="Clear All"/>
                </StackPanel>
 
                <telerik:RadGridView x:Name="RadGridView1" Grid.Row="1" Grid.Column="1"
                             ItemsSource="{Binding DataView, ElementName=AIMEntityFrameworkDataSource}"
                             Margin="0" GroupRenderMode="Flat"
                             SelectedItem="{Binding SelectedIndex}"
                             DataLoadMode="Asynchronous"
                             RowIndicatorVisibility="Collapsed"
                             IsReadOnly="True"
                             ShowColumnSortIndexes="True"
                             AutoGenerateColumns="False"
                             CanUserFreezeColumns="True"
                             CanUserResizeColumns="True"
                             ValidatesOnDataErrors="None" >
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="First" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding FirstName}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Middle" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding MiddleName}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Last" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding LastName}" DataType="system:String" />
 
                        <telerik:GridViewDataColumn Header="Email" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding EmailAddress}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Education" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding EnglishEducation}" DataType="system:String" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
                <telerik:RadDataPager x:Name="radDataPager" Grid.Row="2" Grid.Column="1"
                          Source="{Binding Items, ElementName=RadGridView1}"
                          PageSize="30"/>
            </Grid>
        </Border>
    </Grid>
</Window>

Nick
Telerik team
 answered on 05 Nov 2013
1 answer
60 views
Hi,

I'm using Telerik V2012.2.912.35 and I would like to know if it's possible with the radscheduleview control to have 2 kinds of readonly slot??? I would lik to have passed slots into a color and the future slots into another color?

Thank's
Kalin
Telerik team
 answered on 05 Nov 2013
2 answers
128 views
Hello, in a RadTileList control I need to save each autogenerated tile's Display Index so I wanted to know if it is possibile to get the autogenerated tiles in a RadTileList control.
Thanks a lot.
Federico
Top achievements
Rank 1
 answered on 05 Nov 2013
3 answers
262 views
Dear Support,

I have defined some styles for the RadGridView in my global resource dictionary. why it does not automatically applied to controls, why i must set it explicitly? for example i have defined style for column headers but i must specify it as HeaderCellStyle for every column. 
Is there any way to define style in resources and applied it automatically  without specifying it?

Thanks
Pallavi.
Vanya Pavlova
Telerik team
 answered on 05 Nov 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?