Telerik Forums
UI for WPF Forum
5 answers
149 views
Hi.

I am to provide a graph that indicate deviation from a set point.

There are five significant points on the Y axis
* Upper scale limit.
* Upper alarm limit
* The desired point (set point).
* Lower alarm limit.
* Lower scale limit.

These can be, for instance
High Scale : 100
High Alarm: 80
Set Point : 50
Low Alarm: 20 
Low Scale: 0.

They can also be,
High Scale : 100
High Alarm: 80
Set Point : 76
Low Alarm: 10 
Low Scale: 0.
 
These two sets of axis settings should draw the exact same Y Axis. Even in the case where the distance from High Alarm to set point is just 4 units and distance from Set Point to Low Alarm is 56 units, they should take equal amount of space of the drawing area. A linear dataset would draw a gently sloping curve from Low Alarm to Set Point, but it would be very steep from Set Point to High Alarm as the whole distance would be covered in just 4 units.

How do I achieve this? I consider using four stacked curves that would each cover one area of the curve on the scale for its area so that it would only APPEAR to be a single curve, but would actually be four different curves. This, however functionally adequate, does not draw a continuous curve. Any better suggestions?
Evgenia
Telerik team
 answered on 06 Apr 2011
1 answer
49 views
I am using Telerik chart control and I want to set the minor ticks on X axis.
I tried this.

radChartROIComparison.DefaultView.ChartArea.AxisX.MinorTicksVisibility = Visibility.Visible;

But compilation fails telling that

Error 1 'Telerik.Windows.Controls.Charting.AxisX' does not contain a definition for 'MinorTicksVisibility' and no extension method 'MinorTicksVisibility' accepting a first argument of type 'Telerik.Windows.Controls.Charting.AxisX' could be found (are you missing a using directive or an assembly reference?) 

What is the reason for this????

Am I using an old version which does not support this property?

Regards
Rangana

 

Giuseppe
Telerik team
 answered on 06 Apr 2011
2 answers
252 views
Hi,

I' ve got the following problem:

In my application there is a window which includes a scheduleview on the left side and a treeview on the right side. The scheduleview itself is inside a user control. In the scheduleview there exist some appointments.
This scenario should work, but currently doesn't:

I select one treeview item and start a drag drop operation. If I am over an appointment in the scheduleview some conditions between the appointment and the treeview item should be checked.
Currently nothing works: I start dragging the treeview item. As soon as I am over the scheduleview, a "forbidden" symbol appears, and nothing more happens.

I've implemented following:

RadDragAndDropManager.SetAllowDrag(treeview,true);
RadDragAndDropManager.AddDragInfoHandler(treeview, new EventHandler<DragDropEventArgs>(OnDrag));
     RadDragAndDropManager.AddDragQueryHandler(treeview,new EventHandler<DragDropQueryEventArgs>(OnDragQuery));
           RadDragAndDropManager.AddDropQueryHandler(scheduleView, new EventHandler<DragDropQueryEventArgs>(OnDropQuery));
           RadDragAndDropManager.AddDropInfoHandler(scheduleView, new EventHandler<DragDropEventArgs>(OnDropInfo));
           RadDragAndDropManager.SetAllowDrop(scheduleView,true);

DragQuery works, but I never reach DropInfo or DropQuery. What am I doing wrong? I have to say, that a treeview item is NOT of type Appointment.

In RadScheduler, the procedure described above worked perfectly.

Please respond soon.
Thanks
hardik
Top achievements
Rank 1
 answered on 06 Apr 2011
1 answer
410 views
Is there an event that I can hook into to be notified when the active pane is changed in the RadDocking control? I have a ribbon that changes based on the active RadDocumentPane.

I found some similar questions in the forum with answers that suggested using the RadPane.GotFocus event. My issue with this is that I also need to properly handle when no RadDocumentPanes are active. I think the ideal solution would involve the RadDocking class having both an ActivePane property and ActivePaneChanged event.

Thanks,
Joey
Konstantina
Telerik team
 answered on 06 Apr 2011
2 answers
191 views
I have a simple candlestick chart:

<telerik:RadChart Name="radChart1" ItemsSource="{Binding ChartData}" Visibility="{Binding CandlestickVisibility}">
    <telerik:ChartDefaultView>
        <telerik:ChartDefaultView.ChartLegend>
            <telerik:ChartLegend IsEnabled="True" Visibility="Collapsed" />
        </telerik:ChartDefaultView.ChartLegend>
    </telerik:ChartDefaultView>
    <telerik:RadChart.SeriesMappings>
            <telerik:SeriesMapping>
            <telerik:SeriesMapping.SeriesDefinition>
                <telerik:CandleStickSeriesDefinition />
            </telerik:SeriesMapping.SeriesDefinition>
            <telerik:SeriesMapping.ItemMappings>
                <telerik:ItemMapping DataPointMember="Open"
                                    FieldName="OpenPrice" />
                <telerik:ItemMapping DataPointMember="High"
                                    FieldName="HighPrice" />
                <telerik:ItemMapping DataPointMember="Low"
                                    FieldName="LowPrice" />
                <telerik:ItemMapping DataPointMember="Close"
                                    FieldName="ClosePrice" />
            </telerik:SeriesMapping.ItemMappings>
        </telerik:SeriesMapping>
    </telerik:RadChart.SeriesMappings>
</telerik:RadChart>

When I go into the designer and click the IsDateTime for the X Axis, I get a Microsoft .NET Framework exception: "Specified cast is not valid" with this callstack System.Windows.Markup.XamlParseException: Specified cast is not valid. ---> System.InvalidCastException: Specified cast is not valid.
   at MS.Internal.Designer.PropertyEditing.Resources.ResourceUtilities.GetDouble(FrameworkElement element, String key, Double fallbackValue)
   at MS.Internal.Designer.PropertyEditing.Resources.ResourceUtilities.GetDesiredTypeIconSize(FrameworkElement queryRoot)
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.RefreshQuickTypes()
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.RefreshVisuals()
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.OnPropertyEntryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.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.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(DependencyObject container, Object currentObject)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(Object createdObject, DependencyObject& rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
   at System.Windows.FrameworkTemplate.<>c__DisplayClass6.<LoadOptimizedTemplateContent>b__3(Object sender, XamlObjectEventArgs args)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(Object value)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
How do I make the X Axis a datetime without blowing out the designer?
Nikolay
Telerik team
 answered on 06 Apr 2011
1 answer
125 views
Hi Everyone, 

I am looking for a kml example to go off of.  When I follow the documentation i get nothing.  Does anyone have anything. 

Thanks, 

-zd
Andrey
Telerik team
 answered on 06 Apr 2011
8 answers
218 views
We are building an application that uses the MVVM pattern and Prism.
Our application utilizes Rad Docking Serialization.
The application has a DocumentHost with several tabbed Panes.  When a new Pane is added to the application inside the DocumentHost, it's not initially displayed after the docking serialization is read in.  But we hook a toggle button up to each pane to control visibility and clicking the button brings the new pane into view.
Here's the problem.
When we add a new Pane outside of the DocumentHost, the trick above doesn't work.  The pane will not be seen unless the serialization is deleted.

I found mention of using LayoutSerializationLoadingEventArgs but could not find an example.
Is there an event I can catch to add the new pane to the serialization?
Or should this just work, and there's something wrong with my implementation?
Thanks
George
Telerik team
 answered on 06 Apr 2011
6 answers
210 views
Hi,

I need to create gauges dynamically and put them in a WrapPanel. So I created a user control as follows:

<UserControl x:Class="WMITest.PercentUtilizationGauge" 
    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" 
    xmlns:local="clr-namespace:WMITest" 
    Height="300" Width="300">  
    <UserControl.Resources> 
        <local:GaugeSettings x:Key="DataSource"/>  
    </UserControl.Resources> 
    <telerik:RadGauge DataContext="{Binding Source={StaticResource DataSource}}">  
        <Grid> 
            <telerik:RadialGauge HorizontalAlignment="Stretch" VerticalAlignment="Stretch">  
                <telerik:RadialScale LabelRotationMode="None" Name="radialScale" Min="0" Max="100">  
                    <telerik:RangeList> 
                        <telerik:RadialRange Name="Green" Min="0" Max="{Binding GreenZoneEnd}" StartWidth="0.1" EndWidth="0.1" 
                                    Location="OverCenter" Background="Green" BorderBrush="Green" Opacity="0.8"/>  
                        <telerik:RadialRange Name="Yellow" Min="{Binding GreenZoneEnd}" Max="{Binding YellowZoneEnd}" StartWidth="0.1" EndWidth="0.1" 
                                    Location="OverCenter" Background="Yellow" BorderBrush="Yellow" Opacity="0.8"/>  
                        <telerik:RadialRange Name="Red" Min="{Binding YellowZoneEnd}" Max="100" StartWidth="0.1" EndWidth="0.1" 
                                    Location="OverCenter" Background="Red" BorderBrush="Red" Opacity="0.8"/>  
                    </telerik:RangeList> 
                    <telerik:IndicatorList> 
                        <telerik:Needle Opacity="0.8" Name="needle"/>  
                    </telerik:IndicatorList>                      
                </telerik:RadialScale> 
            </telerik:RadialGauge> 
        </Grid> 
    </telerik:RadGauge> 
</UserControl> 
The code behind looks like:
namespace WMITest  
{  
    /// <summary>  
    /// Interaction logic for PercentUtilizationGauge.xaml  
    /// </summary>  
    public partial class PercentUtilizationGauge : UserControl  
    {  
        public uint Value { getset; }  
        public GaugeSettings Settings;  
 
        public PercentUtilizationGauge()  
        {  
            if (Settings == null)  
            {  
                Settings = new GaugeSettings();  
            }  
 
            InitializeComponent();  
 
            Settings.GreenZoneEnd = 60;  
        }  
    }  
 
    public class GaugeSettings : INotifyPropertyChanged  
    {  
        private uint greenZoneEnd = 40;  
        public uint GreenZoneEnd  
        {  
            get 
            {  
                return greenZoneEnd;  
            }  
 
            set 
            {  
                greenZoneEnd = value;  
                OnPropertyChanged("GreenZoneEnd");  
            }  
        }  
 
        private uint yellowZoneEnd = 80;  
        public uint YellowZoneEnd  
        {  
            get 
            {  
                return yellowZoneEnd;  
            }  
 
            set 
            {  
                yellowZoneEnd = value;  
                OnPropertyChanged("YellowZoneEnd");  
            }  
        }
        #region INotifyCollectionChanged Members  
        public event PropertyChangedEventHandler PropertyChanged;  
        protected void OnPropertyChanged(string name)  
        {  
            PropertyChangedEventHandler handler = PropertyChanged;  
            if (handler != null)  
            {  
                handler(thisnew PropertyChangedEventArgs(name));  
            }  
        }
        #endregion  
    }  
It all works fine if I add just one PercentUtilizationGauge to the WrapPanel. However as soon as I add second PercentUtilizationGauge several excaptions of type System.InvalidOperationException are thrown:

A first chance exception of type 'System.InvalidOperationException' occurred in System.Core.dll

Additional information: Sequence contains no matching element


They all seem to occur in Telerik code - the call stack looks like:

> System.Core.dll!System.Linq.Enumerable.First<object>(System.Collections.Generic.IEnumerable<object> source, System.Func<object,bool> predicate) + 0x150 bytes 
  Telerik.Windows.Controls.Gauge.dll!Telerik.Windows.Controls.Gauges.ScaleBase.FindOffPosition(Telerik.Windows.Controls.Gauges.IGaugeIndicator indicator = {Telerik.Windows.Controls.Gauges.Needle}) Line 1930 + 0x7b bytes C#
  Telerik.Windows.Controls.Gauge.dll!Telerik.Windows.Controls.Gauges.RadialScale.ArrangeIndicator(Telerik.Windows.Controls.Gauges.IGaugeIndicator indicator = {Telerik.Windows.Controls.Gauges.Needle}) Line 314 + 0xc bytes C#
  Telerik.Windows.Controls.Gauge.dll!Telerik.Windows.Controls.Gauges.IndicatorBase.ArrangeOverride(System.Windows.Size finalSize = {162,30}) Line 1121 C#
  Telerik.Windows.Controls.Gauge.dll!Telerik.Windows.Controls.Gauges.Needle.ArrangeOverride(System.Windows.Size finalSize = {162,30}) Line 94 + 0x26 bytes C#

So how do I find out what is going wrong here? Any help would be greatly appreciated.
Thanks

-Ambar
Andrey
Telerik team
 answered on 06 Apr 2011
1 answer
118 views
Hi,

I have used RadTreelistview  in one my project to achive Parent,child relation(Plz check attached Image).

I want the action like when i click the parent checkbox the assosiated childnode checkboxes has to check in RadTreelistview .

Pn:I have identified IsTriState property in RadTreeview to achive this,but this property is not there in RadTreelistview


Please help me.
Vlad
Telerik team
 answered on 06 Apr 2011
4 answers
740 views
I have a RadGrid nested within another grid.  During the DataLoading event for the main outer grid, I have setup a RowLoaded event.  In this event, the click event for the checkboxes in the inner grid are wired to the appropriate method.  However, when I run the project the click event will not fire.  Any suggestions will be greatly appreciated.  Thank you.

<Window x:Class="FSPUpgradeServer.MainScreen"
        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"
        xmlns:fsp="clr-namespace:HarlandFS.FSP.Controls;assembly=FSPControls"
        Title="MainScreen"
        Height="500"
        Width="615">
    <Window.Resources>
        <Style TargetType="{x:Type telerik:GridViewRow}">
            <EventSetter Event="GotFocus"
                         Handler="GridViewRow_GotFocus"/>
        </Style>

    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="80*" />
            <ColumnDefinition Width="80*" />
            <ColumnDefinition Width="80*" />
            <ColumnDefinition Width="254*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="268*" />
            <RowDefinition Height="27*" />
            <RowDefinition Height="167*" />
        </Grid.RowDefinitions>
        <telerik:RadGridView Name="grdSystems"
                             AutoGenerateColumns="False"
                             IsFilteringAllowed="False"
                             ShowGroupPanel="False"
                             Grid.ColumnSpan="4"
                             Loaded="grdSystems_Loaded"
                             DataLoading="grdSystems_DataLoading">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="Upgrade"
                                            IsReorderable="False"
                                            UniqueName="Upgrade">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox Click="CheckBox_Click">
                            </CheckBox>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="System Name"
                                            IsReadOnly="True"
                                            IsReorderable="False"
                                            UniqueName="SystemName" />
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="# of Accts"
                                            IsReadOnly="True"
                                            IsReorderable="False"
                                            UniqueName="NumberOfAccounts"
                                            TextAlignment="Right" />
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="# of Terminals"
                                            IsReadOnly="True"
                                            IsReorderable="False"
                                            UniqueName="NumberOfTerminals"
                                            TextAlignment="Right" />
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="# of msgs sent"
                                            IsReadOnly="True"
                                            IsReorderable="False"
                                            UniqueName="NumberOfMsgSent"
                                            TextAlignment="Right" />
                <telerik:GridViewDataColumn Width="Auto"
                                            Header="# msgs received"
                                            IsReadOnly="True"
                                            IsReorderable="False"
                                            TextAlignment="Right" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <Button Name="btnAdd"
                Grid.Row="1"
                Click="btnAdd_Click">_Add</Button>
        <Button Name="btnEdit"
                Grid.Row="1"
                Grid.Column="1"
                Click="btnEdit_Click">_Edit</Button>
        <Button Name="btnDelete"
                Grid.Row="1"
                Grid.Column="2"
                Click="btnDelete_Click">_Delete</Button>
        <GroupBox Grid.Row="2"
                  Grid.ColumnSpan="4">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="27*" />
                    <RowDefinition Height="27*" />
                    <RowDefinition Height="27*" />
                    <RowDefinition Height="27*" />
                    <RowDefinition Height="27*" />
                    <RowDefinition Height="27*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="133*" />
                    <ColumnDefinition Width="100*" />
                    <ColumnDefinition Width="133*" />
                    <ColumnDefinition Width="100*" />
                </Grid.ColumnDefinitions>
                <Label VerticalAlignment="Center">File Location</Label>
                <fsp:FSPTextBox Name="txtClientLocation"
                                Grid.Column="1"
                                Margin="2"
                                LostFocus="txtClientLocation_LostFocus"
                                IsRequired="True"
                                Text=".\FSP.msi"
                                Grid.ColumnSpan="2" />
                <Button Name="btnBrowse"
                        Grid.Column="3"
                        Click="btnBrowse_Click"
                        Margin="2">_Browse</Button>
                <Label Grid.Row="1"
                       VerticalAlignment="Center">Host Location</Label>
                <fsp:FSPTextBox Name="txtHostLocation"
                                Grid.Row="1"
                                Grid.Column="1"
                                Margin="2"
                                IsRequired="True"
                                Grid.ColumnSpan="2" />
                <Label Grid.Row="2"
                       VerticalAlignment="Center">Version Number</Label>
                <fsp:FSPTextBox Name="txtVersion"
                                Grid.Row="2"
                                Grid.Column="1"
                                Margin="2"
                                IsRequired="True" />
                <Label Grid.Row="2"
                       Grid.Column="2"
                       VerticalAlignment="Center">Messages to send</Label>
                <fsp:FSPTextBox Name="txtMessages"
                                Grid.Row="2"
                                Grid.Column="3"
                                Margin="2"
                                IsRequired="True"
                                DataType="Integer" />
                <Label Grid.Row="3"
                       VerticalAlignment="Center">Time Interval(Minutes)</Label>
                <fsp:FSPTextBox Name="txtTimeInterval"
                                Grid.Row="3"
                                Grid.Column="1"
                                Margin="2"
                                IsRequired="True"
                                DataType="Integer" />
                <Button Name="btnStart"
                        Grid.Row="3"
                        Grid.Column="3"
                        Click="btnStart_Click">_Start</Button>
                <Label Name="lblStatus"
                       Grid.Row="4"
                       Grid.ColumnSpan="4"
                       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <ProgressBar Name="prgStatus"
                             Grid.Row="5"
                             Grid.ColumnSpan="4"
                             Margin="2" />
            </Grid>
        </GroupBox>
    </Grid>
</Window>

        public MainScreen()
        {
            InitializeComponent();

            messageTimer.Tick += new EventHandler(messageTimer_Tick);

            try
            {
                using (FileStream fs = new FileStream("FSPUpgradeAccounts.xml", FileMode.Open))
                {
                    SoapFormatter bf = new SoapFormatter();
                    ArrayList serializableList = bf.Deserialize(fs) as ArrayList;
                    //_AccountList = new ObservableCollection<FSPAccount>();

                    foreach (object item in serializableList)
                    {
                        FSPAccount addAccount = item as FSPAccount;
                        addAccount.GetTerminalList();
                        AccountList.Add(addAccount);
                    }
                }
            }
            catch
            {
            }
            //var detailDefinition = new Telerik.Windows.Controls.GridViewTableDefinition();
            //detailDefinition.Relation = new Telerik.Windows.Data.PropertyRelation("Terminals");
            //grdAccounts.TableDefinition.ChildTableDefinitions.Add(detailDefinition);
            //grdAccounts.ItemsSource = AccountList;
            var detailDefinition = new Telerik.Windows.Controls.GridViewTableDefinition();
            detailDefinition.Relation = new Telerik.Windows.Data.PropertyRelation("Accounts");
            grdSystems.TableDefinition.ChildTableDefinitions.Add(detailDefinition);
            grdSystems.ItemsSource = SystemList;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }

        private void grdSystems_DataLoading(object sender, GridViewDataLoadingEventArgs e)
        {
            var dataControl = (GridViewDataControl)sender;
            if (dataControl.ParentRow != null && dataControl.ChildTableDefinitions.Count == 0)
            {
                ObservableCollection<FSPAccount> account;
                try
                {
                    account = (ObservableCollection<FSPAccount>)e.ItemsSource;
                }
                catch
                {
                    //TODO:  Look for a better way to do this?
                    account = null;
                }
                if (account != null)
                {
                    //Setup relation to the Terminals sub grid
                    var detailDefinition = new Telerik.Windows.Controls.GridViewTableDefinition();
                    detailDefinition.Relation = new Telerik.Windows.Data.PropertyRelation("Terminals");

                    //Create the columns for the Accounts "sub grid"
                    GridViewDataColumn column = new GridViewDataColumn();
                    column.UniqueName = "Upgrade";
                    GridViewCell cell = new GridViewCell();
                    
                    dataControl.Columns.Add(column);
                    column = new GridViewDataColumn();
                    column.UniqueName = "Name";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    column = new GridViewDataColumn();
                    column.UniqueName = "TotalTerminals";
                    column.Header = "Number of Terminals";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    column = new GridViewDataColumn();
                    column.UniqueName = "SentTerminals";
                    column.Header = "#Sent";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    column = new GridViewDataColumn();
                    column.UniqueName = "ReceivedTerminals";
                    column.Header = "#Received";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    
                    //Set some properties on the Accounts sub grid
                    dataControl.ChildTableDefinitions.Add(detailDefinition);
                    dataControl.AutoGenerateColumns = false;
                    dataControl.ShowGroupPanel = false;
                    dataControl.IsFilteringAllowed = false;
                    dataControl.RowLoaded += new EventHandler<RowLoadedEventArgs>(dataControl_RowLoaded);
                    accountGridList.Add(dataControl);
                }
                else
                {
                    //Create columns for the Terminals sub grid
                    GridViewDataColumn column = new GridViewDataColumn();
                    column.UniqueName = "Name";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    column = new GridViewDataColumn();
                    column.UniqueName = "IsMessageSent";
                    column.Header = "Message Sent";
                    column.IsReadOnly = true;
                    dataControl.Columns.Add(column);
                    //dataControl.ChildTableDefinitions.Add(detailDefinition);

                    //Set some properties on the Terminals sub grid
                    dataControl.AutoGenerateColumns = false;
                    dataControl.ShowGroupPanel = false;
                    dataControl.IsFilteringAllowed = false;
                }
                //grdSystems.Rebind();
            }
        }

        void dataControl_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            if (e.Row is GridViewRow)
            {
                GridViewDataControl grid = (GridViewDataControl)sender;
                CheckBox chk = (CheckBox)e.Row.Cells[0].Content;
                chk.Click += new RoutedEventHandler(UpgradeAccount_Click);
            }
        }

        void UpgradeAccount_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("in Click");
        }
Ryan Bandouveres
Top achievements
Rank 1
 answered on 05 Apr 2011
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?