or
<
RichTextBox
Margin
=
"22,38,108,124"
Name
=
"richTextBox1"
IsDocumentEnabled
=
"True"
>
<
FlowDocument
>
<
Paragraph
>
<
Bold
>Hi</
Bold
> Welcome to Semanticspace
<
Hyperlink
NavigateUri
=
"http://www.semanticspace.com"
RequestNavigate
=
"Hyperlink_RequestNavigate"
>Semanticspace
</
Hyperlink
>
</
Paragraph
>
</
FlowDocument
>
</
RichTextBox
>
private
void
Hyperlink_RequestNavigate(
object
sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(
"IExplore.exe"
, e.Uri.ToString());
}
public
sealed
class
User
{
public
string
Firstname
{
get
;
set
;
}
public
string
Lastname
{
get
;
set
;
}
public
ObservableCollection<Right> Rights
{
get
;
set
;
}
public
ObservableCollection<LogEntry> LogEntries
{
get
;
set
;
}
public
User(
string
firstname,
string
lastname)
{
this
.Firstname = firstname;
this
.Lastname = lastname;
this
.Rights =
new
ObservableCollection<Right>();
this
.LogEntries =
new
ObservableCollection<LogEntry>();
}
}
public
sealed
class
RightsCollection
{
public
RightsCollection()
{
this
.Name =
"Rights"
;
this
.Rights =
new
ObservableCollection<Right>();
}
public
string
Name
{
get
;
set
;
}
public
ObservableCollection<Right> Rights
{
get
;
set
;
}
}
public
sealed
class
Right
{
public
string
Name
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
public
bool
Value
{
get
;
set
;
}
public
Right(
string
name)
{
this
.Name = name;
this
.Description = String.Empty;
this
.Value =
true
;
}
public
Right(
string
name,
string
description)
:
this
(name)
{
this
.Description = description;
}
public
Right(
string
name,
string
description,
bool
value)
:
this
(name, description)
{
this
.Value = value;
}
}
<
UserControl.Resources
>
<
local:Users
x:Key
=
"UserCollection"
/>
<
HierarchicalDataTemplate
x:Key
=
"Right"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Rights"
ItemTemplate
=
"{StaticResource Right}"
ItemsSource
=
"{Binding Rights}"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Users"
ItemTemplate
=
"{StaticResource Rights}"
ItemsSource
=
"{Binding Rights}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding Lastname}"
/>
<
TextBlock
Text
=
", "
/>
<
TextBlock
Text
=
"{Binding Firstname}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
UserControl.Resources
>
<
telerik:RadTreeView
IsLineEnabled
=
"True"
ItemsSource
=
"{Binding Source={StaticResource UserCollection}}"
ItemTemplate
=
"{StaticResource Users}"
/>
<
DataTemplate
x:Key
=
"ItemTemplate"
>
<
Grid
Width
=
"350"
Height
=
"450"
>
<
Grid.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#FFFFFEA0"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FFFFFE6A"
Offset
=
"0.567"
/>
</
LinearGradientBrush
>
</
Grid.Background
>
<
TextBox
Grid.Row
=
"1"
Text
=
"{Binding Path=Content,Mode=TwoWay}"
Background
=
"Transparent"
/>
</
Grid
>
</
DataTemplate
>
<telerik:RadGridView >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="{Binding Dag1}"
UniqueName="test1"
Style="{StaticResource KalenderDagColumnStyle}">
...public MainWindow()
{
InitializeComponent();
this.DataContext = this;
Dag1 = DateTime.Today;
Dag2 = DateTime.Today.AddDays(9);
}
public DateTime Dag1 { get; set; }
public DateTime Dag2 { get; set; }
The KalenderDagColumnStyle is a StyleSelector<local:DatumKolomStyleSelector x:Key="DatumKolomStyleSelector"
WeekdagStyle="{StaticResource WeekdagCellStyle}"
WeekendStyle="{StaticResource WeekendCellStyle}"
VandaagStyle="{StaticResource VandaagCellStyle}" />
<Style x:Key="KalenderDagColumnStyle"
TargetType="telerik:GridViewDataColumn">
<Setter Property="HeaderCellStyle"
Value="{StaticResource KalenderDagHeaderStyle}" />
<Setter Property="CellStyleSelector"
Value="{StaticResource DatumKolomStyleSelector}" />
</Style>
public class DatumKolomStyleSelector : StyleSelector
{
public Style VandaagStyle { get; set; }
public Style WeekendStyle { get; set; }
public Style WeekdagStyle { get; set; }
public override Style SelectStyle(object item, DependencyObject container)
{
GridViewCell c = container as GridViewCell;
DateTime d = (DateTime)c.Column.Header;
if (d == DateTime.Today)
return VandaagStyle;
else if (d.DayOfWeek == DayOfWeek.Saturday || d.DayOfWeek == DayOfWeek.Sunday)
return WeekendStyle;
else
return WeekdagStyle;
}
}
When a column represents Today, it has a style, when its a weekend day, it has a style, and otherwise it has another style
In Q2 c.Column.Header had a value in the SelectStyle method,
in Q3 c.Column.Header is null in the SelectStyle method .
When i hardcode the headers then the value is not null in the SelectStyle method,
but bound values are apparently not available in the style selector
Is this expected behaviour ? is there a way around for me ? ( using Tag instead of Header does not make a difference).
The column headers must be data-bound, because the user can scroll back and forwards in time.
I would have attached a sample solution to this thread; but apparently zips are not allowed