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

I have a WPF solution, where i use treeListView. I populate the treeListView from database and it works ok.

The problem is that when user has opened several items on treeListView and then tries to get the data again from database. The already opened rows are collapsed. I tried to first go through the treeListView items with this code:

//First try to get all expanded items to my own list variant (to store ID of all expanded items)

List<ClsDataOfTreeListItem> Items = new List<ClsDataOfTreeListItem>() ;

foreach (Telerik.Windows.Controls.TreeListView.TreeListViewRow row in myTreeListView.ChildrenOfType<Telerik.Windows.Controls.TreeListView.TreeListViewRow>())

{

     if(row.IsExpanded==true)

     Items.Add( (ClsDataOfTreeListItem)row.Item);

}

//then i refresh data from the database
GetData() //this populates data with refreshed contents from DB

 

//after refresh, expand the same items again by collected information
//the problem is, that this time the foreach loop doe not find any rows

foreach (Telerik.Windows.Controls.TreeListView.TreeListViewRow row in   
         myTreeListView.ChildrenOfType<Telerik.Windows.Controls.TreeListView.
TreeListViewRow>())

{

    foreach (ClsDataOfTreeListItem itm in Items)

    {

         ClsDataOfTreeListItem tmpItem = (ClsDataOfTreeListItem)row.DataContext;

         if (itm.ID == tmpItem.ID)

             row.IsExpanded = true;

    }

}

//after the operation, the UI is refreshed and the items not expanded, because the foreach loop did not find any rows after data refresh from db.

Why does the foreach loop detect any rows after data refresh? Is there any way to refresh the UI programmatically before trying to espand as it origanally was? Rebind after data refresh dide not help. Is there any "datarefreshed" event that I could use (the tmpItems could be stored and used in event handler if there is good one for this purpose)?

Is there any other ways to get and set the original expanded information (and the scrolled position if possible).?

 

 

Dimitrina
Telerik team
 answered on 12 Aug 2013
13 answers
1.2K+ views
Hi,

The Busy Indicator works great when you have background tasks going on. However, if you have a task that cannot be performed in the background such as updating a CollectionViewSource the animation stops.

The busy indicator should really be running in a seperate thread off the main GUI thread.

There is an example of this at http://abrahamheidebrecht.wordpress.com/2009/08/05/creating-a-busy-indicator-in-a-separate-thread-in-wpf/

Would Telerik consider updating the busy indicator to run on a seperate thread?

Thanks
Anthony
Luca
Top achievements
Rank 1
 answered on 12 Aug 2013
1 answer
160 views
Hi,

This is not 100% RadTileView/Item specific stuff but still would probably require different kind of implementation for RadTileViewItem templates...

I'm currently using headerTemplate like below as my RadTileView's ItemTemplate:

<DataTemplate x:Key="headerTemplate">
    <StackPanel Orientation="Horizontal">
        <telerik:RadButton Width="14"
                       Height="14"
                       Margin="0 0 0 0"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"
                       Content="X"
                       FontSize="10"
                       Foreground="Black"
                       Background="White"
                       Command="{Binding Path=DataContext.RemoveTileCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
                       CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadTileViewItem}}"
                       Padding="0"
                       />
        <TextBlock x:Name="TileHeader" FontSize="10" Text="{Binding Path=DataContext.DataContext.TileCaption, RelativeSource={RelativeSource AncestorType=telerik:RadTileViewItem}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left"/>
    </StackPanel>
</DataTemplate>

I have a problem localizing this TileHeader because TileCaption is a string property in each Tile's ViewModel and it gets a value like "Amount: 0" or "Not set" depending on the situation. So the localized part of the property should be "Amount: " or "Not set" or nothing in some cases.

I'm using 3rd party localization addon called WPF Localization extension and localization is done with binding like Text="lex:Loc SomeKey" so basically what I'm asking is how could I make Tile specific ItemTemplate so that I can use data binding to desired localized key or what would be the best way to accomplish binding to TileViewItem so that it will get the change notification and updates accordingly?

My current implementation lacks the functionality to refresh the title when RaisePropertyChanged is triggered (when language is changed) because I don't have data binding to TileCaption (I'm setting the value of TileCaption property in code).

So if I could somehow make tile specific ItemTemplate for each tile I could make binding in XAML. Of course this has other problem because I need to have 2 different localizations depending on the situation but at least the change notification would work.

Or should I create databindings in code-behind... 

Br,

Kalle
Pavel R. Pavlov
Telerik team
 answered on 12 Aug 2013
1 answer
181 views
Hi,
We are using the telerik RadGridView control (2012.3.1129.40) in our WPF application.
When the grid is populated with a lot of data, the scrolling is getting very slow, not smooth and stuck for few second till the view is updated.
Another problem is when performing the horizontal scrolling, the scroll bar indicator doesn't show the correct position regarding the row length and can jump back after the rendering of new columns
It really degrades the application convenience and users experience.

(We can't disable the row and columns virtualization and currently just set the ScrollMode="Deferred" to make it a little more friendly) 
Are there any solutions or grid configurations to improve the scrolling performance?
Thanks in advance. 
Yordanka
Telerik team
 answered on 12 Aug 2013
2 answers
37 views
Hi,

Pls suggest me the right way to achieve the below mentioned format schedule grid.


Regards,
Sugumar P
Sugumar
Top achievements
Rank 1
 answered on 12 Aug 2013
1 answer
103 views
I have setup a data source for editing in a RadGridView, the entity in question has a many to many relationship with another entity with in the database:

EntityA 
ID

EntityB
ID

EntiyAB
EntityAID
EntityBID

I want to load the related EntityB records in a row Details Template to enable the user to add, edit, and delete. I have set the RelatedObjects in the Entity Framework Data Source and have setup the RowDetailsTemplate with a radGridView, but yet the linked EntityB records are not being loaded nor is the child GridView allowing the user to add a new record.
tony
Top achievements
Rank 1
 answered on 11 Aug 2013
2 answers
237 views
Hi all,

I am using a RadGridView to display a list of DataRowBase objects which implements the ICustomTypeDescriptor. When the grid starts to populate its rows I observed some "first chance" ArgumentExceptions printed out in the output window of the IDE. ("An exception (first chance) of the type "System.ArgumentException" occurred in System.ComponentModel.DataAnnotations.dll" - translated from German).
As the grid showed all my data correctly, I could probably ignore the messages - but it was very slow in doing so. So I used a hard-coded class with the same data and the same grid and this was significantly faster (and didn't throw any exceptions). (I need to use a generic approach as the application allows the user to display data of csv files and I want to utilize all features of the grid view, like filtering, sorting, grouping etc.)

I took my while to find out how to track this exception message down to its root:
The original exception message is: "The type "DataRowBase" does not contain a public property "RefDate"." (translated from German, may not be accurate)
And it seems to be thrown by some code in "GridViewVirtualizingPanel.cs".

I can't see whether this exception is thrown by the above class or somewhere deeper in the .net framework (as the message in the output window suggests, see above). But it is interesting to see that the exception is thrown only once per row, not per row and column (as all my columns are generic).

This leads to the assumption that the interface ICustomTypeDescriptor is not used properly. I found a very helpful article on how this interface is used by System.ComponentModel.TypeDescriptor in an older issue of the MSDN Magazine: MSDN Magazine: ICustomTypeDescriptor, Part 1: "... Before going straight to the metadata to get property information, TypeDescriptor first checks to see if the type being examined implements the System.ComponentModel.ICustomTypeDescriptor interface. If it does, (...), rather than using the metadata to get property information, TypeDescriptor will simply ask the object (through its ICustomTypeDescriptor.GetProperties method) which properties it supports."

I added some Debug.WriteLine's to my ICustomTypeDescriptor.GetProperties() implementation and this revealed that
a) the above exception is thrown after a first call to GetProperties() of each(!) DataRowBase instance in my list, and
b) GetProperties() is called for every displayed column of the same instance (w/o exception) [why that? An initial call should be sufficient]

My question is here: Is this a problem of the RadGridView? Or does the problem lie deeper within the framework?

Any help/suggestion is highly appreciated!

Thanks,
Thorsten

PS
I am using RadControls for WPF, Q2 2013 and WPF 4.5
Thorsten
Top achievements
Rank 1
 answered on 09 Aug 2013
1 answer
77 views
Hi,

I wants t create the functionality like Region available in Visual Studio which allow to expand and collapse the code or text.

How to imlement ?

Please help or suggest.



Thanks & Regards

Sopan Vaidya
Iva Toteva
Telerik team
 answered on 09 Aug 2013
1 answer
636 views
Hi I am having problem with template binding to visualstate. I need to change background color on action MouseOver (specifically Foreground color on Text) is there any way how to do it?
here is my xaml template:
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                    xmlns:local="clr-namespace:CustomControl">
 
 
    <Style TargetType="{x:Type local:RadCustomBtn}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="#FF848484"/>
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="#408AD2"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:RadCustomBtn}">
                    <Grid SnapsToDevicePixels="True">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#679ED2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="White"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper"/>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#679ED2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="InnerBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="#408AD2"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="disabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="BackgroundVisibility">
                                <VisualState x:Name="BackgroundHidden">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterBorder"/>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="disabledBorder"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="BackgroundVisible"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStatesGroup">
                                <VisualState x:Name="Unfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.15">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
                            <Border x:Name="InnerBorder" BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding InnerCornerRadius}"/>
                        </Border>
                        <Border x:Name="disabledBorder" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFE0E0E0" CornerRadius="{TemplateBinding CornerRadius}" Visibility="Collapsed"/>
 
 
 
                      
                        <!--<ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Style="{DynamicResource radButton_style_label}"/>-->
                        <StackPanel Orientation="{TemplateBinding Orientation}" HorizontalAlignment="Center"
                            <Viewbox>
                                <StackPanel Width="{TemplateBinding IconWidth}" Height="{TemplateBinding IconHeight}" Visibility="{TemplateBinding IconVisibility}">
                                    <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Icon}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Style="{DynamicResource radButton_style_label}"/>
                                </StackPanel>
                            </Viewbox>
                            <StackPanel Width="auto" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
                                <TextBlock Text="{TemplateBinding Text}" Foreground="{TemplateBinding Foreground}" FontSize="40"></TextBlock>
                            </StackPanel>
                        </StackPanel>
                         
                        <Border x:Name="CommonStatesWrapper">
                            <Border x:Name="FocusVisual" BorderBrush="#FFFFFF" BorderThickness="1" Background="Transparent" CornerRadius="{TemplateBinding CornerRadius}" Opacity="0" Visibility="Collapsed">
                                <Border x:Name="FocusInnerVisual" BorderBrush="Transparent" BorderThickness="1" CornerRadius="{TemplateBinding InnerCornerRadius}"/>
                            </Border>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
</ResourceDictionary>

Kiril Vandov
Telerik team
 answered on 09 Aug 2013
1 answer
196 views
I am having a color rendering problem using RadPdfViewer.  Colors are shifted when displayed through the viewer.
See below for the RGB values of the original compared to the RGB values of the Telerik display.  I cannot attach the files as they contain sensitive data.  I don't see any settings that facilitate having any influence over the color profiles. 

I'd be interested to know who else has seen similar issues as well as whether or not Telerik says this is a known issue or plans to do anything about it.

acro reader (original)

purple
RGB: 74-24-107

gray in background of center top graphic
RGB: 189-186-189

telerik

purple rendered as blue
RGB: 0-0-181

gray in background of center top graphic
RGB: 181-178-181
Kammen
Telerik team
 answered on 09 Aug 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?