Telerik Forums
UI for WPF Forum
1 answer
253 views
I am using two RadListBoxes as well as a ItemCollection.  The are bound to observable collections of business objects.    When I drag items between them, I don't want the item to be removed from the collection, but rather just a copy placed where it was dragged to.  How would I keep the items in the list?   It seems no matter what I do, the item is removed from the list that it was drug from.
heavywoody
Top achievements
Rank 1
 answered on 03 Jul 2013
2 answers
206 views
I need to set a Cell in a Column to ReadOnly based on another value. How can I do this on a row by row basis?
Thanks in  advance,
Steve
public class RowData
{
    public String Description { get; set; }
    public bool CanEdit { get; set; }
}
Steve
Top achievements
Rank 1
 answered on 02 Jul 2013
2 answers
74 views
Hi all,
Should be Zoom-in/out slot's height,not width.



Wenjie
Top achievements
Rank 1
 answered on 02 Jul 2013
5 answers
138 views
I have a RadGridView setup as follows:

                            <tk:RadGridView Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Height="175" Margin="0,5,0,10" Width="960" 
                                            AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" 
                                            CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="True" CanUserSortColumns="False" 
                                            HorizontalAlignment="Left" IsFilteringAllowed="False" ItemsSource="{Binding EquipmentToAdd}" MinHeight="150" 
                                            RowIndicatorVisibility="Collapsed" SelectionUnit="Cell" ShowGroupPanel="False" VerticalAlignment="Bottom" ActionOnLostFocus="CommitEdit">
                                <i:Interaction.Behaviors>
                                    <cv:CellValidationBehavior />
                                    <cf:EquipmentQuickEntryGrid/>
                                </i:Interaction.Behaviors>

                                <tk:RadGridView.Columns>
                                    <tk:GridViewDataColumn Width="50" DataMemberBinding="{Binding Path=Count}" Header="Count" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="110" DataMemberBinding="{Binding Path=BaseEquipmentType}" Header="Base Type" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=EquipmentType}" Header="Equipment Type" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="130" DataMemberBinding="{Binding Path=Manufacturer}" Header="Manufacturer" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=Model}" Header="Model" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=AssetNumber}" Header="Asset Number" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" Header="Serial Number" CellTemplateSelector="{StaticResource isAssetInUseSerialNumberTemplateSelector}" UniqueName="SerialNumber" IsReadOnlyBinding="{Binding IsInUse}"/>
                                    <tk:GridViewDataColumn Width="55"  Header="Remove" CellTemplateSelector="{StaticResource isAssetInUseDeleteTemplateSelector}" IsReadOnlyBinding="{Binding IsInUse}" />
                                    <tk:GridViewDataColumn Width="50" DataMemberBinding="{Binding Path=IsInUse}" IsVisible="False" />
                                </tk:RadGridView.Columns>
                                <tk:RadGridView.GridViewGroupPanel>
                                    <tk:GridViewGroupPanel AllowDrop="False" IsEnabled="False" Visibility="Hidden" />
                                </tk:RadGridView.GridViewGroupPanel>
                            </tk:RadGridView>

The CellValidationBehavior logic executes on Attach and Detach:
    using Telerik.Windows.Controls;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class CellValidationBehavior : Behavior<RadGridView>
    {
        private EquipmentQuickEntryViewModel _viewModel = null;

        /// <summary>
        /// Overrides the OnAttached event so we can hook up the RowLoaded event
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();

            this.AssociatedObject.DataLoaded += new EventHandler<EventArgs>(DataLoaded);
            this.AssociatedObject.CellValidating += new EventHandler<GridViewCellValidatingEventArgs>(CellValidating);
            this.AssociatedObject.RowValidated += new EventHandler<GridViewRowValidatedEventArgs>(RowValidated);
        }

        /// <summary>
        /// Overrides the OnDetaching method to add handlers to some DragDrop events
        /// </summary>
        protected override void OnDetaching()
        {
            base.OnDetaching();

            this.AssociatedObject.DataLoaded -= new EventHandler<EventArgs>(DataLoaded);
            this.AssociatedObject.CellValidating -= new EventHandler<GridViewCellValidatingEventArgs>(CellValidating);
            this.AssociatedObject.RowValidated -= new EventHandler<GridViewRowValidatedEventArgs>(RowValidated);
        }

        /// <summary>
        /// Captures the DataLoaded event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The EventArgs</param>
        private void DataLoaded(object sender, EventArgs e)
        {
            var grid = this.AssociatedObject;
            var dataSource = (ObservableCollection<EquipmentToAdd>)grid.ItemsSource;

            if (dataSource.Count>0)
            {
                if (_viewModel == null)
                {
                    _viewModel = grid.DataContext as EquipmentQuickEntryViewModel;
                }

                var selectedRow = _viewModel.SelectedRowNumber;

                grid.ScrollIntoView(grid.Items[selectedRow], grid.Columns["SerialNumber"]);

                grid.CurrentCellInfo = new GridViewCellInfo(grid.Items[selectedRow], grid.Columns["SerialNumber"]);

                var equipment = (EquipmentToAdd)grid.Items[selectedRow];

                if (equipment.IsInUse)
                {
                    return;
                }
                
                grid.BeginEdit();
            }
        }

        /// <summary>
        /// Captures the CellValidating event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The GridViewCellValidatingEventArgs</param>
        private void CellValidating(object sender, GridViewCellValidatingEventArgs e)
            {
            if (e.Cell.Column.UniqueName != "SerialNumber")
            {
                return;
            }

            var value = e.NewValue.ToString();

            if (!string.IsNullOrEmpty(value))
            {
                if (this._viewModel == null)
                {
                    this._viewModel = ((RadGridView)sender).DataContext as EquipmentQuickEntryViewModel;
                }
                EquipmentToAdd thisEquipment = (EquipmentToAdd)e.Row.DataContext;
                var isDuplicate = this._viewModel.IsDuplicateSerialNumber(value, thisEquipment);

                if (isDuplicate)
                {
                    e.IsValid = false;
                    e.ErrorMessage = "That serial number already exists";
                    return;
                }

                _viewModel.UpdateCanSave();
            }
        }

        /// <summary>
        /// Captures the RowValidated event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The GridViewRowValidatedEventArgs</param>
        private void RowValidated(object sender, GridViewRowValidatedEventArgs e)
        {
            if (_viewModel == null)
            {
                _viewModel = ((RadGridView)sender).DataContext as EquipmentQuickEntryViewModel;
            }

            _viewModel.UpdateCanSave();
        }
    }

I confirmed that it is being passed the RadGridView object.  However when I enter data into the cell containing the serial number (only editable field) I do not get any validation events.  

WHY??
Dimitrina
Telerik team
 answered on 02 Jul 2013
1 answer
91 views
I have a case where my filter descriptors on my gridview are being removed / cleared out when the grid view is inside a radpane inside a raddocking control, and when you drag and drop the radpane to another position, or even dragging and popping it out.

I have an example project which demonstrates this behavior.  The gridview's ItemSource is bound to an observable collection of test viewmodel's.  You can see after you drag the radpane in question that all of the rows appear, even the ones that are supposed to be filtered out.  Going even further I have confirmed that the filterdescriptors are being removed by using Snoop.  I examine them before drag, and then again after drag.  After drag they are completely gone.  Let me know if you would like to test my example project.

Please advise on a solution to this issue. 

Thank You.
Yoan
Telerik team
 answered on 02 Jul 2013
1 answer
165 views
Hi!

Is there a way to put texts at certain coordinates in the chart (see attached picture) triggered by a button click event? We are not using point labels or legends here.

Would really appreciate your help.

Thanks!
Petar Kirov
Telerik team
 answered on 02 Jul 2013
2 answers
189 views
Hello,

I have a RadGridView.  It has as its source an ObservableCollection of a custom class.  There are three columns representing the data from this custom class.  What I am trying to do is apply a very specific converter to convert a value to a string.  I want to check the value in the first column and then apply the converter to the second and possibly the third column.
I tried using a DataTrigger.  If I set the target type to telerik:GridViewCell or telerik:GridViewRow, I am able to catch the row I want.  I think I should use the GridViewCell, but since all three columns refer to the same object, I am struggling to know which column the cell is in.  For my initial testing I am simply trying to change the background color of the cell I want, but later I will want to apply the Converter to the cell.

If I apply the converter directly to the column, I only get the value in the column and therefore do not know the corresponding value in the first column of the same row.

I am probably missing something to enable the functionality I want and am hoping someone could point me in the right direction.

Thanks,
Chris
Chris
Top achievements
Rank 1
 answered on 02 Jul 2013
9 answers
395 views
Hi,

I'm trying to display some probability distribution functions using RadChart. These only contain positive values (with usually a lot of values around 1E-5). Sometimes RadChart scales Y axis to extend to negative values. Why does it do that? And how can I prevent this?

   - Jussi

Harsh
Top achievements
Rank 1
 answered on 02 Jul 2013
1 answer
96 views
I just upgraded to 2013 Q2 and am having trouble using RadDiagram. Previously working code now raises an exception with message:

Value cannot be null.
Parameter name: source

Please help.
Pavel R. Pavlov
Telerik team
 answered on 02 Jul 2013
1 answer
201 views
Hello!

I'm struggling from a few days with a problem in my wpf application:

I have to create a structure similar to the one in telerik demos of which I attach a screenshot. It is a RadGridView with hierarchy.

In child grid I have to add a RadComboBox Column and it works fine until I simply put some values in this combo. My task Is to modify the Data Template of the Comboboxcolumn and insert a radgridview.

I'm facing a lot of problem in  doing that and in binding data to the Grid. I succesfully create the structure but I'm not able to bind data in code behind.

This is a piece of my code, and attached is the example structure I want to upgrade.

<telerik:RadGridView  Margin="15,5,15,5" Name="gvRequest" Height="auto" Width="Auto"
                                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
                                 telerik:StyleManager.Theme="Simple" AutoGenerateColumns="False"  
                                 IsFilteringAllowed="False" FlowDirection="LeftToRight" ShowGroupPanel="False">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn UniqueName="Codice" Header="Codice" Width="Auto" />
            <telerik:GridViewDataColumn UniqueName="UtenteCreazione" Header="UtenteCreazione" Width="Auto" />
            <telerik:GridViewDataColumn UniqueName="IDContatore" Header="IDContatore" Width="Auto" />
            <telerik:GridViewDataColumn UniqueName="ModuloStampa" Header="ModuloStampa" Width="Auto" />
        </telerik:RadGridView.Columns>
        <telerik:RadGridView.HierarchyChildTemplate>
            <DataTemplate>
                <StackPanel DataContext="{x:Null}">
                    <telerik:RadGridView CanUserReorderColumns="False" Name="gvOrder"  CanUserInsertRows="True" ShowInsertRow="True" CanUserDeleteRows="True"
                                             CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" ItemsSource="{Binding}"
                                             Loaded="OnChildGridLoaded" FlowDirection="LeftToRight" IsFilteringAllowed="False" ShowColumnHeaders="True" ColumnBackground="AliceBlue" HorizontalContentAlignment="Right" ClipToBounds="True">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn UniqueName="id" Header="id" Width="Auto" />
                            <telerik:GridViewDataColumn UniqueName="Data" Header="Data" Width="Auto" />
                            <telerik:GridViewDataColumn UniqueName="UtenteCreazione" Header="UtenteCreazione" Width="Auto" />
                            <telerik:GridViewComboBoxColumn UniqueName="numero" Header="Numero" Width="Auto"
                                                            DataMemberBinding="{Binding numero, Mode=TwoWay}"
                                                            DisplayMemberPath="NomeUtente"  SelectedValueMemberPath="IDUtente" SortMemberPath="NomeUtente" SortingState="Ascending" />
<telerik:GridViewComboBoxColumn UniqueName="numero2" Header="Numero2" Width="Auto"
                                                            DataMemberBinding="{Binding numero, Mode=TwoWay}"
                                                            ItemsSource="{Binding Source={StaticResource CustomersViewSourcefil}}"
                                                            DisplayMemberPath="{Binding Path=RadGrigliaUtenti.NomeUtente}">
                                <telerik:GridViewComboBoxColumn.ItemTemplate>
                                    <DataTemplate>
                                        <telerik:RadGridView FilteringMode="FilterRow" x:Name="RadGrigliaUtenti" AutoGenerateColumns="False" ShowGroupPanel="False" CanUserFreezeColumns="False"
                                             RowIndicatorVisibility="Collapsed" IsReadOnly="True" MinWidth="300" MaxWidth="600"
                                             IsFilteringAllowed="True" ItemsSource="{Binding Source={StaticResource CustomersViewSource}}"
                                             Height="150" SelectedItem="{Binding Path=numero}" >
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn Header="IDUtente" Width="120" DataMemberBinding="{Binding IDUtente}" IsReadOnly="True"></telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn Header="NomeUtente" Width="*" DataMemberBinding="{Binding NomeUtente}" IsReadOnly="True"></telerik:GridViewDataColumn>
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>
                                        
                                    </DataTemplate>
                                </telerik:GridViewComboBoxColumn.ItemTemplate>
</telerik:GridViewComboBoxColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </StackPanel>
            </DataTemplate>
        </telerik:RadGridView.HierarchyChildTemplate>
    </telerik:RadGridView>
</Window>


Someone has a sample project or some suggestions to accomplish this task?
Yoan
Telerik team
 answered on 02 Jul 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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?