Telerik Forums
UI for WPF Forum
1 answer
48 views

Hi,

I am using Rad Controls for WPF Q2 of 2013, Also I am new to Telerik.

I would like to create 2 rows for a single record in the telerik rad grid view as attached. Is it possible to do the template in the XAML code itself ?

With Regards.
Siva

Maya
Telerik team
 answered on 02 Oct 2013
1 answer
58 views

Hi,

I am using Rad Controls for WPF Q2 of 2013, Also I am new to Telerik.

I would like to create 2 rows for a single record in the telerik rad grid view as attached. Is it possible to do the template in the XAML code itself ?

With Regards.
Siva

Maya
Telerik team
 answered on 02 Oct 2013
2 answers
161 views
Hello,

I am trying to implement a BusyIndicator when loading data into a RadCartesianChart.

I have this code:

<telerik:RadBusyIndicator Name="busyInd" HorizontalAlignment="Left"  Grid.Row="1" Margin="10,10,0,0" VerticalAlignment="Top" Height="255" Width="372" IsIndeterminate="True">
 
        <telerik:RadCartesianChart x:Name="CartesianChartDemo" Grid.Column="5" Margin="10" Grid.Row="2" Grid.ColumnSpan="3">
 
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior PanMode="Both" ZoomMode="Both"/>
            </telerik:RadCartesianChart.Behaviors>
 
        </telerik:RadCartesianChart>
 
</telerik:RadBusyIndicator>

I load data in the code behind file:

CartesianChartDemo.VerticalAxis = new CategoricalAxis();
            CartesianChartDemo.HorizontalAxis = new LinearAxis();
 
            CartesianChartDemo.Grid = new CartesianChartGrid() { MajorLinesVisibility = GridLineVisibility.XY };
 
            string strQuery = "MyQuery";
 
//Function to get datatable
            DataTable dtAlloys = DataRetriever.GetDataTable(strQuery);
            
            BarSeries barSer = new BarSeries();
            barSer.ShowLabels = true;
            barSer.CombineMode = ChartSeriesCombineMode.Cluster;
 
            BarSeries barSer2 = new BarSeries();
            barSer2.ShowLabels = true;
            barSer2.CombineMode = ChartSeriesCombineMode.Cluster;
 
            foreach (DataRow drAlloy in dtAlloys.Rows)
            {
                barSer.DataPoints.Add(new CategoricalDataPoint() { Category = drAlloy["MATERIAL_CODE"], Label = string.Format("{0:N}", drAlloy["WT"]), Value = double.Parse(drAlloy["WT"].ToString()) });
                barSer2.DataPoints.Add(new CategoricalDataPoint() { Category = drAlloy["MATERIAL_CODE"], Label = string.Format("{0:N}", drAlloy["TARG"]), Value = double.Parse(drAlloy["TARG"].ToString()) });
            }
 
            CartesianChartDemo.Series.Clear();
            CartesianChartDemo.Series.Add(barSer);
            CartesianChartDemo.Series.Add(barSer2);

I was thinking to add:

busyInd.IsBusy = true;
 
//Code to load data
 
 
busyInd.IsBusy = false;

But I'm not sure if this is the way the BusyIndicator works.

Does anyone has any pointers to accomplish that?

Regards,

Alberto


Yana
Telerik team
 answered on 02 Oct 2013
1 answer
181 views
Hi,
I'm developing with VS 2012 and Telerik control version 2013.2.724.40.
I tried to bind string values dynamically to the GridView in code.
The program first reads from a array, where it can decide the type of the column(e.g. string, double). If the data can be presented as a double value, then I create a customized GridView column with RadMaskedTextInput. I'd like to format the number by setting the Text property. The data binding works fine, however, it seems the numbers (e.g. 1000.1) are not shown as expected (e.g. 1,000.10). 

I could attach all source code if needed. Thanks in advance.

Regards,
Gong

public MainWindow()
{
    InitializeComponent();
 
    IList<DataHeader> headerList = DataService.Instance.HeaderList;
 
    for (int i = 0; i < headerList.Count; i++)
    {
        DataHeader curentHeader = headerList[i];
 
        GridViewBoundColumnBase column;
        if (curentHeader.Name == "AMOUNT")
        {
            column = new CGridViewNumColumn();
        }
        else
        {
            column = new GridViewDataColumn();
        }
 
        column.DataMemberBinding = new Binding("DataItemList[" + i + "]")
        {
            UpdateSourceTrigger = UpdateSourceTrigger.LostFocus
        };
        column.Header = curentHeader.Caption;
        column.UniqueName = curentHeader.Name;
        GridControl.Columns.Add(column);
    }
    DataContext = DataService.Instance.Data;
}


internal class CGridViewNumColumn : GridViewBoundColumnBase
    {
        public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            BindingTarget = RadMaskedTextInput.ValueProperty;
            var input = new RadMaskedTextInput
            {
                HorizontalContentAlignment = HorizontalAlignment.Right,
                Culture = CultureInfo.GetCultureInfo("en-GB"),
                FormatString = "n2",
                Mask = "",
                MinWidth = 100,
                SelectionOnFocus = SelectionOnFocus.SelectAll
            };
            input.SetBinding(BindingTarget, CreateValueBinding());
            input.LostFocus += InputOnLostFocus;
            return input;
        }
 
        private void InputOnLostFocus(object sender, RoutedEventArgs routedEventArgs)
        {
            var input = sender as RadMaskedTextInput;
            if (input == null) throw new ArgumentNullException("sender");
            if (string.IsNullOrWhiteSpace(input.Value))
            {
                input.Value = string.Empty;
                return;
            }
            double value;
            //Format the number for frontend.
            const NumberStyles style = NumberStyles.Float | NumberStyles.AllowThousands;
            if (!double.TryParse(input.Value, style, input.Culture, out value))
            {
                input.Value = "0";
            }
            input.Text = value.ToString(input.FormatString, input.Culture);
 
            //Format the number for back-end. Extra precisions will be removed.
            if (!double.TryParse(input.Text, style, input.Culture, out value))
            {
                input.Value = "0";
            }
            input.Value = value.ToString(input.Culture);
        }
 
        private Binding CreateValueBinding()
        {
            var valueBinding = new Binding
            {
                Mode = BindingMode.TwoWay,
                NotifyOnValidationError = true,
                ValidatesOnExceptions = true,
                Path = new PropertyPath(DataMemberBinding.Path.Path)
            };
 
            return valueBinding;
        }
    }

Dimitrina
Telerik team
 answered on 02 Oct 2013
5 answers
226 views
Hello everybody,

I have a dataform with some fields declared as nullable double (i.e. double?). When I start my application, it is OK I have empty fields for the nullable parameters. But if I start to fill one of these fields and then I delete what I have written, I cannot let the field empty again. The field is boxed with a red frame and a validation exception disables end edit button.

Do you have an explanation and a method to let my fields empty ? I tried to modify the validation exception but I cannot find where they are defined.

Thank you !

Regards,

Thomas
Yoan
Telerik team
 answered on 01 Oct 2013
10 answers
259 views
Is there a way to change simple elements that are nested inside the ScheduleView's ControlTemplate, like NavigationHeader -- for example the border's background colour--using Style Setters?

Example: I'd like to apply the Windows8 theme, and then specify a different colour for NavigationHeader.

It seems a shame to generate the ControlTemplate's 6100 some-odd lines of XAML to change some minor elements in the ScheduleView's ControlTemplate.
Kalin
Telerik team
 answered on 01 Oct 2013
5 answers
113 views
Hello everyone,

 I am facing an issue using DataForm. I have an  abstract class IBacktestOption and several inherited classes. Let's take only two of them : OptionCall and CallSpread. These classes share 4 arguments with IBacktestOption and have their own arguments.

Here is the IBacktestOption class :
public abstract class IBacktestOption
   {
       #region fields
 
       private double mGearing;
       public double Gearing { get { return mGearing; } set { mGearing = value; } }
 
       private double? mGlobalCap;
       public double? GlobalCap { get { return mGlobalCap; } set { mGlobalCap = value; } }
 
       private double? mGlobalFloor;
       public double? GlobalFloor { get { return mGlobalFloor; } set { mGlobalFloor = value; } }
 
       public string Nom { get; set; }
 
 
       #endregion
 
       protected IBacktestOption(double aGearing, double? aGlobalCap, double? aGlobalFloor)
       {
           Gearing = aGearing;
           GlobalCap = aGlobalCap;
           GlobalFloor = aGlobalFloor;
       }
 
       public abstract Dictionary<DateTime, IResultatsBacktest> GetOptionResults(IBacktesting backtest);
 
       public abstract bool CheckOption();
 
   }



This is OptionCall class :
class OptionCall : IBacktestOption, IEditableObject, INotifyPropertyChanged
    {
 
        #region fields
 
        private double mStrike;
        public double Strike { get { return mStrike; } set { mStrike = value; } }
 
        OptionCallData backupOptParamData;
        private int mID;
 
        public struct OptionCallData
        {
            internal int ID;
            internal double Strike;
            internal double? CapGlobal;
            internal double? FloorGlobal;
            internal double Gearing;
        }
 
        public int ID
        {
            get { return mID; }
        }
 
        #endregion Fields
 
        #region constructors
 
        public static OptionCall CreateNewOptionCall(double strike, double gearing = 1, double? cap = null, double? floor = null)
        {
            return new OptionCall(strike,gearing,cap,floor);
        }
 
        public OptionCall(double strike, double gearing = 1, double? cap = null, double? floor = null) : base(gearing,cap,floor)
        {
            Strike = strike;
            Nom = "Call";
        }
 
        #endregion
 
        public override Dictionary<DateTime, IResultatsBacktest> GetOptionResults(IBacktesting backtest)
        {
            /* ... */
        }
 
        public override bool CheckOption()
        {
            return true;
        }
 
        #region Edition
 
        public void BeginEdit()
        {
 
        }
 
        public void CancelEdit()
        {
            mStrike = this.backupOptParamData.Strike;
            GlobalCap = this.backupOptParamData.CapGlobal;
            GlobalFloor = this.backupOptParamData.FloorGlobal;
            Gearing = this.backupOptParamData.Gearing;
        }
 
        public void EndEdit()
        {
            this.backupOptParamData.Strike = mStrike;
            this.backupOptParamData.CapGlobal = GlobalCap;
            this.backupOptParamData.FloorGlobal = GlobalFloor;
            this.backupOptParamData.Gearing = Gearing;
        }
 
 
        #endregion Edition
 
 
        #region Events
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
 
        #endregion Events
 
 
    }

This is CallSpread class :
class CallSpread : IBacktestOption, IEditableObject, INotifyPropertyChanged
   {
       #region fields
 
       private double mStrike1;
       public double Strike1 { get { return mStrike1; } set { mStrike1 = value; } }
        
       private double mStrike2;
       public double Strike2 { get { return mStrike2; } set { mStrike2 = value; } }
 
       OptionCallData backupOptParamData;
       private int mID;
 
       public struct OptionCallData
       {
           internal int ID;
           internal double Strike1;
           internal double Strike2;
           internal double? CapGlobal;
           internal double? FloorGlobal;
           internal double Gearing;
       }
 
       public int ID
       {
           get { return mID; }
       }
 
 
 
       #endregion Fields
 
       #region constructors
 
       public static CallSpread CreateNewCallSpread(double strike1, double strike2, double gearing = 1, double? cap = null, double? floor = null)
       {
           return new CallSpread(strike1, strike2, gearing, cap, floor);
       }
 
       public CallSpread(double strike1, double strike2, double gearing = 1, double? cap = null, double? floor = null) : base(gearing,cap,floor)
       {
           Strike1 = Math.Min(strike1, strike2);
           Strike2 = Math.Max(strike1, strike2);
           Nom = "Call Spread";
       }
 
       #endregion
 
       public override Dictionary<DateTime, IResultatsBacktest> GetOptionResults(IBacktesting backtest)
       {
           /* ... */
       }
 
       public override bool CheckOption()
       {
           return true;
       }
 
 
       #region Edition
 
       public void BeginEdit()
       {
 
       }
 
       public void CancelEdit()
       {
           mStrike1 = this.backupOptParamData.Strike1;
           mStrike2 = this.backupOptParamData.Strike2;
           GlobalCap = this.backupOptParamData.CapGlobal;
           GlobalFloor = this.backupOptParamData.FloorGlobal;
           Gearing = this.backupOptParamData.Gearing;
       }
 
       public void EndEdit()
       {
           this.backupOptParamData.Strike1 = mStrike1;
           this.backupOptParamData.Strike2 = mStrike2;
           this.backupOptParamData.CapGlobal = GlobalCap;
           this.backupOptParamData.FloorGlobal = GlobalFloor;
           this.backupOptParamData.Gearing = Gearing;
       }
 
 
       #endregion Edition
 
 
       #region Events
 
       public event PropertyChangedEventHandler PropertyChanged;
 
       private void NotifyPropertyChanged(string info)
       {
           if (PropertyChanged != null)
               PropertyChanged(this, new PropertyChangedEventArgs(info));
       }
 
       #endregion Events
 
   }

In my view I have my DataForm declare like this :
<telerik:RadDataForm Grid.Column="1" Margin="12,0,6,21" Grid.ColumnSpan="2" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  ItemsSource="{Binding BacktestOpt}"
                                         CommandButtonsVisibility="Cancel,Commit,Edit,Navigation" Grid.Row="1" Height="456" Grid.RowSpan="2" />

And in my view model I initialize my Collection (I use a ViList, which is a structure almost equivalent to a simple List) with an element of OptionCall type :

private ViList<IBacktestOption> mBacktestOpt;
       public ViList<IBacktestOption> BacktestOpt
       {
           get
           {
               if (mBacktestOpt == null && Formule == 0)
               {
                   ViList<IBacktestOption> newBacktestOpt = new ViList<IBacktestOption>();
                   newBacktestOpt.Add(Creators.CreateNewOptionCall(0));
                   this.mBacktestOpt = new ViList<IBacktestOption>(newBacktestOpt);
                   Formule = PayoffFormule.CALL;
               }
               return mBacktestOpt;
           }
           set
           {
               mBacktestOpt = value;
               OnPropertyChanged("BacktestOpt");
           }
       }


When I start my application, everything is fine, I have what I want i.e. my DataForm with my 6 fields : "Strike", "ID", "Gearing", "GlobalCap", "GlobalFloor", "Nom".
In my page, I also have a RadComboBox which enables me to choose which formula I want to use. This combobox is binded to this field in my view model :
private PayoffFormule mFormule;
        public PayoffFormule Formule
        {
            get { return mFormule; }
            set
            {
                mFormule = value;            
                switch (mFormule)
                {
                    case PayoffFormule.CALL :
                        Backtest.Option = Creators.CreateNewOptionCall(0);
                        break;
                    case PayoffFormule.PUT :
                        Backtest.Option = Creators.CreateNewOptionPut(0);
                        break;
                    case PayoffFormule.ASIAN_CALL:
                        Backtest.Option = Creators.CreateNewAsianCall(0);
                        break;
                    case PayoffFormule.ASIAN_PUT:
                        Backtest.Option = Creators.CreateNewAsianPut(0);
                        break;
                    case PayoffFormule.CALL_SPREAD:
                        Backtest.Option = Creators.CreateNewCallSpread(0,0.15);
                        break;
                    default:
                        break;
                }
                BacktestOpt.Add(Backtest.Option);
                OnPropertyChanged("BacktestOpt");
                OnPropertyChanged("Formule");
            }
        }

When I use the ComboBox to change the formula, a new element is added to the DataForm and here is my issue : this new element only have the fields of IBacktestOption class. And when I use Navigation buttons to go back on my first element (OptionCall), the number of fields of the element have been reduced to 4 ("Gearing", "GlobalCap", "GlobalFloor", "Nom").

I want to know if it is possible to have the fields of the inherited classes instead of the ones of IBacktestOption.


Moreover, in reality I don't need to have a list of IBacktestOption in my DataForm, I only need to have the current option (the one which is selected in the combobox). So, I have tried to empty my List when I change the option type in the combobox :
private PayoffFormule mFormule;
       public PayoffFormule Formule
       {
           get { return mFormule; }
           set
           {
               mFormule = value;         
               BacktestOpt.RemoveAt(0);
               switch (mFormule)
               {
                   case PayoffFormule.CALL :
                       Backtest.Option = Creators.CreateNewOptionCall(0);
                       break;
                   case PayoffFormule.PUT :
                       Backtest.Option = Creators.CreateNewOptionPut(0);
                       break;
                   case PayoffFormule.ASIAN_CALL:
                       Backtest.Option = Creators.CreateNewAsianCall(0);
                       break;
                   case PayoffFormule.ASIAN_PUT:
                       Backtest.Option = Creators.CreateNewAsianPut(0);
                       break;
                   case PayoffFormule.CALL_SPREAD:
                       Backtest.Option = Creators.CreateNewCallSpread(0,0.15);
                       break;
                   default:
                       break;
               }
               BacktestOpt.Add(Backtest.Option);
               OnPropertyChanged("BacktestOpt");
               OnPropertyChanged("Formule");
           }
       }

It works, I have the good number of fields for each option type. But, I need to click on the Next Item Navigation Button to reach my element. Indeed, the first one is empty. It is not really handy for a user. So, I also want to know if there is a way to click on this button automatically.

Finally, I have a last request. As, I don't really need a List for my elements, I tried to use a IBacktestOption instead of a ViList<IBacktestOption> in BactestOpt field. But I didn't manage to have fields printed in DataForm, the DataForm was empty...

Thank you very much for your help.
Regards,

Thomas
Thomas
Top achievements
Rank 1
 answered on 01 Oct 2013
3 answers
112 views
Hello,

we are trying to connect this control to sybase iq database in order to improve the performance using OLAP technology, but the control's connectión only defines an user, password an query that execute a full scan read, so the perfrmance is not so good,

Do you know any solution to make a good connection to Sybase IQ?

Thanking in advance,

Regards,



Rosen Vladimirov
Telerik team
 answered on 01 Oct 2013
1 answer
80 views
I have a GridView where the GridViewColumns are created dynamically. We now have data in a column that can sometimes be null. I have kind of figured out how to use the Converter from the binding to change the value based on the value coming in - but this did not fix it. When I click on the filter It throws the error that must be of type Int64.

Here is the code that builds the column:
GridViewDataColumn col = new GridViewDataColumn();               
                col.Header = column.Name;               
                col.DataMemberBinding = binding;               
                col.DataType = column.DataType;                               
                col.IsSortable = true;
 
                if (column.DataType == typeof(Int64))
                {
                    col.DataMemberBinding.Converter = new LongConverter();
                }
 Here is the converter: 
public class LongConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //Int64? convertedValue = (Int64)value;
            //if (convertedValue.HasValue)
            //{
            //    return convertedValue.Value;
            //}
            //else
            //{
            //    return "";
            //}
 
            return "N/A";
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value.ToString().ToUpper() == string.Empty)
            {
                return new Int64();
            }
            else
            {
                return Int64.Parse(value.ToString());
            }
        }
    }
You can see I commented all most of the code out on the converter. I was just trying to get it to work. The value was coming back as the type - so I'm not sure whats going on there.

So I really have to issues here:
1) How to properly set the converter on the column datamember binding.
2) Why does the filter still recognize the null value even though I set the value to "N/A"
Dimitrina
Telerik team
 answered on 01 Oct 2013
3 answers
87 views

I have a grid that we need to bold the text when the value changes...the code Im using is in the CellEditEnded event handler:

void GridView_CellEditEnded(object sender, GridViewCellEditEndedEventArgs)
{
if(e.NewData != e.OldData)
{
e.Cell.FontWeight = FontWeights.Bold;
}



This works fine...BUT when I switch rows the style goes back to its original style. My use case requires that ALL changed values remain bolded.

How can I achieve this?

Thanks,
Ron
Dimitrina
Telerik team
 answered on 01 Oct 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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?