Hi. I write C# WPF MVVM Prism 6 application. I'm interested in RadTreeListView with buttons-column there. I defined the folowing XAML for buttons-column in RadTreeListView:
<
telerik:RadTreeListView
x:Name
=
"Hierarchical"
Grid.Row
=
"2"
Grid.Column
=
"0"
AutoGenerateColumns
=
"False"
AutoExpandItems
=
"True"
IsSynchronizedWithCurrentItem
=
"True"
CanUserReorderColumns
=
"False"
CanUserSortColumns
=
"False"
CanUserSortGroups
=
"False"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
IsFilteringAllowed
=
"False"
EnableLostFocusSelectedState
=
"False"
RowIndicatorVisibility
=
"Collapsed"
SelectionUnit
=
"FullRow"
ItemsSource
=
"{Binding DeviceProfile}"
Visibility
=
"{Binding AreRegistersInHierarchyVisible}"
SelectedItem
=
"{Binding SelectedProfileElement}"
>
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
<!--Button-column "Read current value from outer device selected register"-->
<
telerik:GridViewDataColumn
IsVisible
=
"{Binding IsReadColumnButtonVisible}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
Margin
=
"5"
Content
=
"Read Register Current Value"
Visibility="{Binding IsSelected,
RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, Converter={StaticResource booleanToVisibilityConverter}}"
Command
=
"{Binding InitializeRegisterCurrentValueReadingCommand}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
</
telerik:RadTreeListView
>
I use your BooleanToVisibilityConverter in Prism UserControl where the RadTreeListView is:
<
UserControl.Resources
>
<
telerik:BooleanToVisibilityConverter
x:Key
=
"booleanToVisibilityConverter"
/>
</
UserControl.Resources
>
Below is the source code of 'InitializeRegisterCurrentValueReadingCommand' command that is in View Model to which the Prism UserControl binds to:
// The command definition.
public
DelegateCommand<
object
> InitializeRegisterCurrentValueReadingCommand {
get
;
private
set
; }
// The command logic method.
private
void
initializeRegisterValueReading(
object
parameter)
{
// My custom C# code
}
// The command CanExecute method.
private
bool
initializeRegisterValueReadingCanExecute(
object
parameter)
{
// Some bolean condition is.
}
// Here is creating of command inside View Model constructor.
this
.InitializeRegisterCurrentValueReadingCommand =
new
DelegateCommand<
object
>(
this
.initializeRegisterValueReading,
this
.initializeRegisterValueReadingCanExecute);
Please see the screnshot in 'RadTreeListView_with_buttons.PNG' file attached. Where "Прочитать значение из регистра" button is "Read Register Value" button and "Записать значение в регистр" button is "Write Value To Register" button. "InitializeRegisterCurrentValueReadingCommand' command is bound to "Read Register Value" button. But when I pess (click) this button the command doesn't fire! I also tryed the following notation in XAML:
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding InitializeRegisterCurrentValueReadingCommand}"
EventName
=
"Click"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
But the result was the same pitiable-bad. But interestingly, when I create the handler of ButtonClick event (for button-cell) in code-behind, the the handler fires when the button is clicked! But my application is pure MVVM application! So how do I make the command fire when user clicks the button? Either with such markup:
<
telerik:GridViewDataColumn
IsVisible
=
"{Binding IsReadColumnButtonVisible}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
Margin
=
"5"
Content
=
"Прочитать значение из регистра"
Visibility="{Binding IsSelected,
RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, Converter={StaticResource booleanToVisibilityConverter}}"
Command
=
"{Binding InitializeRegisterCurrentValueReadingCommand}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
or with such markup:
<
telerik:GridViewDataColumn
IsVisible
=
"{Binding IsReadColumnButtonVisible}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
Margin
=
"5"
Content
=
"Прочитать значение из регистра"
Visibility="{Binding IsSelected,
RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, Converter={StaticResource booleanToVisibilityConverter}}">
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding InitializeRegisterCurrentValueReadingCommand}"
EventName
=
"Click"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
</
telerik:RadButton
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
How do I make the command fire when user clicks the button? Please help solve the problem. Thank you very much in advance.
Hi,
I have following code:
<
telerik:RadScheduleView
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:DayViewDefinition
/>
<
telerik:WeekViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:DateGroupDescription
/>
<
telerik:ResourceGroupDescription
ResourceType
=
"_StaffWorkplace"
/>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
</
telerik:RadScheduleView
>
How I can hide some resource on certain date? I tried to use GroupFilter, but it's work fine for me only for DayViewDefinition.
Regards,
Vladimir
I want to have a MarkerBrush based on a property of the data object being bound to. For example,
```
class MyDataPoint
{
public DateTime XValue {get;set;}
public double YValue {get;set;}
public bool IsRed {get; set;}
}
```
I want all points where IsRed=true to be rendered red, and blue when false. Is it possible?
I've made a Style with TargetType IndicatorItem and used DataTriggers but the style is always overridden with the default marker colour,
Hi, I use a radgridview ,like this:
this.gridUserControl.gridview.ItemsSource = xmlElement.ChildNodes;
add a new dataitem to xmlElement...
this.gridUserControl.gridview.ItemsSource = xmlElement.ChildNodes; //rebinding
int i = gridUserControl.gridview.Items.Count;
XmlElement lastitem = (XmlElement)gridUserControl.gridview.Items[i - 1];
gridUserControl.gridview.SelectedItem = lastitem;
gridUserControl.gridview.BeginEdit();
I want to go in the edit status when add a new dataitem directly. It works well. But the problem is that I press any key the first time, the edit status will be ended. And the edit cell's value is the only the press key's value. That's inexplicable. Please help me to solve the problem ,thanks!
Hi I have a datatemplate I would like to apply for the GridViewRow tooltip. May I ask how abouts I would do that?
<
DataTemplate
x:Key
=
"AppointmentToolTipTemplate"
>
<
Grid
MaxWidth
=
"300"
Background
=
"White"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"43"
/>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBlock
Text
=
"{Binding Subject}"
Grid.ColumnSpan
=
"2"
TextWrapping
=
"Wrap"
Margin
=
"5 8 4 3"
FontWeight
=
"Bold"
/>
<
Button
IsEnabled
=
"False"
Background
=
"Transparent"
Grid.Row
=
"1"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
Margin
=
"5 5 0 0"
Width
=
"28"
Height
=
"29"
ContentTemplate
=
"{StaticResource Calendar.Clock}"
></
Button
>
<
StackPanel
Orientation
=
"Vertical"
Grid.Column
=
"1"
Grid.Row
=
"1"
Margin
=
"0 5 0 0"
>
<
StackPanel
Orientation
=
"Horizontal"
Margin
=
"0 0 0 0"
>
<
TextBlock
Text
=
"{Binding Start, StringFormat='hh:mm tt', Mode=TwoWay}"
TextWrapping
=
"Wrap"
FontSize
=
"10"
/>
<
TextBlock
Text
=
" - "
FontSize
=
"10"
/>
<
TextBlock
Text
=
"{Binding End, StringFormat='hh:mm tt', Mode=TwoWay}"
TextWrapping
=
"Wrap"
FontSize
=
"10"
/>
</
StackPanel
>
<
TextBlock
Text
=
"{Binding Start, StringFormat='dddd dd MMM yyyy', Mode=TwoWay}"
Margin
=
"0 3"
FontSize
=
"10"
/>
</
StackPanel
>
<
TextBlock
Grid.Row
=
"2"
Grid.ColumnSpan
=
"2"
Text
=
"{Binding Body}"
Margin
=
"5 3 5 8"
TextWrapping
=
"Wrap"
/>
</
Grid
>
</
DataTemplate
>
In the lastest version of the GridView, it is now "builtin" that when a user clicks with the right mouse button on a row, it is selected as if the user did a CTRL+Click. I am however not able to disable this behaviour.
We use a context menu on right click and do not want the selected state of a row to change once a user does this. We get a lot of negative feedback about this.
How do I disable this rightclick -> select row behaviour?
Thanks,
Marcel