Telerik Forums
UI for WPF Forum
0 answers
86 views
Thanks!
Mike
Top achievements
Rank 1
 asked on 17 Jul 2013
1 answer
108 views
Hello,

I'm attempting to update a property of an object in a collection that is being shown by RadGridView. The update is being done by a background (non-UI) thread. Normally, this isn't a problem - the WPF binding takes care of shifting to the UI thread to update the control.

However, RadGridView does not seem to follow this pattern.

I've created an example project to illustrate. Currently, the RadGridView is commented out, and a DataGrid is showing the collection. If we click the button that updates the source objects property on a background thread, then it works fine.

If we uncomment the RadGridView line (so we now have a datagrid and a radgridview showing the same collection), then updating the object property causes a "The calling thread cannot access this object because a different thread owns it" exception.

Is it possible to get RadGridView to behave in the same way as DataGrid in this case?

Thanks,
James.

[EDIT - I've realised I should submit a support ticket so I can attach the project, sorry]

James
Top achievements
Rank 1
 answered on 17 Jul 2013
1 answer
102 views
I am trying to do MVVM with the diagram framework. I modified the MVVM example in the Telerik\xaml-sdk on github.

I am getting a crash when doing the following.  I create connector between a shape inside a
container with shape outside the container. Then I drag the shape outside the container into the container.

Then I immediately get this exception with this error message:
{"Unable to cast object of type 'Telerik.Windows.Controls.RadDiagramConnection' to type 'Telerik.Windows.Controls.Diagrams.Extensions.ViewModels.NodeViewModelBase'."} 


Is this a known bug?  Is there a way to do MVVM with diagram when having connectors and containers?
Tina Stancheva
Telerik team
 answered on 17 Jul 2013
12 answers
1.3K+ views
Hi,

I am using my own custom printpreview in which I show basically a Telerik.Windows.Documents.Model.Table.

The table itself stretches to fit the page, but all columns have equal width, but I would like them to fit their content.

I can only assign  a PreferredWidth to a distinct TableCell.

Is there a possibility to have the Columns adjust their width to their content?
F Beto
Top achievements
Rank 1
 answered on 17 Jul 2013
6 answers
191 views
Hello. I have implemented a feature into my program where I can export the grid view to excel 2010, but only the parent items are exported, and not the child items. Is it possible to export both the parent and children items to excel in a hierarchy-like structure?

Thank you.
Dimitrina
Telerik team
 answered on 17 Jul 2013
1 answer
254 views
I have a RadGridView that is bound to a QueryableCollectionView. Everything works as it should, when the data is filtered, I have access to the filtered data (via the QueryablCollectionView) as well as the unfiltered source.

My problem is that our application allows a user to "refresh" their data. That is, press a button and go get the latest from the database. If the data is already filtered, and then refreshed, it does in fact update any data within that filter. The problem after its refreshed though is that in the filter control, I lose the original source of the data. I checked in debugging to make sure that the refreshed data was being set as the source - and it was. 


Yoan
Telerik team
 answered on 17 Jul 2013
1 answer
132 views
Hi,

Would you please show a working example of a RadDataFilter using two way binding to the following collections.

Thanks
Rich

Namespace Filters.MyFilter
{
    class MyFilter
    {
        public static ItemPropertyDefinitionCollection ItemPropertyDefinitions = new ItemPropertyDefinitionCollection();
        public static CompositeFilterDescriptorCollection FilterDescriptors = new CompositeFilterDescriptorCollection();
    }
}
Yoan
Telerik team
 answered on 17 Jul 2013
1 answer
74 views
Hello,
I have the following issue: I have data models that keep their state in a property 'ObjectState' that is of type enum. I show a list of these data model objects in a GridView. The first column shows the ObjectState-property. To have a better appearance of this column, I use a StyleSelector to get the Style based on the ObjectState.
The Problem is, that if i scroll horizontally and the column with the style selector gets out of the view, the following column suddenly shows the type of the object instead of the bound value. If I sort the grid, then the bound values appear and everything is fine.
We use version Q3 2012.
Can you help me?

public enum ObjectState
{
    Unchanged = 0,
    New = 1,
    Updated = 2,
    Deleted = 3,
}



public class ObjectStateStyleSelector : StyleSelector
    {
        public Style UnchangedStyle { get; set; }
        public Style ChangedStyle { get; set; }
        public Style AddedStyle { get; set; }
        public Style DeletedStyle { get; set; }
 
        public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container)
        {
            if (item != null)
            {
                Model model = item as Model;
 
                if (model != null)
                {
                    switch (model.ObjectState)
                    {
                        case ObjectState.New:
                            return this.AddedStyle;
 
                        case ObjectState.Updated:
                            return this.ChangedStyle;
 
                        case ObjectState.Unchanged:
                            return this.UnchangedStyle;
 
                        case ObjectState.Deleted:
                            return this.DeletedStyle;
                    }
                }
            }
            return null;
        }
    }



public class Model : INotifyPropertyChanged
    {
        private ObjectState m_objectState;
        private int m_id;
        private string m_description;
         
        public ObjectState ObjectState
        {
            get { return m_objectState; }
            set
            {
                if (m_objectState == value)
                    return;
 
                m_objectState = value;
                OnNotifyPropertyChanged("ObjectState");
            }
        }
 
        public int ID
        {
            get { return this.m_id; }
            set
            {
                if (this.m_id == value)
                    return;
 
                this.m_id = value;
                UpdateState();
                OnNotifyPropertyChanged("ID");
            }
        }
 
        public string Description
        {
            get { return this.m_description; }
            set
            {
                if (this.m_description == value)
                    return;
 
                this.m_description = value;
                UpdateState();
                OnNotifyPropertyChanged("Description");
            }
        }
 
        public Model()
        {
            this.ObjectState = GridProblem.ObjectState.New;
        }
         
        #region INotifyPropertyChanged Members
 
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnNotifyPropertyChanged(string prop)
        {           
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(prop));
            }
        }
 
        private void UpdateState()
        {
 
            if (m_objectState == GridProblem.ObjectState.Unchanged)
            {
                m_objectState = GridProblem.ObjectState.Updated;
            }
        }
 
        #endregion
    }




<Window x:Class="GridProblem.MainWindow"
        xmlns:main="clr-namespace:GridProblem"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <main:ObjectStateStyleSelector x:Key="GridColumnObjectStateStyleSelector">
            <main:ObjectStateStyleSelector.AddedStyle>
                <Style TargetType="telerik:GridViewCell">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock Text="+" FontSize="20" FontWeight="Bold" Foreground="Green"
                                       Margin="0"
                                       HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </main:ObjectStateStyleSelector.AddedStyle>
            <main:ObjectStateStyleSelector.ChangedStyle>
                <Style TargetType="telerik:GridViewCell">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock Text="*" FontSize="20" FontWeight="Bold" Foreground="OrangeRed"
                                       HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </main:ObjectStateStyleSelector.ChangedStyle>
            <main:ObjectStateStyleSelector.UnchangedStyle>
                <Style TargetType="telerik:GridViewCell">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </main:ObjectStateStyleSelector.UnchangedStyle>
        </main:ObjectStateStyleSelector>
    </Window.Resources>
    <Grid>
        <telerik:RadGridView x:Name="mainGrid" ItemsSource="{Binding Path=Items}"
                             CanUserInsertRows="True"
                             ShowInsertRow="True"
                             AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn CellStyleSelector="{StaticResource GridColumnObjectStateStyleSelector}"
                                            DataMemberBinding="{Binding Path=ObjectState}" />
                <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding Path=ID}"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Path=Description}"></telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

Thanks
Max
Maximilian
Top achievements
Rank 1
 answered on 17 Jul 2013
0 answers
70 views
I need help in passing gridview row values to the user control in WPF
How can I achieve it
Rakesh
Top achievements
Rank 1
 asked on 17 Jul 2013
1 answer
58 views

Hi everyone.

In our project, we have just upgraded the version of the controls from 2012Q3 to 2013Q2. With the new version, we see something strange in the time ruler in the ScheduleView, when we are doing TimeZone grouping. You can see this behavior in the attached captures.

2012 Q3:
http://i.imgur.com/u59u7V3.png

2013 Q2:
http://i.imgur.com/3Tb50Js.png

In 2013 Q2 image, I've marked this time ruler, seems that the time is added rather than substracted (I'm expecting to see the time ruler like 2012 Q3 capture, the time in Canary Islands must be -1 rather than +1).

Any help? Is this change intended, and if it is, can I go back to the 2012 Q3 behavior with the new version?

Thank you.

Kalin
Telerik team
 answered on 17 Jul 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?