or
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
telerik:RadMaskedDateTimeInput
Focusable
=
"True"
Grid.Column
=
"0"
FormatString
=
"{Binding Path=Mask, Mode=OneWay}"
HorizontalAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Right"
InputBehavior
=
"Insert"
IsClearButtonVisible
=
"False"
Margin
=
"5"
Mask
=
"{Binding Path=Mask, Mode=OneWay}"
Name
=
"ValueBox"
SelectionOnFocus
=
"CaretToEnd"
SpinMode
=
"PositionAndValue"
TextMode
=
"MaskedText"
UpdateValueEvent
=
"PropertyChanged"
Value
=
"{Binding Converter={StaticResource TimeSpanConverter}, Path=Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment
=
"Center"
/>
<
RepeatButton
Click
=
"IncrementButton_Click"
Focusable
=
"False"
Grid.Column
=
"1"
IsTabStop
=
"False"
Name
=
"IncrementButton"
>
<
Image
>
<
Image.Style
>
<
Style
TargetType
=
"{x:Type Image}"
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeUpDay.png"
/>
<
Style.Triggers
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=IncrementButton, Path=IsEnabled}"
Value
=
"false"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"DayTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeUpDisabledDay.png"
/>
</
MultiDataTrigger
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=IncrementButton, Path=IsEnabled}"
Value
=
"true"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"NightTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeUpNight.png"
/>
</
MultiDataTrigger
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=IncrementButton, Path=IsEnabled}"
Value
=
"false"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"NightTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeUpDisabledNight.png"
/>
</
MultiDataTrigger
>
</
Style.Triggers
>
</
Style
>
</
Image.Style
>
</
Image
>
</
RepeatButton
>
<
RepeatButton
Click
=
"DecrementButton_Click"
Focusable
=
"False"
Grid.Column
=
"2"
IsTabStop
=
"False"
Name
=
"DecrementButton"
>
<
Image
>
<
Image.Style
>
<
Style
TargetType
=
"{x:Type Image}"
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeDnDay.png"
/>
<
Style.Triggers
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=DecrementButton, Path=IsEnabled}"
Value
=
"false"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"DayTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeDnDisabledDay.png"
/>
</
MultiDataTrigger
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=DecrementButton, Path=IsEnabled}"
Value
=
"true"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"NightTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeDnNight.png"
/>
</
MultiDataTrigger
>
<
MultiDataTrigger
>
<
MultiDataTrigger.Conditions
>
<
Condition
Binding
=
"{Binding ElementName=DecrementButton, Path=IsEnabled}"
Value
=
"false"
/>
<
Condition
Binding
=
"{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}"
Value
=
"NightTime"
/>
</
MultiDataTrigger.Conditions
>
<
Setter
Property
=
"Source"
Value
=
"/CustomControls;component/Resources/VolumeDnDisabledNight.png"
/>
</
MultiDataTrigger
>
</
Style.Triggers
>
</
Style
>
</
Image.Style
>
</
Image
>
</
RepeatButton
>
</
Grid
>
private void DecrementButton_Click( object sender, RoutedEventArgs e ) {
ValueBox.CallSpin( false );
}
private void IncrementButton_Click( object sender, RoutedEventArgs e ) {
ValueBox.CallSpin( true );
}
Me
.datarowExtList.Clear()
ItemsSource=
"{Binding datarowExtList}"
SelectionMode=
"Single"
DisplayMemberPath=
"DocDescription"
Private
_datarowExtList
As
ObservableCollection(Of DataRowExt) =
New
ObservableCollection(Of DataRowExt)
Public
Property
datarowExtList()
As
ObservableCollection(Of DataRowExt)
Get
Return
_datarowExtList
End
Get
Set
(
ByVal
value
As
ObservableCollection(Of DataRowExt))
_datarowExtList = value
NotifyPropertyChanged(
"datarowExtList"
)
End
Set
End
Property
<
my:RadTreeView
Margin
=
"2,2,2,0"
IsLineEnabled
=
"True"
Name
=
"RadtreeView1"
IsVirtualizing
=
"True"
tree:TreeViewPanel.VirtualizationMode
=
"Hierarchical"
IsLoadOnDemandEnabled
=
"True"
TabIndex
=
"1"
telerik:TextSearch.TextPath
=
"Fields.Name"
IsDragDropEnabled
=
"False"
SelectionMode
=
"Multiple"
Background
=
"White"
KeyDown
=
"RadtreeView1_KeyDown"
Selected
=
"RadtreeView1_Selected"
ScrollViewer.VerticalScrollBarVisibility
=
"Visible"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
x:Name
=
"RadContext"
Opened
=
"RadContextMenu_Opened"
>
<
MenuItem
Header
=
"Select All Children"
Click
=
"MenuItem_Click"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
<
my:RadTreeView.ItemTemplate
>
<
HierarchicalDataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"{Binding Path=Fields.ImagePath}"
></
Image
>
<
TextBlock
Text
=
"{Binding Path=Fields.Code}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
Width
=
"50"
></
TextBlock
>
<
TextBlock
Text
=
" | "
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
></
TextBlock
>
<
TextBlock
Text
=
"{Binding Path=Fields.Name}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
Width
=
"200"
></
TextBlock
>
<
TextBlock
Text
=
" | "
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
></
TextBlock
>
<
TextBlock
Text
=
"{Binding Path=Fields.Alias}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter}}"
Width
=
"200"
></
TextBlock
>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
my:RadTreeView.ItemTemplate
>
</
my:RadTreeView
>
foreach
(RadTreeViewItem item
in
SelectedNode.ChildrenOfType<RadTreeViewItem>())
{
item.IsSelected =
true
;
}
<telerik:RadDatePicker SelectedDate="{Binding Path=ApplicationDate, Mode=TwoWay}" DisplayDateEnd="{x:Static sys:DateTime.Now}"/>
public DateTime? ApplicationDate
{
get { return Loan.ApplicationDt; }
set
{
if (value > DateTime.Now.Date)
Loan.ApplicationDt = DateTime.Now.Date;
else
Loan.ApplicationDt = value;
RaisePropertyChanged("ApplicationDate");
}
}
Hello,
I’m using the RadGridView in my application to show a list of items. As I started to use grouping, I encountered some problems.
public
static
bool
IsValid(
this
DependencyObject obj) {
// The dependency object is valid if it has no errors,
//and all of its children (that are dependency objects) are error-free.
return
!Validation.GetHasError(obj) &&
GetVisualTreeChildren(obj)
.OfType<DependencyObject>()
.All(child => IsValid(child));
}
//VisualTreeHelper don't have a method to get all the children of a visual object
private
static
IEnumerable GetVisualTreeChildren(DependencyObject parent) {
for
(
int
i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
yield
return
VisualTreeHelper.GetChild(parent, i);
}
//OK handler in VM using the IsValid extension
protected
override
bool
HandleOKCanExecute(
object
arg) {
if
(
this
.TheView !=
null
) {
return
(
this
.TheView.IsValid());
}
return
(
false
);
}