Telerik Forums
UI for WPF Forum
3 answers
214 views
I've created a CustomGridViewToggleRowDetailsColumn class that descends from GridViewBoundColumnBase.  Its purpose is to display the row details toggle control only if the row in question contains data to be displayed in the row details.

In order to speed up the retrieval of data from my database, I have added a boolean flag to the view model object that is displayed in the RadGridView that indicates whether the object has data for the row details.  This flag is set when the row is retrieved from the database.  However, I do not want to retrieve the data for the row details at the same time.  Rather, I want to wait for the user to click on the button to expand the details and go get the data at that time.  The underlying View Model objects implement INotifyPropertyChanged, so the WPF controls get notification of changes.

The CustomGridViewToggleRowDetailsColumn class has a Click event that I want to program.  When the user clicks on the button, I want the code to check to see if the detail data has been retrieved from the database yet, and if not, to go and get it.

Here's the definition of the CustomGridViewToggleRowDetailsColumn class:

class CustomGridViewToggleRowDetailsColumn : GridViewBoundColumnBase {
  
    public static RoutedEvent ClickEvent =
        EventManager.RegisterRoutedEvent( "Click", RoutingStrategy.Bubble, typeof( ToggleRowDetailsColumnRoutedEventHandler ), typeof( CustomGridViewToggleRowDetailsColumn ) );
  
    public GridViewCell Cell { get; set; }
  
    public event RoutedEventHandler Click {
        add { AddHandler( ClickEvent, value ); }
        remove { RemoveHandler( ClickEvent, value ); }
    }
  
    public override object Header {
        get { return null; }
        set { base.Header = value; }
    }
  
    public GridViewToggleButton ToggleButton { get; set; }
  
    private Binding toggleButtonVisibility;
    public Binding ToggleButtonVisibility {
        get { return toggleButtonVisibility; }
        set { toggleButtonVisibility = value; }
    }
  
    public CustomGridViewToggleRowDetailsColumn() {
        this.EditTriggers = GridViewEditTriggers.None;
    }
  
    public override bool CanFilter() {
        return false;
    }
  
    public override bool CanGroup() {
        return false;
    }
  
    public override bool CanSort() {
        return false;
    }
  
    public override FrameworkElement CreateCellElement( GridViewCell cell, object dataItem ) {
        Cell = cell;
  
        ToggleButton = new GridViewToggleButton { 
            Margin = new System.Windows.Thickness( 3 )
        };
        ToggleButton.Click += new RoutedEventHandler( ToggleButton_Click );
  
        if ( this.DataMemberBinding != null ) {
            ToggleButton.SetBinding( GridViewToggleButton.IsCheckedProperty, this.DataMemberBinding );
        }
  
        if ( ToggleButtonVisibility != null ) {
            ToggleButton.SetBinding( GridViewToggleButton.VisibilityProperty, ToggleButtonVisibility );
        }
  
        GridViewRow row = cell.ParentRow as GridViewRow;
  
        row.SetBinding( GridViewRow.DetailsVisibilityProperty, new Binding( "IsChecked" ) { 
            Source = ToggleButton, 
            Converter = new BooleanToVisibilityConverter(), 
            Mode = BindingMode.TwoWay 
        } );
  
        return ToggleButton;
    }
  
    void ToggleButton_Click( object sender, RoutedEventArgs e ) {
        // Raise our Click event
        RoutedEventArgs newEventArgs = new ToggleRowDetailsColumnRoutedEventArgs( ClickEvent, Cell );
        RaiseEvent( newEventArgs );
    }
}
  
public class ToggleRowDetailsColumnRoutedEventArgs : RoutedEventArgs {
  
    public GridViewCell Cell { get; set; }
  
    public GridViewRow Row {
        get { return Cell.ParentRow as GridViewRow; }
    }
  
    public ToggleRowDetailsColumnRoutedEventArgs( RoutedEvent routedEvent, GridViewCell cell )
        : base( routedEvent ) {
        Cell = cell;
    }
}
  
public delegate void ToggleRowDetailsColumnRoutedEventHandler( object sender, ToggleRowDetailsColumnRoutedEventArgs e );

Here is the Click event handler that I wrote that is called when the user clicks on the toggle button for a row that has details to be displayed:

private void ExpandAlarms_Click( object sender, ToggleRowDetailsColumnRoutedEventArgs e ) {
    ReadViewModel read = e.Row.Item as ReadViewModel;
  
    if ( read.Alarms == null ) {
        read.Alarms = DataInterface.GetAlarmsForRead( read.ID );
    }
  
    e.Handled = true;
}

The problem is that the parameters to the ExpandAlarms_Click method always refer to the same row, no matter which row I click on.  I think there is something wrong, either in the ToggleButton_Click method or in the CreateCellElement method.  But I don't know what the issue could be.  I think I need to save the Cell passed to the CreateCellElement somewhere other than were I'm saving it now, but I'm not sure where that would be.

Please help

Tony
Tony
Top achievements
Rank 1
 answered on 27 Jul 2012
1 answer
172 views
Hello,

I have the following column defined in my xaml code

<
telerik:GridViewMaskedTextBoxColumn Mask="P1" MaskType="Numeric" 
DataMemberBinding="{Binding CurrentAllocationWeight}" 
DisplayIndex="1" IsReadOnly="True" DataFormatString="{}{0:P1}"  
Header="% Of Total" ColumnGroupName="CurrentAllocation"/> 

The bound property is a null-able decimal value. I have no other validation in the code-behind. When I try to enter a value in the cell, I get a validation error: "DecimalConverter cannot convert from System.Double".

How should I fix this, so that the user can enter say, 5.5, and it would display that value as "5.5%" in the cell?

Hasanain
Dimitrina
Telerik team
 answered on 27 Jul 2012
13 answers
650 views
Hi all,

I have two grids. Grid A has data where some of the columns have drop downs. Grid B is used to administrate the lists in the those drop downs.

When a change occurs in Grid B then the values in Grid A are updated using INotifyPropertyChanged. However, I also want validation to kick in (Its possible to delete values from Grid B but Grid A needs to have appropriate values)

For basic cell level validation I have used the cell validating event and that works pretty well. If possible, when Grid B has been updated I would want cell validation to start.

Thanks in advance

Arthur
Arthur
Top achievements
Rank 1
 answered on 27 Jul 2012
5 answers
323 views
Hi.

I'd like to be able to add more manipulation points to a RadDiagramConnection programmatically. Is this possible and how would I go about doing it?

Regards.
Alex Fidanov
Telerik team
 answered on 27 Jul 2012
1 answer
219 views
Let me edit this to be more clear.  I am trying to dynamically change the values of the needle, thus making it Animated and have it move according to the live data being stored.  I have live data that is being thrown in a Records (ObservableCollection<QRecords<double>>) which (QRecords) has the properties "Value" and "TimeStamp" in it.  In the ChartView control, I use:

var lineSeries = new LineSeries();
lineSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "TimeStamp" };
lineSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
lineSeries.ItemsSource = (chart.Chart as GuiAnalogQueue).Records;

to add a new LineSeries accompanied with addition VerticalAxes.  This is the binding that takes care of all my data changing dynamically. 

Now, I'm trying to apply this data to allow the user to user a Gauge to display the same data, just in a different fashion (Gauge vs. ChartView).  However, when I do something like
<telerik:Needle x:Name="needle" IsAnimated="True" Value="{Binding Value}"/>
or
<telerik:Needle x:Name="needle" IsAnimated="True" Value="{Binding chart.Chart.Value}"/>

My needle doesn't move at all, whatsoever.  What steps should I take to achieve changing the value of the Gauge's needle?

Kevin
Andrey
Telerik team
 answered on 27 Jul 2012
1 answer
120 views
I am currently working on a project which uses the RadGridView, part of the required functionality is to hide and show records based on various user interaction with the grid, it would appear the best way to get this to work is using a CompositeFilterDescriptor and add and remove the filters as required.

My issue is as follows, the project has been written using MVVM and from all the reading i have done it doesn't seem possible to use binding for the indvidual FilterDescriptor lines, the RadGridView in question is contained with in a datatemplate (and there maybe more than one on the screen at one time) so it's can't be accessed directly from the code behind.

So my question is, is there anyway of changing the FilterDescriptor lines with out directly accessing the grid from the code behind.

 

Dimitrina
Telerik team
 answered on 27 Jul 2012
1 answer
132 views
Is it possible to have Column Groups in Tree List View like we have it in Grid View?

Do you have an example project that does that please?

gans
Top achievements
Rank 1
 answered on 26 Jul 2012
1 answer
101 views
Hi,

I have a radListcontrol with several items inserted at runtime....

Atruntime I like get the RadListItem object where I used the dobleclick on it.....

how i can do that???



George
Telerik team
 answered on 26 Jul 2012
1 answer
233 views
Hi,

here is the situation... In my application, I have two combobox, one for department selection and one for billing code selection. When my dialog is loaded, I call my back-end (wcf call) to get all billing codes for all existing departments. I would like to know if it's possible to filter data in my billing code combobox base on the combobox department selection changed without calling my back-end again?

Thank's
George
Telerik team
 answered on 26 Jul 2012
1 answer
163 views
Is there a Telerik sample application that uses the ribbon with the docking component all inside a ribbon window? I like the way the Telerik Work Item Manager is done, but don't see a sample for how we can achieve the same layout. In my prototype application, I'm having layout issues and things don't seem to want to work together well.

Thanks in advance...
-Tony
Boyan
Telerik team
 answered on 26 Jul 2012
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
DataPager
PersistenceFramework
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?