<
Window
x:Class
=
"MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
StackPanel
Grid.Row
=
"0"
Height
=
"Auto"
HorizontalAlignment
=
"Stretch"
Name
=
"StackPanel1"
VerticalAlignment
=
"Stretch"
Width
=
"Auto"
>
<
telerik:RadComboBox
Name
=
"Combo1"
Text
=
"One"
Margin
=
"2"
IsEditable
=
"True"
GotFocus
=
"RadComboBox_GotFocus"
LostFocus
=
"RadComboBox_LostFocus"
>
<
telerik:RadComboBox.Items
>
<
telerik:RadComboBoxItem
>One</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Two</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Three</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Four</
telerik:RadComboBoxItem
>
</
telerik:RadComboBox.Items
>
</
telerik:RadComboBox
>
<
telerik:RadComboBox
Name
=
"Combo2"
Text
=
"Six"
Margin
=
"2"
IsEditable
=
"True"
GotFocus
=
"RadComboBox_GotFocus"
LostFocus
=
"RadComboBox_LostFocus"
>
<
telerik:RadComboBox.Items
>
<
telerik:RadComboBoxItem
>Five</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Six</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Seven</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Eight</
telerik:RadComboBoxItem
>
</
telerik:RadComboBox.Items
>
</
telerik:RadComboBox
>
<
telerik:RadComboBox
Name
=
"Combo3"
Text
=
"Eleven"
Margin
=
"2"
IsEditable
=
"True"
GotFocus
=
"RadComboBox_GotFocus"
LostFocus
=
"RadComboBox_LostFocus"
>
<
telerik:RadComboBox.Items
>
<
telerik:RadComboBoxItem
>Nine</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Ten</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Eleven</
telerik:RadComboBoxItem
>
<
telerik:RadComboBoxItem
>Twelve</
telerik:RadComboBoxItem
>
</
telerik:RadComboBox.Items
>
</
telerik:RadComboBox
>
</
StackPanel
>
<
ListBox
Grid.Row
=
"1"
Height
=
"Auto"
HorizontalAlignment
=
"Stretch"
Name
=
"EventList"
VerticalAlignment
=
"Stretch"
Width
=
"Auto"
/>
</
Grid
>
</
Window
>
Imports
Telerik.Windows.Controls
Class
MainWindow
Private
Sub
RadComboBox_GotFocus(sender
As
System.
Object
, e
As
System.Windows.RoutedEventArgs)
Dim
cbo =
CType
(sender, RadComboBox)
AddEventToList(cbo.Name,
"GotFocus"
)
End
Sub
Private
Sub
RadComboBox_LostFocus(sender
As
System.
Object
, e
As
System.Windows.RoutedEventArgs)
Dim
cbo =
CType
(sender, RadComboBox)
AddEventToList(cbo.Name,
"LostFocus"
)
End
Sub
Private
Sub
AddEventToList(
ByVal
ctrlName
As
String
,
ByVal
eventName
As
String
)
EventList.Items.Add(
String
.Format(
"{0} : {1} : {2}"
, EventList.Items.Count, ctrlName, eventName))
EventList.ScrollIntoView(EventList.Items(EventList.Items.Count - 1))
End
Sub
End
Class
I have a RadCartesianChart chart with a dynamic number of date/double series. So, I'm using a ChartSeriesProvider and programmatically generating the CategoricalSeriesDescriptor instances for the series. The x values for the data are of type DateTime, but the query results are actually grouped by the actual query already so that they are per year, month, etc. So, if the query was grouped by month, I would have a single point to plot where the Datetime value is on the first of the month. For most groupings, I can use the axis.LabelFormat property to provide an x axis label that is appropriate to the grouping. Ex. for month, I'd provide something like "MMM, yyyy". However, there is no format specifier for week number (of the year) or quarter number for me to generate labels like "Week 12, 2013". Is there a way for me to generate that kind of label? Maybe some other method besides using Axis.LabelFormat?
Thanks - Mitch
I think I've seen this problem before, but none had a documented resolution. I have a list of objects from the database that I want to display in a property grid. The tables and view have been built to provide all that I need for the property grid. Here is the poco def:
public class Setting
{
public string ParameterName { get; set; }
public string ParameterValue { get; set; }
public string DataTypeName { get; set; }
public string ParameterTypeName { get; set; }
public string Description { get; set; }
}
I am trying it in code behind first, so my xaml is simple:
<telerik:RadPropertyGrid x:Name="_propertyGrid" AutoGeneratePropertyDefinitions="False" />
and the code-behind gets the list of Setting instances from the view model and wraps a PropertyDefinition around it. It adds that PropertyDefinition to the property grid, then binds the property grid to the entire list:
List<Setting> settings = viewModel.Settings;
foreach (Setting setting in settings)
{
_propertyGrid.PropertyDefinitions.Add(new PropertyDefinition(/*new ItemPropertyInfo(setting.ParameterName, Type.GetType(setting.DataTypeName), setting.Description)*/)
{
Binding = new Binding("ParameterValue") { Mode = BindingMode.TwoWay /*, Path = new PropertyPath("ParameterValue")*/ },
Description = setting.Description,
DisplayName = setting.ParameterName,
GroupName = setting.ParameterTypeName,
});
}
_propertyGrid.Item = settings;
This works perfectly in some ways: every instance gets a row in the grid; and the DisplayName, Description, and GroupName all match the poco from whence it came.
The commented out code is stuff I've tried that either generates a runtime error (new ItemPropertyInfo), or has no effect (new PropertyPath). Both seem interesting though, so I left them in for exploration.
So my question is, can I bind the value of a property grid to a specific property of a poco in a list of them, as I can bind things like Description, DisplayName and GroupName?
Thank you very much for your time on this.
Edit: Somebody else commented in another post that it works if PropertySetMode is set to None, so I added this:
_propertyGrid.PropertySetMode = PropertySetOperation.None;
with no effect. However, if I set to to Union or Intersection, the *GroupName* (not the value, but the category) shows up in the data. How is that possible?
row.SetColumnError(1, "This cell has an error");