Hey community,
the row redorder sample doesn't work within a RadLayoutControl. It looks like as if the RadLayoutControl would intercept the DragEvent, so the GiveFeedbackEventArgs is not called within the RowReorderBehavior.
Can you provide me a sample or give me a hint please.
Kind regards,
Lars
I am using a radGridView in Master/Detail scenario using MVVM; the selected item is displayed in a custom form that allows editing.
The Form's DataContext and the Grid's SelectedItem are bound to a property in the ViewModel.
When the Grid's selection is changing, I check if the Form is in Edit mode, and if so I cancel the selection change.
This works as it should.
However, there are some circumstances where the Grid's ItemSource (CollectionViewSource) changes and the Grid looses track of the SelectedItem. I can throw NotifyPropertyChanged on the property, and the grid doesn't notice. When the grid is in this state and the user selects a row, the logic in SelectionChanging does not prevent the SelectedItem from changing. In fact it sets the SelectedItem to null, rather than the attempted selection row.
I really need to prevent the SelectedItem from changing (or becoming null) while the item is being edited. I think the best way would be to prevent the grid from getting into this strange state.
How can I force the grid to realize its SelectedItem, if NotifyPropertyChanged is not doing the trick?
Does the grid loose its SelectedItem binding when the Itemssource updates?
XAML:
<telerik:RadGridView Grid.RowSpan="2" ShowGroupPanel="False" AutoGenerateColumns="False" IsFilteringAllowed="False"
ItemsSource="{Binding Zones.View}" x:Name="grd_ZoneBins" IsReadOnly="True" EditTriggers="None"
SelectedItem="{Binding SelectedZone, Mode=TwoWay}"
SelectionChanging="grd_ZoneBins_SelectionChanging" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Zone" DataMemberBinding="{Binding Name}" Width="*" />
<telerik:GridViewDataColumn Header="Active" DataMemberBinding="{Binding IsActive}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
CodeBehind:
private void grd_ZoneBins_SelectionChanging(object sender, Telerik.Windows.Controls.SelectionChangingEventArgs e)
{
if (EditableWorkSpace_ZoneBins.Mode == EditMode.Editable) //this is a custom control
e.Cancel = true;
}
ViewModel:
//Properties
private List<Part_Zone> _zones;
public CollectionViewSource Zones { get; set; }
private Part_Zone m_SelectedZone;
public Part_Zone SelectedZone
{
get { return m_SelectedZone; }
set { m_SelectedZone = value; NotifyPropertyChanged("SelectedZone");}
}
public Model() //constructor
{
Zones = new CollectionViewSource();
Zones.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
LoadData();
}
private void LoadData()
{
_zones = GetZones();
Zones.Source = _zones;
SelectedZone = Zones.View.CurrentItem as Part_Zone; //first item
}
public void Refresh()
{
LoadData();
//at this point the grid doesn't seem aware that the SelectedZone is its SelectedItem
}
public void StartEdit()
{
View.EditableWorkSpace_ZoneBins.Mode = EditMode.Editable;
NotifyPropertyChanged("SelectedZone"); // just in case
}
Steps to reproduce:
1) load data
2) select item in grid
3) refresh data - grid looses selectedItem. SelectedZone is not null.
4) start edit
5) change selection - gets canceled due to Edit mode
6) SelectedZone is set to null.
Dear Admin
I just use RadGridView control for excel content shown in MVVM pattern, and before amount excel data, I do not know exact columns and rows shown in RadGridView, so I use datatable as my datasource binded to RadGridView's ItemsSource. But actually I would like to change some columns datatype from string to Image, I try to add AutoGeneratingColumn event and set CellTemplate for specified columns, and the result was that there was no response after loading and only shut-down whole window.
so in this case is there any other workaround to archive similar case? any ideas I do really appreciate.
if (e.DataElement != null) { ((GridViewCell)e.Row.Cells[7]).BeginEdit(); } 
Hello,
I have a combobox on which i am trying to modify the default tooltip style.This is applicable when I am hovering on individual combobox items and I should get the tooltip. Right now for tooltip , we are showing up the text value. But I want to override this deafult style and show the description instead. (Note that description is a user defined property).
The code snippet right now is:
<Style.Resources>
<Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource ComboBoxItemStyle}">
<!--<Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>-->
<Setter Property="ToolTip" Value="{Binding}"/>
</Style>
</Style.Resources>
Here while setting the property "tooltip" <Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>. I tried doing something like this. Here I exposed a public property from my class which is holding the description value that I need to show when i am hovering on the individual item. But the binding is not working.
I need your input to proceed further.

A pair of RadTimePickers I have for selecting the beginning and end of a shift are displaying the timeview incorrectly after being enabled and having the starttime and endtime values set. They both show every slot from 12AM to 11:45PM, but starting with 12AM selecting a slot displays the value that SHOULD be seen, 8:30AM in this case, and continues for each subsequent slot in the same manner until the endtime slot, whose correct value is 5:15PM at the 8:45AM slot on the selection view. When the binding event is called a second time, the timeviews for both RTPs are correctly shown, going from 8:30AM to 5:15PM. HTML markup of the RTPs in question as follows, as well as the code-behind for the binding event.
//HTML//<telerik:RadTimePicker ID="tpStartTime" runat="server" EnableTyping="false" TimeView-Columns="4" TimeView-Interval="00:15:00" Enabled="false"></telerik:RadTimePicker><telerik:RadTimePicker ID="tpEndTime" runat="server" EnableTyping="false" TimeView-Columns="4" TimeView-Interval="00:15:00" Enabled="false"></telerik:RadTimePicker>//C#//protected void dpOriginalDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { DateTime[] shift = getShift((DateTime)dpOriginalDate.SelectedDate); tpStartTime.Enabled = tpEndTime.Enabled = true; tpStartTime.TimeView.StartTime = shift[0].TimeOfDay; tpStartTime.TimeView.EndTime = shift[1].TimeOfDay; tpEndTime.TimeView.StartTime = shift[0].AddMinutes(15).TimeOfDay; tpEndTime.TimeView.EndTime = shift[1].AddMinutes(15).TimeOfDay; }Page_Load contains Page.DataBind(); which appears to be the cause. Do I have to do without it or is there a workaround?
However, I am not able to use the GetProperty method for control specific properties, i.e. "ItemState" on a RadTileViewItem. I am able to find the item and for example draw a highlight around it, but trying to get it's TileState results in a NotSupportedException:
GetProperty of "TileState" is not supported on control type: Custom
What seems strange: If I start the coded ui test builder and pull the crosshair over the TileViewItem, I can see it's TileState property and the correct value. Only the test playback is not able to retrieve it.
Am I missing something important to make the uitest extension working?
I want a button on radribbon to have a dropdown content just like RadRibbonDropDownButton, but i also want to include this button into radiobuttons group. I mean this dropdown button should be toggleable and mutually exclusive with other buttons of the same group.
How could i do this?
Hi,
I would that SendBackward command set Z-Index to penultimate item and not last one.
Moreover SendToBack decreases Z-Index but until to penultimate item.
I would this behavior because, I have ever a rectangle called "MainContainer" that "contains" other rectangles, but actually is only showed as last one under other ones, and it has to ever last one then it has to ever lowest Z-Index.
How can I do this?