Telerik Forums
UI for WPF Forum
4 answers
371 views
Hi,

I'm trying to use the DataGridView control with a DataTemplate.    This bit seems ok at the moment.

I am planning on using a convertor to automatically select the CellStyle based on the value of the column.  I expect this shouldn't be too tricky.

What I am having problems with is trying to bind the content of the control to another cell's value.  Or using another cells value for a property. 

Any help/examples would be greatly appreciated.

Eg

Record
======

Name = "My Textbox"
Control = "Textbox"
Default = "This is my default value"

The Control Column will become a TextBox and I would like the TextBox Value to become the value of the Default,

I have tried things like

Text="{Binding Default}"
Text="{Binding Path=Default, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}"

<UserControl x:Class="WizardAdvanced" 
    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">  
    <Grid> 
        <Grid.Resources> 
            <Style x:Key="CheckboxCellStyle" TargetType="{x:Type telerik:GridViewCell}">  
                <Setter Property="ContentTemplate">  
                    <Setter.Value> 
                        <DataTemplate> 
                            <CheckBox VerticalAlignment="Center" /> 
                        </DataTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
            <Style x:Key="TextboxCellStyle" TargetType="{x:Type telerik:GridViewCell}">  
                <Setter Property="ContentTemplate">  
                    <Setter.Value> 
                        <DataTemplate> 
                            <TextBox Text="{Binding Default}" /> 
                        </DataTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
            <Style x:Key="ListboxCellStyle" TargetType="{x:Type telerik:GridViewCell}">  
                <Setter Property="ContentTemplate">  
                    <Setter.Value> 
                        <DataTemplate> 
                            <ComboBox  HorizontalAlignment="Left" VerticalAlignment="Bottom"/>  
                        </DataTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
        </Grid.Resources> 
          
        <telerik:RadGridView Margin="0" Name="Grid" AutoGenerateColumns="False">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"></telerik:GridViewDataColumn> 
                <telerik:GridViewDataColumn Header="Control" DataMemberBinding="{Binding Control}" CellStyle="{StaticResource TextboxCellStyle}"></telerik:GridViewDataColumn> 
                <telerik:GridViewDataColumn Header="Default" DataMemberBinding="{Binding Default}"></telerik:GridViewDataColumn> 
 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
 
    </Grid> 
</UserControl> 
 
Pavel Pavlov
Telerik team
 answered on 27 Jan 2010
2 answers
160 views
Hi,

I need to have control over the reordering of columns. More specific, in case the user reorder column, i need to reorder another column in order to keep the symmetry.

I tried to use ColumnReordered event but i have 2 problems with this approach:

1) I am having infinite loop, because i also have to user grid.ReorderColumns  (and then i get the event again)

2) in the  ColumnReordered  event i don't have the original index of the column before the reordering. I need it in order to know which other column should i reorder.

Thanks,

Ofer
Tsvyatko
Telerik team
 answered on 27 Jan 2010
3 answers
156 views
Hi,

version:2009.3.1314.35
.net 4.0 beta 2

I have the following problem:

Dragging a column to the grouppanel goes well, but when I try to ungroup I get the following error:

System.InvalidCastException was unhandled by user code
  Message=Unable to cast object of type 'MS.Internal.NamedObject' to type 'Telerik.Windows.Data.GroupDescriptor'.
  Source=Telerik.Windows.Data
  StackTrace:
       at Telerik.Windows.Data.GroupDescriptor.Equals(Object obj) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Data\Grouping\GroupDescriptor.cs:line 191
       at System.Object.Equals(Object objA, Object objB)
       at System.Windows.Data.BindingExpression.OnDataContextChanged(DependencyObject contextElement)
       at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
       at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
       at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
       at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.TreeWalkHelper.OnInheritablePropertyChanged(DependencyObject d, InheritablePropertyChangeInfo info)
       at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
       at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
       at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
       at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
       at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
       at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
       at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
       at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
       at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
       at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
       at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
       at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
       at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
       at System.Windows.TreeWalkHelper.InvalidateOnInheritablePropertyChange(FrameworkElement fe, FrameworkContentElement fce, InheritablePropertyChangeInfo info, Boolean skipStartNode)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at System.Windows.Controls.ItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item)
       at System.Windows.Controls.ItemContainerGenerator.OnItemRemoved(Object item, Int32 itemIndex)
       at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at System.Windows.Controls.ItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
       at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
       at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
       at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
       at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
       at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
       at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
       at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 141
       at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
       at Telerik.Windows.Data.RadObservableCollection`1.RemoveItem(Int32 index) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 212
       at Telerik.Windows.Data.ObservableItemCollection`1.RemoveItem(Int32 index) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 68
       at System.Collections.ObjectModel.Collection`1.Remove(T item)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.Ungroup(String member) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3302
       at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass2a.<GroupingRequested>b__29() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3196
       at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\CursorManager.cs:line 16
       at Telerik.Windows.Controls.GridView.GridViewDataControl.GroupingRequested(Object origin, GroupingRequestedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3177
  InnerException:
Pavel Pavlov
Telerik team
 answered on 27 Jan 2010
5 answers
736 views
Can I do a VU meter (like progressbar and "analog") with Gauges? This is the design I'm look for. I'm not a graphicdesigner so I need som help. See attachment.
Velin
Telerik team
 answered on 26 Jan 2010
2 answers
115 views
Hi,

I am trying to set a DataTable as ItemsSource for a RadGridView and get the following exception:

   at System.Linq.Enumerable.<CastIterator>d__aa`1.System.Collections.IEnumerator.Reset()
   at Telerik.Windows.Data.EnumerableExtensions.TryGetFirstElementType(IEnumerable source, Type& firstElementType) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\EnumerableExtensions.cs:line 54

I do the following:

DataTable

 

dataTable = new DataTable();

 

 

string[] values = dataValue.Value.Split(',');

 

 

for (int i = 0; i < values.Length; i++)

 

{

dataTable.Columns.Add(i.ToString(),

typeof(string));

 

}

dataTable.Rows.Add(values);

 

this.radGridView1.AutoGenerateColumns = true;

 

 

this.radGridView1.ItemsSource = dataTable;

 



Anybody has some suggestions what I am doing wrong here?
Pascal
Top achievements
Rank 1
 answered on 26 Jan 2010
5 answers
158 views
Hi,

I have downloaded latest trial verision of Wpf RadControls. They are working very good, but there is one exception. I can not drop pane(floating window state) outside the window of wpf application. Dragging and docking works only inside window of app - when I am trying to drag pane outside the window, pane "hides" underneath the border of app.
Is there any solution of this "problem"?

Best regards
Pit
Boyan
Telerik team
 answered on 26 Jan 2010
1 answer
154 views
hi all,
i hv a refresh button and i want to set first row or previously selected row as selected row after user refreshes the grid.
in the below code, _selectRow is of object type.  i am using customobjects in the project so _selectRow will be custom object of type "sample". however, i am unable to set selectedrow using the below code, please let me know if iam missing anything here.

regards,
Sandy



 

if (wipGridView.SelectedItem != null)

 

_selectedRow = wipGridView.SelectedItem ;

 

else

 

{

_selectedRow = wipGridView.Items[0] ;

}

 

this.Cursor = Cursors.Wait;

 

LoadWipGrid(_selectedDisplayType);

wipGridView.CurrentItem = _selectedRow;

wipGridView.SelectedItem = _selectedRow;

wipGridView.SetIsCurrent(_selectedRow,

true);

 

wipGridView.SetIsSelected(_selectedRow,

true);

 

Milan
Telerik team
 answered on 26 Jan 2010
1 answer
119 views
Hello Forum!

Is this a place to only discuss telerik products or is this also a place for people just learning WPF?
Milan
Telerik team
 answered on 26 Jan 2010
4 answers
184 views
Hello,

I attached event handler for GridViewRow Selected event by eventSetter.
But i getting "Handler type is not valid" exception.


void Row_Selected(object sender, RoutedEventArgs e){} 
<Style TargetType="telerik:GridViewRow">  
     <EventSetter Event="Selected" Handler="Row_Selected"/>  
</Style> 
What should be the right handler type for this event?

Basicly what I'm trying to do is after the data is loaded to set programaticly the second colomn of Grid to current and in edit mode.
Additionaly on arrow navigartion Up/Down current cell should be updated to the up/down cell in the same colomn and always current cell should be in edit mode.

Thank you
Milan
Telerik team
 answered on 26 Jan 2010
3 answers
196 views
Hi, i'm new on Telerik for WPF,

And i have some issue :

My grid is dynamiclly refreshed with prices, in the cells.
And i want to have my Cell's background change to green when the new price is bigger than the old one,
and change to a Red Background if my new price is lower than the old one.


So, i need to do this in the codebehind (i guess), but i'm not able to find the cell's background color properties there.

Can someone explain me how to do this ?


Thanks for your support.
Vlad
Telerik team
 answered on 26 Jan 2010
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
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?