Hallo,
I have Winforms Application.
I created WPF-UserControl.
I'm trying to add this WPF-UserControl (per elementHost) to one of RadElement in my Winforms Form.
It could be RadPanelElement or my custom class extending RadElement.
Is it possible, and if it is possible how can i add, place WPF-UserControl on RadElement?
Or how can i prepare my custom radElement which will show WPF-UserControl?
Having a bizarre issue with RadGridView where it seems to randomly be selecting items in the grid when the underlying ObservableCollection is changed. My desired behavior is the "CurrentItem" becoming null when the selected item is removed from the underlying collection, and obviously for the GridView not to select an item when added when the selection is blank. My code is as follows:
radGridView1.AutoExpandGroups = true;
var gd = new GroupDescriptor();
gd.GroupNames.Add("RandomProp1", ListSortDirection.Ascending);
radGridView1.GroupDescriptors.Add(gd);
var sd1 = new SortDescriptor("RandomProp2", ListSortDirection.Descending);
radGridView1.SortDescriptors.Add(sd1);
var sd2 = new SortDescriptor("RandomProp3", ListSortDirection.Ascending);
radGridView1.SortDescriptors.Add(sd2);
radGridView1.MultiSelect = false;
radGridView1.DataBindingComplete += RadGridView1_DataBindingComplete;
radGridView1.DataSource = App.MasterList;
private void RadGridView1_DataBindingComplete(object sender, Telerik.WinControls.UI.GridViewBindingCompleteEventArgs e)
{
Log.WriteLine("RadGridView_DataBindingComplete");
radGridView1.CurrentRow = null;
radGridView1.CurrentRowChanged += RadGridView1_CurrentRowChanged;
}
When the underlying collection is being changed, I'm doing the following:
BeginInvoke on the main thread
Locking the collection
Updating items as such:
DynamicCollection[i] = new CustomObject(fillerProperties);
Is the above possibly the issue? I know this is the correct way to update ObservableCollections in WPF when bound to a GridView, not sure if WinForms behaves differently.
When using GridView in Hierarchy mode with a Template and binding to BindingList for Children:
public
class
Parent
{
public
Parent()
{
children =
new
BindingList<Child2>();
}
public
int
Id {
get
;
set
; }
public
string
Prop1 {
get
;
set
; }
public
BindingList<Child2> children {
get
;
set
; }
}
public
class
Child2 : INotifyPropertyChanged
{
public
int
Id {
get
;
set
; }
public
string
Prop1 {
get
;
set
; }
private
int
_Prop2;
public
int
Prop2
{
get
{
return
this
._Prop2; }
set
{
if
(
this
._Prop2 != value)
{
this
._Prop2 = value;
if
(PropertyChanged !=
null
)
PropertyChanged(
this
,
new
PropertyChangedEventArgs(
"Prop2"
));
}
}
}
public
string
Prop3 {
get
;
set
; }
public
event
PropertyChangedEventHandler PropertyChanged;
}
If there is grouped columns in child template, changing properties is not reflected:
public
partial
class
Form1 : Form
{
BindingList<Parent> data;
public
Form1()
{
InitializeComponent();
InitGrid();
data =
new
BindingList<Parent>();
for
(
int
i = 0; i < 3; i++)
{
Parent parent =
new
Parent() { Id = i, Prop1 =
"testProp"
+ i };
for
(
int
j = 0; j < 4; j++)
{
Child2 child =
new
Child2() { Id = i * j, Prop1 =
"testProp"
+ i, Prop2 = j % 2, Prop3 =
"another"
};
parent.children.Add(child);
}
data.Add(parent);
}
this
.radGridView1.DataSource = data;
this
.radGridView1.CellDoubleClick += radGridView1_CellDoubleClick;
}
void
radGridView1_CellDoubleClick(
object
sender, GridViewCellEventArgs e)
{
Child2 child = e.Row.DataBoundItem
as
Child2;
MessageBox.Show(child.Prop2.ToString());
}
private
void
InitGrid()
{
this
.radGridView1.Columns.Add(CreateColumn(
"Id"
));
this
.radGridView1.Columns.Add(CreateColumn(
"Prop1"
));
GridViewTemplate template =
new
GridViewTemplate();
template.AllowAddNewRow =
false
;
template.AllowDeleteRow =
false
;
template.AllowEditRow =
false
;
template.AutoGenerateColumns =
false
;
template.Columns.Add(CreateColumn(
"Id"
));
template.Columns.Add(CreateColumn(
"Prop1"
));
template.Columns.Add(CreateColumn(
"Prop2"
));
template.Columns.Add(CreateColumn(
"Prop3"
));
GridViewRelation r =
new
GridViewRelation(
this
.radGridView1.MasterTemplate, template);
r.ChildColumnNames.Add(
"children"
);
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
template.EnableFiltering =
false
;
template.EnableGrouping =
true
;
template.ShowColumnHeaders =
true
;
template.ShowRowHeaderColumn =
false
;
this
.radGridView1.EnableGrouping =
false
;
this
.radGridView1.EnableCustomGrouping =
false
;
GroupDescriptor gd =
new
GroupDescriptor();
gd.GroupNames.Add(
"Prop2"
, ListSortDirection.Ascending);
gd.GroupNames.Add(
"Prop3"
, ListSortDirection.Ascending);
template.GroupDescriptors.Add(gd);
this
.radGridView1.Templates.Add(template);
this
.radGridView1.Relations.Add(r);
this
.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
GridViewTextBoxColumn CreateColumn(
string
Field)
{
GridViewTextBoxColumn col =
new
GridViewTextBoxColumn();
col.Name = Field;
col.FieldName = Field;
col.HeaderText = Field;
return
col;
}
private
void
button1_Click(
object
sender, EventArgs e)
{
this
.data.First().children.First().Prop2 = 1;
}
}
When I Click Button1 nothing happens
Is this a bug or am I doing something wrong?
Hello,
I have a list of items in a RadPageViewPage, in which I can select an item. A specific view for the selected item, depending on its type, is displayed in another RadPageViewPage. I then have to change the content of the panel in the second RadPageViewPage depending on the selected item, which is done simply with the following code:
1 UserControl userControl = new UserControlRobotActionProcess();
2 userControl.Parent = radPanel1;
I observed it took quite long to display the UserControl in the panel and measured the time of the line of code 2 above: 400ms. I then tested to display the same control, but with standard WinForms controls instead of the Telerik ones. The same line of code takes 1ms.
I think that the views I use could be optimized and could be loaded faster. I attach a screenshot of the view I have loading time issues with. Here is also the list of Telerik controls I use:
- RadSpinEditor
- RadPanel
- RadPageView
- RadPageViewPage
- RadLabel
- RadGroupBox
- RadButton
- RadRadioButton
- RadCheckBox
- RadTextBox
Do you know if I can improve the loading time of this UserControl?
Please feel free to tell me if you need more information.
Kind regards,
Antoine
Good Morning,
When generating a Crystal Theme Variation, there are several accent color palettes to choose from.
I accidentally overwrote the Blue one. How can I restore the Blue Palette?
Thank you
If I have two pie charts next to each other how do I make their circumference the same size.
I have tried Chartview.View.Margin. Setting it to the same value does not make them the same size.
Hello
I have DateTimePicker with date in format dd-MM-yyyy. Initial date in this control is 01-02-2020. I want to write new date (31-01-2020) in MaskEdeditBox but after set day cursor correctly move to month section and day section changes walues to '01'. Could I define other behavior for this situations? For example when currently set month not has enough days month automatically decreases by 1.
Best wishes
Hi,
I'm currently working with a chartview where the y-axis contains seconds. I',m trying to convert the seconds to minutes and/or hours, depending on rather the amount of seconds is more or equal one or more hour/s.
How can I achieve this behavior?
Thanks in advance!