Hello,
I am using RadToolbar with ItemsSource.
Here is code:
ItemTemplate:
When I add elements to ExtToolbarButtons collection I see normal - styled buttons.
How to use ItemsSource with telerik - styled buttons on RadToolbar?
I am using RadToolbar with ItemsSource.
Here is code:
<
telerik:RadToolBar
Grid.Row
=
"0"
Grid.Column
=
"0"
FocusManager.IsFocusScope
=
"False"
ItemsSource
=
"{TemplateBinding local:TBaseReadsWn.ExtToolbarButtons}"
ItemTemplate
=
"{StaticResource dtToolbarButton}"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Left"
VerticalContentAlignment
=
"Center"
Padding
=
"30 4 0 4"
>
</
telerik:RadToolBar
>
ItemTemplate:
<
DataTemplate
x:Key
=
"dtToolbarButton"
DataType
=
"UICommandItem"
>
<
Button
Command
=
"{Binding Command}"
CommandParameter
=
"{Binding CommandParameter}"
Margin
=
"{Binding Margins}"
IsEnabled
=
"{Binding IsEnabled}"
ToolTip
=
"{Binding ToolTip}"
Width
=
"22"
Height
=
"20"
>
<
Button.Content
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"Auto"
></
ColumnDefinition
>
</
Grid.ColumnDefinitions
>
<
Image
Grid.Row
=
"0"
Grid.Column
=
"0"
Name
=
"img"
Style
=
"{StaticResource stlImgBtnIm}"
Source
=
"{Binding Image}"
></
Image
>
<
TextBlock
Grid.Row
=
"0"
Grid.Column
=
"1"
Style
=
"{StaticResource stlImgBtnTb}"
Text
=
"{Binding Text}"
></
TextBlock
>
</
Grid
>
</
Button.Content
>
</
Button
>
<
DataTemplate.Triggers
>
<
DataTrigger
Binding
=
"{Binding Image}"
Value
=
"{x:Null}"
>
<
DataTrigger.Setters
>
<
Setter
TargetName
=
"img"
Property
=
"Visibility"
Value
=
"Collapsed"
></
Setter
>
</
DataTrigger.Setters
>
</
DataTrigger
>
<
DataTrigger
Binding
=
"{Binding Margins}"
Value
=
"0"
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"Margin"
Value
=
"2 2 2 2"
></
Setter
>
</
DataTrigger.Setters
>
</
DataTrigger
>
</
DataTemplate.Triggers
>
</
DataTemplate
>
When I add elements to ExtToolbarButtons collection I see normal - styled buttons.
How to use ItemsSource with telerik - styled buttons on RadToolbar?