Telerik Forums
UI for WPF Forum
1 answer
111 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
217 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
268 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
164 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
79 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
86 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
65 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
1 answer
123 views
Hi,

I'm not sure if this is related to this post but...
http://www.telerik.com/community/forums/wpf/gridview/grid-not-showing-any-rows.aspx
There I got the tip to set GroupRenderMode to flat, which helps "somehow".

I found another issue (but I guess it's to much effort to build a proofing example).

Another grid (working fine till one of the latest updates) is broken now.

After loading (prior to updating) the grid I do some dispatched (priority input) work from a different thread and my application breaks with an error.
I get a null reference exception in GridViewDataControl.cs somewhere in a PropertyChanged event handler.

When I remove my background processing it works "somehow" - but the image GridViewImageColumn shows the file path instead of an image.
If I open the view a second time the image is displayed.

At design time the designer breaks with a null ref exception- the stack trace:
Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass40.<Telerik.Windows.Data.IWeakEventListener<System.ComponentModel.PropertyChangedEventArgs>.ReceiveWeakEvent>b__3f()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Maybe this helps you to track the problem.

Just to complete this post...
Since you (telerik) gave the tip at the other post...

In the (open and broken designer) I enter GroupRenderMode="Flat" - and the grid displays immediately.
This solves the problem at designtime - but unfortunately it still breaks at runtime.

When I remove my handler it no longer breaks totally - but at the first view I see the image flicker up and then the filename.
After I switch views I see the images.
When I resize my window so that some rows are hidden and make it larger again - the images at the covered rows are no longer displayed.
Resize from the other side so that the images are not covered but the rows are resized - I see (some of) them again.

The problem really has to do something with NotifyPropertyChanged because I can make the things a lot better if the initial binding does not fire PropertyChanged.

Let me explain - the class holds a lot of images loaded on demand.
So there is a property "TheImage" with a getter like if(_DEFImage==null) { TryToLoadImages(); } return(_DEFImage);....

And TryToLoadImages set the image properties (also "TheImage") through their setter, which fires NotifyPropertyChanged (which is intended).

I I - in the constructor of my ViewModel iterate through the TheImage properties (force a load) the grid binds fine.
BUT - the other issue (make window smaller to cover...) still exists.

Regards
Manfred
Vera
Telerik team
 answered on 17 Jul 2013
2 answers
336 views
 Hi, I've followed Telerik's guide for styling the GridView's Header row and everything
seems to work fine, but there's one column I was unable to remove it appears as black line "see the attached picture".
Where is this in the template?
and how to remove it?


<ControlTemplate TargetType="{x:Type telerik:GridViewHeaderRow}">
					<telerik:SelectiveScrollingGrid>
						<telerik:SelectiveScrollingGrid.ColumnDefinitions>
							<ColumnDefinition Width="11"/>
							<ColumnDefinition Width="14"/>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="*"/>
						</telerik:SelectiveScrollingGrid.ColumnDefinitions>
						<telerik:SelectiveScrollingGrid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition/>
						</telerik:SelectiveScrollingGrid.RowDefinitions>
						<telerik:CommonHeaderPresenter x:Name="PART_CommonHeaderPresenter" Grid.Column="4" IsTabStop="False" Grid.Row="1" d:LayoutOverrides="GridBox">
							
						</telerik:CommonHeaderPresenter>
						<Border x:Name="CommonHeaderIndent" BorderBrush="#00848484" BorderThickness="0" Background="{StaticResource Common_Background}" Grid.ColumnSpan="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding Visibility, ElementName=PART_CommonHeaderPresenter}" Grid.Row="1" d:LayoutOverrides="GridBox"/>
						<Grid x:Name="PART_OuterGrid" Grid.ColumnSpan="5" Grid.Row="1">
							<Grid.RowDefinitions>
								<RowDefinition Height="*"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
							<Border x:Name="PART_GridViewHeaderRowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
								<Border BorderBrush="#004B4B4B" BorderThickness="0" Background="{StaticResource Common_Background}"/>
							</Border>
						</Grid>
						<telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="4" IsTabStop="False" Grid.Row="1">
							
						</telerik:DataCellsPresenter>
						<Border x:Name="PART_IndicatorPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Grid.Row="1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" Width="25" Grid.ColumnSpan="2">
							<Border BorderBrush="#004B4B4B" BorderThickness="0" Background="{StaticResource Common_Background}">
								
							</Border>
						</Border>
						<telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="4" IsTabStop="False" IndentLevel="{TemplateBinding IndentLevel}" MinHeight="{TemplateBinding MinHeight}" Grid.Row="1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" d:LayoutOverrides="GridBox">
							<telerik:IndentPresenter.ItemTemplate>
								<DataTemplate>
									<telerik:GridViewHeaderIndentCell IsTabStop="False">
										
									</telerik:GridViewHeaderIndentCell>
								</DataTemplate>
							</telerik:IndentPresenter.ItemTemplate>
							
						</telerik:IndentPresenter>
						<Border x:Name="PART_CommonHeaderHierarchyIndentPresenterAllLevels" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{StaticResource Common_Background}" Grid.Column="4" Grid.Row="1" Grid.RowSpan="1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25" Margin="0,0,233.907,0">
							<Border.Visibility>
								<Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
									<Binding.Converter>
										<telerik:BooleanToVisibilityConverter/>
									</Binding.Converter>
								</Binding>
							</Border.Visibility>
						</Border>
						<Border x:Name="PART_CommonHeaderHierarchyIndentPresenterFirstLevel" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{StaticResource Common_Background}" Grid.Column="4" Margin="0,-1,233.907,0" Grid.Row="0" Grid.RowSpan="1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25" d:LayoutOverrides="GridBox">
							<Border.Visibility>
								<Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
									<Binding.Converter>
										<telerik:BooleanToVisibilityConverter/>
									</Binding.Converter>
								</Binding>
							</Border.Visibility>
						</Border>
						<Border x:Name="PART_HierarchyIndentPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Grid.Column="4" Grid.Row="1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25" Margin="0,0,233.907,0" d:LayoutOverrides="GridBox">
							<Border.Visibility>
								<Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
									<Binding.Converter>
										<telerik:BooleanToVisibilityConverter/>
									</Binding.Converter>
								</Binding>
							</Border.Visibility>
							<Border BorderBrush="#004B4B4B" BorderThickness="0" Background="{StaticResource Common_Background}" />
						</Border>
					</telerik:SelectiveScrollingGrid>
				</ControlTemplate>
Dimitrina
Telerik team
 answered on 17 Jul 2013
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?