<Page.Resources>
<local:ImageConverter x:Key="imageConverter" />
</Page.Resources>
<syncfusion:SfTreeGrid.Columns>
<syncfusion:TreeGridTextColumn Width="150"
MappingName="Name"
SetCellBoundValue="True">
<syncfusion:TreeGridTextColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0"
MinWidth="35"
Margin="1,6,0,6"
Source="{Binding Converter={StaticResource imageConverter}}" />
<TextBlock Grid.Column="1"
Margin="2"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Path=Value}" />
</Grid>
</DataTemplate>
</syncfusion:TreeGridTextColumn.CellTemplate>
</syncfusion:TreeGridTextColumn> |
internal class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var datacontext = value as DataContextHelper;
if (datacontext.Value.ToString() == "Inbox" || datacontext.Value.ToString() == "Drafts" || datacontext.Value.ToString() == "Sent Items"
|| datacontext.Value.ToString() == "Deleted Items" || datacontext.Value.ToString() == "Calendar" || datacontext.Value.ToString() == "Contacts")
return "ms-appx:///Images///" + datacontext.Value.ToString() + ".png";
return "ms-appx:///Images///" + "Folder.png";
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return null;
}
}
|
Hi Muthukuma
Just what I was looking for , thanks for your help.
regards
Tony Broome
<Style TargetType="syncfusion:TreeGridExpander">
<Setter Property="Foreground" Value="{StaticResource ApplicationForegroundThemeBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Gray" />
<Setter Property="BorderThickness" Value="1,1,1,1" />
<Setter Property="FontSize" Value="12" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="syncfusion:TreeGridExpander">
<Border Background="Transparent"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ExpandedState">
<VisualState x:Name="Expanded">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CollapseCellPath" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
. . . . . .
. . . . . .
. . . . . .
<Grid Background="{TemplateBinding Background}">
<Path x:Name="PART_CollapseCellPath"
Margin="1"
Data="F1M0.697,8.01L0,7.293 3.373,4.005 0,0.717 0.697,0 4.804,4.005z"
Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
RenderTransformOrigin="0.5,0.5"
Visibility="Collapsed"/>
<Path x:Name="PART_ExpanderCellPath"
Margin="1"
Data="F1M4.005,4.805L0,0.698 0.717,0 4.005,3.373 7.293,0 8.01,0.698z"
Fill="{TemplateBinding Foreground}"
RenderTransformOrigin="0.5,0.5"
Stretch="Uniform"
Visibility="Visible"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> |