Telerik Forums
UI for WPF Forum
1 answer
78 views
Hi ,

I added a Dynamic Rad pane in the Rad docking control like this

RadPane radPane = new RadPane() { Title = "title", Header = "header" };
RadPaneGroup radPaneGroup = new RadPaneGroup();
RadSplitContainer radSplitContainer = new RadSplitContainer() { InitialPosition = DockState.DockedLeft
radPaneGroup.Items.Add(radPaneGroup);
radSplitContainer.Items.Add(radPaneGroup);
dock.Items.Add(radSplitContainer);

How do I add a Drag drop event to this radpane ?
Guna
Top achievements
Rank 1
 answered on 02 Apr 2014
1 answer
382 views
<UserControl.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="RadTreeViewItemControlTemplate1" TargetType="{x:Type telerik:RadTreeViewItem}">
<Grid x:Name="RootElement">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid x:Name="HeaderRow" Background="Transparent" MinHeight="{TemplateBinding MinHeight}" SnapsToDevicePixels="True">
<Border x:Name="SelectionUnfocusedVisual" BorderBrush="#FFDBDBDB" BorderThickness="1" Grid.ColumnSpan="6" Grid.Column="2" CornerRadius="1" Visibility="Collapsed">
<Border BorderBrush="Transparent" BorderThickness="1" CornerRadius="0">
<Border.Background>
<LinearGradientBrush EndPoint="0,1">
<GradientStop Color="#FFF8F6F9" Offset="0"/>
<GradientStop Color="#FFF0F0F0" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</Border>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="IsSelectionActive" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Visibility" TargetName="SelectionUnfocusedVisual" Value="Visible"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
</UserControl.Resources>


<DockPanel>
<telerik:RadDocking x:Name="radDocking" Width="245" ConstraintAutoHideArea="False">
<telerik:RadSplitContainer x:Name="radSplitContainer">
<telerik:RadPaneGroup x:Name="radGroup">
<telerik:RadPane x:Name="radPane1" Header="Test" ContextMenuTemplate="{x:Null}" CanUserClose="False" CanFloat="False" Cursor="Hand">
<Grid>
<DockPanel LastChildFill="True">
<telerik:RadTreeView x:Name="radTreeView" DockPanel.Dock="Left" Background="#FF525152" VirtualizingPanel.IsVirtualizing="True">
<telerik:RadTreeView.Resources>
<Style TargetType="{x:Type telerik:RadTreeViewItem}">
<Setter Property="Template" Value="{StaticResource RadTreeViewItemControlTemplate1}" />
</Style>
</telerik:RadTreeView.Resources>
</telerik:RadTreeView>
</DockPanel>
</Grid>
</telerik:RadPane>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking>
</DockPanel>
After using the Radpane, the selected item is not having the style applied. If RadTreeView alone is used (without having radpane), the selected item in the radtreeview is having the style SelectionUnfocusedVisual which is working properly (i.e), Selected Item gets Highlighted. How to make the selected item in the radtreeview to have a style applied (or) to highlight the radtreeview selected item when a radpane is used?. Thanks.
Evgenia
Telerik team
 answered on 01 Apr 2014
3 answers
196 views
Hello,

I was reading this help: http://www.telerik.com/help/wpf/radtimeline-howto-expand-collapse-groups.html, I am looking a way to expand and collapse groups programatically.
In my demo project I have several groups and I would like that when I expand a group the other groups must be collapsed, is there an event when a group is expanded so I can collapse the other groups?

If possible could you provide a sample project?

Thanks in advance,

Alberto
Boris
Telerik team
 answered on 01 Apr 2014
11 answers
94 views
I'm using RadDataFilter in Bound mode.
I have a bunch of objects in the Source list that I'd like to filter that are of different types. They're all derived from a base class. The dropdown in the filter only shows the properties in the base class. Is there a way to make the dropdown show all properties that have a [Display] attribute on them, even though they are in different derived classes?

For example, if I derive class Manager from your Employee class and add a new property bool HasCar to Manager with the [Display] attribute, I'd like that property to also be available for filtering. Any non-employees (objects that don't have that property) should be ignored (i.e. always culled out). Is this possible? Or do I need to go to Unbound mode and write all the filtering code myself?

- Lutz
Dimitrina
Telerik team
 answered on 01 Apr 2014
5 answers
131 views
Hello all,

I've encountered an undefined behaviour of CollectioEditor with 2014 Q1 and previous.
My data have 2 levels of nesting: Client -> List<Contracts> -> List<Option>.
Also I use custom template for CollectionEditor to set some properties of RadPropertyGrid for editing List<Option> (dimensions + visibilty).

How to reproduce the problem:
1. Use CollectionEditor for "Contracts" and add new Contract twice.
2. Select second Contract.
3. Use CollectionEditor for "Options" and add new Option.
4. Select first Contract
5. Select second Contract
6. Open CollectionEditor for "Options" ... ooops.. no option presents!

Problem occur even if I use original template from assembly.

The test project can be found here.

Best regards,
Zber

Yordanka
Telerik team
 answered on 01 Apr 2014
1 answer
89 views
Hello,

I am pretty new to WPF and Telerik and have a question about data binding.

My business object is a COM object as root of a tree of further COM objects (parent-child hierarchy (any depth)).

How would I bind ideally this data structure to a TreeListView control without duplicating any data with best performance? The columns of the TreeListView control need to be created at runtime based on some XML customization file. Each column displays a particular attribute of the COM object.

My current solution uses a binding via a value converter where I retrieve the correct data (parameter passed to the value converter) from my COM object. It works OK, but has many drawbacks: No out-of-the-box support for sorting, filtering, ... performance could be better ...

Any help on the best way to implement a binding with good performance without duplicating data is very much appreciated.

Thanks,
Markus
Dimitrina
Telerik team
 answered on 01 Apr 2014
4 answers
280 views
I'm trying to create a control with the same colors of RadGridView.
I tried to use the GridView_HeaderBackground as background, and GridView_GridLinesItemBorder as borderbrush. But when i changed my theme to Windows8, the Resource will not be found. Is there global definition for all themes? I really need that, in order to change my control with different themes automatically.
My code is like that:
<Border Background="{DynamicResource GridView_HeaderBackground}"
   BorderThickness="1"
   BorderBrush="{DynamicResource GridView_GridLinesItemBorder}">

Thanks a lot.
Yoan
Telerik team
 answered on 01 Apr 2014
3 answers
194 views
Hello everyone,

We were having issues with the 'ScrollItemIntoViewAsync' method.
When virtualization is turned on, none of the proposed solutions found on the internet worked (or not atleast a 100%).

E.g. when I'd randomly select an item from my entire collection (hierarchy depth could easily go down 30 levels or more) it wouldn't always correctly scroll to that row.

However, we managed to come up with a pretty straight forward solution which could be implemented by pretty much anyone. (And hopefully, internally by Telerik inside the grid controls as well)

The idea is that the root items in a hierarchical grid are always present, and we found that ScrollIntoViewAsync always worked when trying to scroll to root items.
So we'd first scroll to the root item, then to the next item inside the root item's collection and so on and so on untill we reached the actual item we were supposed to scroll to.

Prerequistes:

1.) The row item's view model must implement a specific interface (we called it IScrollableGridItem) that contains a "GetScrollList()" function which returns a list of objects that contains all the parents of that item and itself, in reversed order (eg the root item will be the first in the list and the actual item is the last)
2.) The row item's view model must have a reference to its parent item (to basically make the "GetScrollList()" work)
3.) Row height should be set on the grid (it doesn't seem to always work with no specified row height)

We made a custom behavior that allowed us to have a SelectedItem at any given time, regardless of the grid SelectionMode & SelectionUnit.


Inside this behavior, when the SelectedItem was being set via the ViewModel we added the following code:

001.private object actualScrollToItem = null;
002.private object currentScrollToItem = null;
003.private List<object> scrollItems = null;
004.private int scrollToItemAttemptCount = 0;
005. 
006.private void SelectedItemTargetUpdated(object sender, DataTransferEventArgs e)
007.{
008.    var item = GetValue(e.Property);
009. 
010.    /* SNIP IRRELEVANT CODE TO SCROLLING */
011.     
012.    actualScrollToItem = item;
013. 
014.    if (actualScrollToItem is IScrollableGridItem)
015.    {
016.        Console.WriteLine("-- BEGIN SCROLLING TO {0} --", actualScrollToItem.GetHashCode());
017. 
018.        var tmp = item as IScrollableGridItem;
019. 
020.        // Get a list of items to scroll to
021.        scrollItems = tmp.GetScrollList();
022. 
023.        // Start scrolling to the first item
024.        currentScrollToItem = scrollItems.First();
025. 
026.        GridControl.ScrollIntoViewAsync(currentScrollToItem, Scroll, ScrollFailed);
027. 
028.    }
029.    else
030.    {
031.        // Attempt is not IScrollable, attempt to scroll anyway
032.        currentScrollToItem = actualScrollToItem;
033.        Console.WriteLine("Item is not IScrollable");
034.        GridControl.ScrollIntoViewAsync(actualScrollToItem, Scroll, ScrollFailed);
035.    }
036.}
037. 
038.private void Scroll(FrameworkElement arg)
039.{
040.    Console.WriteLine("Succesfully scrolled to {0}", currentScrollToItem.GetHashCode());
041. 
042.    scrollToItemAttemptCount = 0;
043. 
044.    var row = arg as GridViewRow;
045. 
046.    if (actualScrollToItem == currentScrollToItem)
047.    {
048.        Console.WriteLine("Reached actual scroll item");
049.        Console.WriteLine("-- END SCROLLING TO {0} --", actualScrollToItem.GetHashCode());
050.        GridControl.ClearSelection();
051.        GridControl.SelectedItems.Add(currentScrollToItem);
052. 
053.        actualScrollToItem = null;
054.        currentScrollToItem = null;
055.        scrollItems = null;
056. 
057.        if (row != null)
058.        {
059.            row.IsCurrent = true;
060.            row.Focus();
061.            row.BringIntoView();
062.        }
063.    }
064.    else
065.    {
066.        if (row != null && row.IsExpandable)
067.        {
068.            row.IsExpanded = true;
069.        }
070. 
071.        var idx = scrollItems.IndexOf(currentScrollToItem);
072.        currentScrollToItem = scrollItems[idx + 1];
073. 
074.        GridControl.ScrollIntoViewAsync(currentScrollToItem, Scroll, ScrollFailed);
075.    }
076.     
077.}
078. 
079.private void ScrollFailed()
080.{
081.    scrollToItemAttemptCount++;
082. 
083.    Console.WriteLine("Failed to scroll to {0}. Already tried {1} times", currentScrollToItem.GetHashCode(), scrollToItemAttemptCount);
084. 
085.    if (currentScrollToItem == null)
086.    {
087.        Console.WriteLine("Stopped attempting to scroll because currentScrollToItem is NULL");
088.        scrollToItemAttemptCount = 0;
089.        return;
090.    }
091. 
092.    if (scrollToItemAttemptCount < 5)
093.    {
094.        GridControl.ScrollIntoViewAsync(currentScrollToItem, Scroll, ScrollFailed);
095.    }
096.    else
097.    {
098.        currentScrollToItem = null;
099.        actualScrollToItem = null;
100.        scrollToItemAttemptCount = 0;
101.    }
102.     
103.}

And for the sake of completeness, here's the code for the "GetParents()" implementation:

01.public List<object> GetParents()
02.{
03.    List<object> result = new List<object>();
04. 
05.    var tmp = Parent;
06. 
07.    // Get all my parents
08.    while (tmp != null)
09.    {
10.        result.Add(tmp);
11. 
12.        tmp = tmp.Parent;
13.    }
14. 
15.    // Add myself to the list
16.    result.Add(this);
17. 
18.    // We want the root item to be first in the list and myself last
19.    result.Reverse();
20. 
21.    return result;
22.}

Dimitrina
Telerik team
 answered on 01 Apr 2014
1 answer
241 views
Hi,

I my application is being written in a general MVVM architecture.  I'm wondering if there is any sort of way to be able to get rows to be "selected" without them actually being selected by the user.  For example I have something working using a style which binds to a property of my model and that works when the rows are manually selected via mouse clicks, however I cannot figure how to get rows to look visually selected when data is initially loaded.  Here is the Xaml I'm using to bind to the "IsSelected" property of collection of objects which are bound to my grid.

<UserControl.Resources>
     <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource {x:Type telerik:GridViewRow}}">
         <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
     </Style>
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</UserControl.Resources>

Any help on how to approach doing this would be greatly appreciated.
Dimitrina
Telerik team
 answered on 01 Apr 2014
10 answers
475 views
Hello,

I'm having problems trying to create panes, pane groups and split containers programmatically.
Is there some code sample that can show me how to programmatically add those objects?
I'm trying to dock some control to the left side and a couple documents.
It's very weird for example the property HasDocumentHost returns true event when DocumentHost property is null.

Could you help me on this?
Thanks in advance.
George
Telerik team
 answered on 01 Apr 2014
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?