Reputation: 8384
I have the following template for a ButtonEdit
:
<dxg:GridControl.Columns>
<dxg:GridColumn Width="100"
AllowEditing="False"
AutoFilterCondition="Default"
FieldName="Information"
Header="Info"
ShowInColumnChooser="False"
SortOrder="Ascending"
VisibleIndex="0">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:ButtonEdit x:Name="PART_Editor" AllowDefaultButton="False">
<my:ButtonInfoCustom ContentTemplate="{StaticResource MyDataTemplate}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type dxg:GridControl}}}"
GlyphKind="Custom"
IsEnabled="{Binding}"
Tag="Info1"
ToolTip="Action 1" />
</dxe:ButtonEdit>
</DataTemplate>
I can add Image
it with a DataTemplate
, but these images are separate resources:
<DataTemplate x:Key="MyDataTemplate">
<Image Source="/Assembly1;component/Icons/main_icon.png" />
</DataTemplate>
I intend to use a Glyph
from the Icon Library just like this:
<dx:SimpleButton x:Name="btn1"
Width="Auto"
Height="25"
HorizontalAlignment="Left"
Content="Add info"
Glyph="{dx:DXImageOffice2013 Image=Add_16x16.png}" />
How could I add a Glyph
for the ButtonEdit
?
Upvotes: 0
Views: 1989
Reputation: 8384
Well, you can change the ContentTemplate into a DataTemplate and simply put a control with a Glyph
property into that:
<dxe:ButtonEdit Name="PART_Editor" AllowDefaultButton="False">
<my:ButtonInfoCustom>
<my:ButtonInfoCustom.Template>
<DataTemplate>
<dx:SimpleButton x:Name="PART_Item" Width="Auto" Height="Auto"
Glyph="{dx:DXImageOffice2013 Image=Cancel_16x16.png}"
IsEnabled="{Binding IsThisButtonEnabled}"
Tag="Info1" ToolTip="Action 1" />
</DataTemplate>
</my:ButtonInfoCustom.Template>
</my:ButtonInfoCustom>
</dxe:ButtonEdit>
Upvotes: 1