Telerik Forums
UI for WPF Forum
2 answers
429 views
Hello All,

We are in the process of converting the plain old WPF TabControl with the RadTabControl.  We have a need to get the last tab that was selected before the user clicked a new tab.

Using the WPF TabControl, in the EventArgs, there was an AddedItems and RemovedItems property.  In the RadTabControl, these do not exist.

Is there a way to get the user's last selected TabItem using this handler?

Thanks,
Chris
Chris Andrews
Top achievements
Rank 1
 answered on 09 Jul 2010
7 answers
248 views
Hello everybody

After doing researches in all available source I still can not accomplish this probably trivial task. I would like to read the values of various cells of the row which is selected. The sample I found in this forum deals with a business object (Person). I'd expected something like:

myValue = gridview.selectedRow.Columns("NameOfThisColumn")

Thanks for your help in advance

Michael Lutz
BITsoft
Vlad
Telerik team
 answered on 09 Jul 2010
7 answers
218 views
Hello Everybody

I would like to be able to create custom groupings that allow users to group by a range of values rather than by a specific value of a particular member.  For example, if there is a "severity" column that has integer values from 0-199, I'd like to be able to create 2 groups of severity 0-99 and 100-199 instead of the default of 200 groups, one for severity 1, one for severity 2, etc.

I've hunted through the docs and it looks like I may be able to extend from Telerik.Windows.Data.GroupDescriptor to achieve my goal, but the documentation on the subject is not very helpful.  Can anyone explain how the GroupDescriptor class creates a grouping, or even better, provide code examples of how its done?

Thanks,
Tom
Pavel Pavlov
Telerik team
 answered on 09 Jul 2010
3 answers
626 views
Hello,

How can I get the location (latitude and longitude coordinates) for the point beneath the mouse cursor?

Thank you.
Andrey
Telerik team
 answered on 09 Jul 2010
3 answers
125 views
Hi,

I'm testing out this library and I'm getting the following error:
No method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied arguments.

I'm doing a very simple test. Here is the relevant code:

public class Data     
{     
    public UInt32 XValue { getset; }     
    public double YValue { getset; }     
}     
    
List<Data> m_Data; // This is initialized with data.     
    
// Then, when setting up the chart...     
    
SeriesMapping seriesMapping = new SeriesMapping();     
LineSeriesDefinition lineDefinition = new LineSeriesDefinition();     
lineDefinition.ShowItemLabels = false;     
seriesMapping.SeriesDefinition = lineDefinition;     
seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));  
seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));     
MyChart.SeriesMappings.Add(seriesMapping);     
    
// Then I set my data     
MyChart.ItemSource = m_Data; 

When m_Data has more then 397 elements it throws that error. Before that number it looks pretty.

Any help will be greatly appreciated.
- Luis
Ves
Telerik team
 answered on 09 Jul 2010
3 answers
140 views
Is it possible to show a value that is not part of the ItemsSource of the combobox? My observablecollection contains 1,2,3,4, but the value I have assigned to the databound field is 10.

Below is my current column setup.
<telerik:GridViewComboBoxColumn Header="Weld ID" x:Name="ddWeldID" DataMemberBinding="{Binding WeldID}" DisplayMemberPath="WeldID" SelectedValueMemberPath="WeldID" 
                                                    IsComboBoxEditable="True" /> 


WeldID contains the value 24, but the ItemsSource I bind to the combobox contains the values 1,2,3,4. When I load the grid, 24 is not displayed in the column, but if I add the value 24 as one of the dropdown options, it gets displayed in the column.

Any help would be much appreciated!

Ryan
Pavel Pavlov
Telerik team
 answered on 09 Jul 2010
2 answers
122 views
Hi,

Instead of the more usual technical question, this post is related to functional requirements, and choosing among different implementations. I hope I can keep it as short as possible, not too philosophical, and of course, raise interest/curiosity among some of you ;-)

We are currently building a Framework in order to ease and speed up the development of certain kind of applications. We have decided to create a custom control library (using telerik as base) that must fulfill the following requirementes:

1.- Provide just the properties/events (Controls) that we consider necessary. --hiding attributes--
2.- Extend the base controls in order to add extra functionallity. --creating new attributes--
3.- Ease the implementation of our interfaces. By dragging a control from the VisualStudio (or Blend) designer toolbox to the window/page/usercontrol/etc, the developer will have most of the necessary attributes (see req. 1) with the proper default values.
4.- The controls must support all the standard (graphic) features of WPF: Styling, Control Templates, Storyboards, etc.
5.- The controls must support standard event handling, although we might use a fancier action/commanding approach (like the ones implemented by Prism, or Caliburn)
6.- DataBindings.

After some research, we came up with three solutions (summarized, as I'm trying to keep this as short as possible):

A) Wrapping the control: using Control as base class, we add the telerik control as the first (and only) visual child. Then we create a DependencyProperty for each DP we want to expose from the telerik control.
public class MyComboBox : MyBaseControl  
{  
    static MyComboBox()  
    {  
        DefaultStyleKeyProperty.OverrideMetadata(typeof(MyComboBox), new FrameworkPropertyMetadata(typeof(MyComboBox)));  
  
        RegisterDependencyProperties(typeof(MyComboBox), typeof(RadComboBox));  
    }  
  
    public MyComboBox()  
    {  
        InternalFrameworkElement = new RadButton();  
  
        this.AddVisualChild(InternalFrameworkElement);  
    }  
    protected override int VisualChildrenCount  
    {  
        get  
        {  
            return InternalFrameworkElement == null ? 0 : 1;  
        }  
    }  
    protected override Visual GetVisualChild(int index)  
    {  
        if (InternalFrameworkElement == null)  
        {  
            throw new ArgumentOutOfRangeException();  
        }  
        return InternalFrameworkElement;  
    }  
    private RadComboBox ComboBox  
    {  
        get  
        {  
            return InternalFrameworkElement as RadComboBox;  
        }  
    }  
    public IEnumerable ItemsSource  
    {  
        get { return (IEnumerable)GetValue(ItemsSourceProperty); }  
        set { SetValue(ItemsSourceProperty, value); }  
    }  
  
    public static readonly DependencyProperty ItemsSourceProperty =  
        DependencyProperty.Register(  
            "ItemsSource"typeof(IEnumerable), typeof(MyComboBox),  
            new FrameworkPropertyMetadata  
            {  
                PropertyChangedCallback = (obj, e) =>  
                {  
                    (obj as MyComboBox).UpdateItemsSource((IEnumerable)e.NewValue);  
                }  
            });  
  
    private void UpdateItemsSource(IEnumerable sel)  
    {  
        ComboBox.ItemsSource = sel;  
    }  
}  
 
(its much more elaborated, and I didn't copy all the code, but you get the basic idea)

B) Control templating: using Control as base class, we redefine the default styles of each control. The template (ControlTemplate) property is assigned to the telerik control. Then we create a TemplateBinding (or complete Binding, depends...) for each DP we want to expose. The DP is also created in the Control:
<Setter Property="Template">  
    <Setter.Value>  
        <ControlTemplate TargetType="{x:Type local:MyComboBox}">  
            <ControlsInput:RadComboBox Name="PART_MyComboBox"  
                BorderBrush="{TemplateBinding Property=BorderBrush}"  
                BorderThickness="{TemplateBinding Property=BorderThickness}"  
                Background="{TemplateBinding Property=Background}"  
                Foreground="{TemplateBinding Property=Foreground}"  
                SelectionBoxTemplate="{TemplateBinding Property=SelectionBoxTemplate}"  
                ItemTemplate="{TemplateBinding Property=ItemTemplate}"  
                SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor,   
                AncestorType={x:Type local:MyComboBox}}, Path=SelectedItem}"  
                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,   
                AncestorType={x:Type local:MyComboBox}}, Path=ItemsSource}">  
            </ControlsInput:RadComboBox>  
        </ControlTemplate>  
    </Setter.Value>  
</Setter>  
(again, its much more elaborated)

C) Directly inheriting the telerik control. (we loose the req. 1, hiding attributes)

public class MyComboBox : RadComboBox  
{  
    static MyComboBox()  
    {  
        DefaultStyleKeyProperty.OverrideMetadata(typeof(MyComboBox), new FrameworkPropertyMetadata(typeof(MyComboBox)));  
    }  
}  


In summary:
- Solution A (wrapper) is somehow ugly, and uses a lot of tricks in order to do things such as:
    - Creating data bindings (from XAML)
    - Using CustomTemplates (from the final developer point of view)
    - Create data bindings from code behind.

- Solution B is more elegant (they are pretty much the same thing, as they generate the same logical tree for each control), but I'm not sure how difficult it will be to wrap complex controls, such as the GridView, Ribbon, etc.

- Solution C basically breaks with one of the initial requirements, but its still a valid approach. Besides, you can somehow suggest what properties to use by implementing the Extensibility Model for the WPF Designer.

My questions are:

    * What is the best approach, given the scenario I exposed?
    * Any other ideas/suggestions?


By the way, we need to provide the same control libraries for Silverlight and ASP.net, and it would be nice to use the same approach, at least with WPF and SL.

Thanks,


--
R.
Roberto
Top achievements
Rank 1
 answered on 09 Jul 2010
1 answer
101 views
I am using a GridView with RowDetails.
I have a GridViewSelectcolumn.
Now whenever I select a row( check the checkbox) the rowdetails is expanded.
I do not want the row details to expand when the checkbox is checked. It should only expand/collapse through GridViewToggleRowDetailsColumn +/-

How to achieve such functionality>
Milan
Telerik team
 answered on 09 Jul 2010
9 answers
437 views
I wish to filter data in a gridview upon clicking a button.
I do not want to include filtering under header column row.

P.S. I got it working


Yavor Georgiev
Telerik team
 answered on 08 Jul 2010
7 answers
139 views
I am running into an issue when using the Gridview. I have a Gridview which has the columns defined declaratively in the xaml. There are several controls such as buttons, checkboxes, etc... in the column definitions. I use the GridViewColumns as illustrated below:

                    <telerik:GridViewColumn> 
                                <telerik:GridViewColumn.CellTemplate> 
                                    <DataTemplate> 
                                        <CheckBox VerticalAlignment="Center" x:Name="NextQueue"></CheckBox> 
                                    </DataTemplate> 
                                </telerik:GridViewColumn.CellTemplate> 
                            </telerik:GridViewColumn> 

I set the commandparameters of these elements in the rowloaded event on the GridView. Everything works fine until I scroll the gridview. The rowloaded event throws multiple errors. It appears that several of the elements that are available when the row loaded event first fires are not available when the rowloaded event fires when the scrollbar is used. For example here is how I access one of the checkboxes in the rowloaded:

var row = e.Row as GridViewRow; 
 
var selectedButton = row.Cells[0].ChildrenOfType<CheckBox>()[0]; 
selectedButton.CommandParameter = targetDub; 

When this runs when the grid is initially loaded it works fine. As soon as the user scrolls the grid it throws an exception because the row.Cells[0].ChildrenOfType<CheckBox>() returns a count of 0. This is the case when I try to find any of the controls on that row.

What could be causing this?

Richard Averett
Top achievements
Rank 1
 answered on 08 Jul 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
Slider
Expander
TileList
PersistenceFramework
DataPager
TimeBar
Styling
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
CardView
DataBar
WebCam
FilePathPicker
Licensing
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?