or
<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); }<telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" > <telerik:GridViewColumn.ToolTipTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding ID}" Foreground="Red" /> <TextBlock Text=" - " /> <TextBlock Text="{Binding Text}" Foreground="Blue" /> </StackPanel> </DataTemplate> </telerik:GridViewColumn.ToolTipTemplate></telerik:GridViewDataColumn><ControlTemplate> <Grid Name="ParentGrid" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Label Grid.Row="0" Name="TitleBar" Background="WhiteSmoke" VerticalAlignment="Top" HorizontalContentAlignment="Center" Content="{Binding Title, RelativeSource={RelativeSource Mode=TemplatedParent}}"/> <!--CartesianChart template--> <Border Grid.Row="1" x:Name="layoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <Grid> <ContentPresenter x:Name="emptyContent" ContentTemplate="{TemplateBinding EmptyContentTemplate}" Content="{TemplateBinding EmptyContent}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> <Canvas x:Name="adornerContainer" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Canvas x:Name="labelContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Canvas x:Name="renderSurface" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Border x:Name="plotAreaDecoration" Style="{TemplateBinding PlotAreaStyle}"/> </Canvas> </Canvas> </Canvas> </Grid> </Border> </Grid></ControlTemplate>Stream stream = File.OpenRead("<path-to-file>");ImageInline image = new ImageInline(stream, new Size(30, 30), ".jpg");image.Tag = "<some-custom-information>";richTextBox.InsertImage(image);