Telerik Forums
UI for WPF Forum
1 answer
180 views
HI, I want to use GridViewComboBoxColumn in a radgridview. But I found if I use RadWindow to hold the radgridview, the combobox dropdown list could not show. However, it could work if I create my own window.
Please see my attachment code.
 public class Player
    {
        public string Name
        {
            get;
            set;
        }
 
        public Position Position
        {
        get;
        set;
        }
 
        public Player(string name, Position pos)
        {
            Name = name;
            Position = pos;
        }
    
    }
 public enum Position
    {
        [Description("China")]
        GB,
        [Description("Unite Kingdom")]
        UK,
        [Description("Unite States")]
        US
    }
public class ViewModel
    {
        private List<Player> allPlayers;
        public ObservableCollection<Player> AllPlayers
        {
            get
            {
                if (this.allPlayers == null)
                {
                    this.allPlayers = new List<Player>();
                    this.allPlayers.Add(new Player("Haibng"Position.GB));
                    this.allPlayers.Add(new Player("WHS"Position.UK));
                    this.allPlayers.Add(new Player("NY"Position.US));
 
                }
                return new ObservableCollection<Player>(this.allPlayers);
            }
        }
 
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> Positions
        {
            get
            {
                return Telerik.Windows.Data.EnumDataSource.FromType<Position>();
            }
        }
    }




<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        >    
    <StackPanel>    
        <Button Content="Show Combo in RadWindow" Click="Button_Click" Width="180" Height="30" Margin="10,10,10,10"/>
        <Button Content="Show Combo in Comm Window" Click="Button2_Click" Width="180" Height="30" Margin="10,10,10,10"/>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView>
    </StackPanel> 
</Window>
public partial class MainWindow : Window
    {
        
        public MainWindow()
        {
            InitializeComponent();
          
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
 
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RadWin u = new RadWin();
            u.Owner = this;
            u.ShowDialog();
        }        
 
        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            MyWin w = new MyWin();
            w.Owner = this;
            w.ShowInTaskbar = false;
            w.ShowDialog();
        }
    }




<telerik:RadWindow x:Class="WpfApplication1.RadWin"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns>
 
        </telerik:RadGridView>
        <telerik:RadToolBar>
            <telerik:RadComboBox Name="graphModes" Width="250" Height="22" Margin="3">
                <ComboBoxItem>One</ComboBoxItem>
                <ComboBoxItem>Two</ComboBoxItem>
                <ComboBoxItem>Three</ComboBoxItem>
            </telerik:RadComboBox>
        </telerik:RadToolBar>
    </Grid>
</telerik:RadWindow>
 public partial class RadWin : RadWindow
    {
        public RadWin()
        {
            InitializeComponent();
            this.Width = 400;
            this.Height = 450;
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
            
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
    }



<Window x:Class="WpfApplication1.MyWin"
        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"        
        Title="MyWin" Height="300" Width="300">
    <Grid>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
 
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns>
 
        </telerik:RadGridView>
    </Grid>
</Window>
 public partial class MyWin : Window
    {
        public MyWin()
        {
            InitializeComponent();
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
 
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
    }


<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
         
    </Application.Resources>
</Application>
    public partial class App : Application
    {
    }
Miroslav Nedyalkov
Telerik team
 answered on 19 Oct 2011
1 answer
175 views
Hello!
There are about six months since I've worked last time for a project that is using Telerik's dlls.
Now I have my hands back on it, and the first thing I tried to do was to update Telerik's libraries...
one thing I've noticed (and I bet there are others) is that my context menu for charts has disappeared - vanished - gone!
I'm now looking in your documentation and tutorials - and you are explaining how to add context menus to bars or other items in charts
but this is not the point! I had a general context menu for the entire chart that is now shown anymore when I'm right clicking the chart...

<telerik:RadChart Name="telerikChart" >
     <telerik:RadChart.DefaultSeriesDefinition>
         <Charting:ScatterSeriesDefinition />
     </telerik:RadChart.DefaultSeriesDefinition>
     <Controls:RadContextMenu.ContextMenu>
         <Controls:RadContextMenu x:Name="chartContextMenu">
             <Controls:RadMenuItem Name="miTooltipFormat"
                                   Header="Precision" />               
             <Controls:RadMenuItem Name="miXStrip"
                                   Header="X axis strip lines"
                                   IsCheckable="True"
                                   Checked="miXStrip_Checked"
                                   Unchecked="miXStrip_Checked"/>
             <Controls:RadMenuItem Name="miYStrip"
                                   Header="Y axis strip lines"
                                   IsCheckable="True"
                                   Checked="miYStrip_Checked"
                                   Unchecked="miYStrip_Checked" />    
             <Controls:RadMenuItem Name="miExport"
                                   Header="Export"
                                   Click="ctxExportMenuItem_Click"/>
         </Controls:RadContextMenu>
     </Controls:RadContextMenu.ContextMenu>
 </telerik:RadChart>

Is there something that I am missing here?

Thank you!
R

Evgenia
Telerik team
 answered on 19 Oct 2011
3 answers
207 views
Hi I am using RadChart control with 2 series:
1. BubbleSeries
2. LineSeries.
The line series is used as regression line for all points found in BubbleSeries. The issue that I am facing is inability to "accurately" display the regression line. The regression line contains only two points; the y-intercept and the datapoint with max visible x value. The interpolation between those points is non existent. 
For example, when I have 2 points, the regression line just simply goes through those 2 points - dead on. However, it does not. I was thinking that I could start adjusting the YScale manually so that the points in BubbleSeries appeared to be on the line -> before I dig into that I wanted to ask and see if there is a better solution out there.

Attached is the the chart I am taking about; the point 1 and 4 lie directly on the line, however visually they don't appear. Ignore the points 2, 3, 5 -> in this case there are not used in calculating the points for LineSeries.

https://docs.google.com/leaf?id=0B-bulDANY3zRMDM2YmY3NGItY2M3NC00ZGVmLWIzOGYtYWFmZjYwNzFjODI3&hl=en_US


Thanks.
Yavor
Telerik team
 answered on 19 Oct 2011
3 answers
166 views
Hi,

I am working on an application where I need to dynamically hide/unhide the columns. I have implemented that functionality. However, after hiding a few columns at runtime, if I try to reorder column by dragging dropping the columns, the RadGridView adds blank columns at the hidden columns' places. I have created a small sample demonstrating the issue.

Xaml File:
<Window x:Class="AbstractionPOC.Window1"
        Title="Window1" Height="500" Width="900"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <StackPanel>
        <ComboBox x:Name="viewFields" Grid.Column="2" ItemsSource="{Binding Columns, ElementName=orderView}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox Content="{Binding Header}"
                          IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <telerik:RadGridView      Grid.Row="1" Grid.ColumnSpan="4" x:Name="orderView"      
                SelectionMode="Extended"  EditTriggers="None" AutoGenerateColumns="True"  >
        </telerik:RadGridView>
    </StackPanel>
</Window>

Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
 
namespace AbstractionPOC
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public ObservableCollection<CustomerOrder> CustomerOrders
        {
            get;
            set;
        }
 
        public Window1()
        {
            InitializeComponent();
            CustomerOrders = new ObservableCollection<CustomerOrder>
            {
                new CustomerOrder() {CustomerName="David Blaine", CustomerPONumber="PO123", PharmacyNotes="Some Pharmacy Notes", PrescriptionNumber="12345", ProductName="Cetrizine", ShipToId=387541},
                new CustomerOrder() {CustomerName="John Ruth", CustomerPONumber="PO654", PharmacyNotes="Some Other Notes", PrescriptionNumber="67890", ProductName="Brufen", ShipToId=12387},
                new CustomerOrder() {CustomerName="Jane Doe", CustomerPONumber="PO325", PharmacyNotes="More Pharmacy Notes", PrescriptionNumber="54321", ProductName="Crocin", ShipToId=65879},
                new CustomerOrder() {CustomerName="Robert Frost", CustomerPONumber="PO698", PharmacyNotes="Some More Notes", PrescriptionNumber="19875", ProductName="Paracetamole", ShipToId=234578},
                new CustomerOrder() {CustomerName="Tim Ferriss", CustomerPONumber="PO568", PharmacyNotes="Some Notes", PrescriptionNumber="15485", ProductName="Tetracycline", ShipToId=286541},
            };
 
            orderView.ItemsSource = CustomerOrders;
        }
    }
}

CustomerOrder class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace AbstractionPOC
{
    public class CustomerOrder
    {
        public string CustomerName
        {
            get;
            set;
        }
 
        public string ProductName
        {
            get;
            set;
        }
 
 
        public string PharmacyNotes
        {
            get;
            set;
        }
 
        public string CustomerPONumber
        {
            get;
            set;
        }
 
        public string PrescriptionNumber
        {
            get;
            set;
        }
 
        public long ShipToId
        {
            get;
            set;
        }
    }
}

Now, at runtime I can show/hide a column by opening the combobox and checking/unchecking the checkbox for any column. However, after hiding the column, if I try to reorder the column, the gridview adds a blank column. For example, after hiding the CustomerPONumber column, if I drag the ShipToId column and place it after ProductName column, the gridview add a blank column after PharmacyNotes column(where the hidden column was before hiding).

Please help. All inputs are appreciated.

Thanks,
Jaspreet Singh.


Jaspreet
Top achievements
Rank 1
 answered on 19 Oct 2011
2 answers
232 views
Hi there,

When I place a readonly RadRichTextBoxes as template inside a RadCarousel and the focus is on the RadRichTextBox, the scroll wheel scrolls RadCarousel instead of the content inside the RadRichTextBox.  When I put a FlowDocumentViewer in place of the RadRichTextBox,  the scroll wheel scrolls correctly.  Is there a workaround for this?

Thanks
Haifeng 
Haifeng
Top achievements
Rank 1
 answered on 18 Oct 2011
2 answers
303 views
I'm using the new DragDropManager and trying to stay as close to the standard Windows/WPF approach as much as possible.  Most of the examples here use the RadDragAndDropManager, and I haven't been able to find examples using the new approach.

I have a form with 2 grids (i.e. RadGridView).  There are 2 possible drag/drop scenarios:

Scenario 1. Drag a row from the left grid, and drop onto a row in the right grid, in order to create an association.  In this scenario I need to determine how to  Provide a visual indicator of the drop target row.  This could be achieved by displaying the default mouse-hover highlight on a row, which seems to be turned off during drag/drop.  Is there a way to selectively turn this on and off from within the DragEnter and DragLeave events?

Scenario 2. Use drag/drop to reorder rows within either grid.   In this scenario I need to determine how to display a visual indicator of where the dragged row will be moved to, via an indicator line between the rows.  I notice that the RadTreeListView contains a nice template for this.  I can use the RadTreeListView instead of the RadGridView to take advantage of this.  However this indicator seems to be always on or off based on the IsDragDropEnabled property.  Can this template be toggled on/off from within DragEnter and DragLeave events?  Also how can I determine if the drop point is before or after the target row.

You'll notice that the right grid handles both scenarios, depending on the drag source.  Here is the DragOver handler which provides feedback on what effect (if any) the drop would have.  

private static void OnRightGridDragOver(object sender, DragEventArgs e)
{
            e.Effects = DragDropEffects.None;

            GridViewRow row = FindVisualParent<GridViewRow>(e.OriginalSource as UIElement);
            Attribute attribute = row == null ? null : row.Item as Attribute;
            IDataObject dataObject = (IDataObject)e.Data;

            if (dataObject.GetDataPresent(typeof(Field)))
            {
                if (attribute != null && attribute.Children.Count == 0)
                {
                    e.Effects = DragDropEffects.Link;
                }
            }
            else if (dataObject.GetDataPresent(typeof(Attribute)))
            {
                e.Effects = DragDropEffects.Move;
            }
            e.Handled = true;
}


Also I notice that unlike the RadDragAndDropManager, the new DragDropManager doesn't seem to support auto scrolling of a list. How would that be handled?

Thanks for your help.
Jeff
Top achievements
Rank 1
 answered on 18 Oct 2011
2 answers
155 views

Hi,

 

I have a gridview that is themed with Telerik Windows 7 theme, which is the general theme of the application and gets set at load time.  I want to add another grid in the Row Details section, however I want this nested grid to have a different theme for clarity (office black, or the white theme from the WPF Telerik examples).  Unfortunately, the nested gridview always take the same theme as the parent one.  I have tried to set the style differently, but it didn’t work.

 

 

<Style x:Key="RowDetailGridViewStyle" TargetType="{x:Type Controls:RmpReadOnlyGridView}"  BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_SilverTheme, ElementType=telerik:RadGridView}}">


 

Any suggestion what I should do?

 

Regards

Perlom
Top achievements
Rank 1
 answered on 18 Oct 2011
2 answers
160 views
I'm trying to modify the existing Docking.xaml theme to put the close button on the document tab instead of the tabstrip.  The StyleManager seems to accepts the theme (GetTheme returns my theme); however the display still reflects the original Office_BlackTheme with the button on the tabstrip and not on the document tab.  I've included the project, and code snippets of how I use it.

Xaml:
<telerik:RadDocking x:Name="radDock">
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup>
                <telerik:RadDocumentPane Header="Document 1"
                                         Title="Document 1" />
                <telerik:RadDocumentPane Header="Document 2"
                                         Title="Document 2" />
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
</telerik:RadDocking>

Code-behind:
StyleManager.SetTheme(radDock, new OfficeBlack_Docking());

Sample Theme Project


If anyone can help it would be greatly appreciated.  I am evaluating the product for purchase by my company and my trial period has expired, so this is my only recourse for resolution.

Thanks in advance,
Steve
Thomas
Top achievements
Rank 1
 answered on 18 Oct 2011
1 answer
113 views
Here's my situation (simplified):  I want to bind a collection of user controls to a combo box, but I only want to see the Name of the user controls displayed in the list and displayed as the selected item.

So I have essentially done the following in code: 
var collection = new ObservableCollection<MyUserControl>();
// Add some items to collection here
myRadComboBox.ItemsSource = collection;

And my XAML looks something like the following:
<telerik:RadComboBox SelectionBoxTemplate="{StaticResource MyUserControlDataTemplate}" ItemTemplate="{StaticResource MyUserControlDataTemplate}" />

With the static resource defined as...
<DataTemplate x:Key="MyUserControlDataTemplate" >
    <TextBlock Text="{Binding Name}"/>
</DataTemplate>

And when I run the app, and select an item from the drop down, the visual content of the user control is what shows up in the selection box -- not the name.  It appears that when the data bound to ItemsSource is a collection of UserControls, the specified ItemTemplate will be honored, but not the SelectionBoxTemplate.  I have tried to simplify this as much as possible, but I just cannot get it to work.

Fortunately, when I set the ItemsSource property of my RadComboBox to a collection of some other object which had a "Name" property (without making any other changes to the XAML), I got exactly what I expected to see -- the content of the object's Name property showed up in the selection box.

Please tell me that what I'm seeing is not the expected behavior when binding to a collection of user controls!
Yana
Telerik team
 answered on 18 Oct 2011
1 answer
298 views
Hi,

My requirement is to set the visibility of RadTreeViewItem. For this sample shared at the http://www.telerik.com/community/forums/wpf/treeview/radtreeviewitem-visibility.aspx post helped me. I modified this sample to incorporate my requirement. I added one more property in BusinessItem for Visibility and bind it with the RadTreeViewItem. But problem is that RadTreeViewItem shows expander button (on left side) even if all its children are set to Collapsed.
I also need to hide expander button for a RadTreeViewItem if all its children are collapsed.


Thanks and Regards,
Bala,
Petar Mladenov
Telerik team
 answered on 18 Oct 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
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
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?