Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145206 | Jun 12,2019 12:18 PM UTC | Jun 17,2019 05:55 AM UTC | UWP | 3 |
![]() |
Tags: SfKanban |
<ResourceDictionary>
<local:StringToColorConvertor x:Key="stringToColorConvertor"/>
<DataTemplate x:Key="TagsTemplate">
<Border Background="#FFEDEDED" CornerRadius="2" >
<TextBlock Text="{Binding}" HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis" Margin="10,1,10,1"
FontSize="10" VerticalAlignment="Center"
Foreground="#FF454545" />
</Border>
</DataTemplate>
<DataTemplate x:Key="KanbanCardTemplate">
<Border BorderBrush="{Binding ColorKey , Converter={StaticResource stringToColorConvertor}}"
BorderThickness="2"
CornerRadius="{Binding Tag.CardStyle.CornerRadius ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
MinHeight="100"
Background="{Binding Tag.CardStyle.Background ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
MaxHeight="300" Height="Auto" Margin="0,6,0,6">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Grid.ColumnSpan="1" Margin="8,5,2,2">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="4*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="KANBAN_Title" Grid.Row="0"
TextWrapping="NoWrap"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
HorizontalAlignment="{Binding Tag.CardStyle.TitleHorizontalAlignment ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontSize="{Binding Tag.CardStyle.TitleFontSize ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
FontWeight="Bold"
Foreground="{Binding Tag.CardStyle.TitleColor ,RelativeSource={RelativeSource Mode=TemplatedParent}}" />
<TextBlock x:Name="KANBAN_Description" Grid.Row="1"
TextWrapping="Wrap" MaxHeight="50"
Text="{Binding Description}"
TextTrimming="CharacterEllipsis"
FontSize="{Binding Tag.CardStyle.FontSize ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
Foreground="{Binding Tag.CardStyle.Foreground ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
HorizontalAlignment="Left" VerticalAlignment="Center"
Height="Auto" />
<ScrollViewer Grid.Row="2" Grid.ColumnSpan="1" VerticalAlignment="Bottom"
Margin="0,4,0,2"
Visibility="{Binding Tag.CardStyle.TagVisibility ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Disabled">
<kanban:TagsStackPanel x:Name="KANBAN_TagsPanel"
Orientation="Horizontal"
ContentTemplate="{StaticResource TagsTemplate}"
TagsCollection="{Binding Tags}"
DataContext="{Binding}" Height="Auto" >
</kanban:TagsStackPanel>
</ScrollViewer>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Border BorderBrush="#FFE4E5E6" BorderThickness="1.5"
Grid.Row="1" x:Name="KANBAN_ProfileIcon"
CornerRadius="50"
Visibility="{Binding Tag.CardStyle.IconVisibility ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
Height="50" Width="50"
HorizontalAlignment="Left" VerticalAlignment="Center" >
<Border.Background>
<ImageBrush ImageSource="{Binding ImageURL}" Stretch="Fill" />
</Border.Background>
</Border>
<Border Grid.Row="2" BorderThickness="0" CornerRadius="0,0,6,0" Margin="0,0,-1,-1"
Height="30" Width="30"
Visibility="{Binding Tag.CardStyle.IndicatorVisibility ,RelativeSource={RelativeSource Mode=TemplatedParent}}"
DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Right">
<Border.Background>
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.5" />
<GradientStop Color="{Binding Tag.IndicatorColor}" Offset="0.5" />
</LinearGradientBrush>
</Border.Background>
</Border>
</Grid>
</Grid>
</Border>
</DataTemplate>
</ResourceDictionary>
<Grid>
<Grid.DataContext>
<local:TaskDetails></local:TaskDetails>
</Grid.DataContext>
<kanban:SfKanban x:Name="Kanban" ItemsSource="{Binding Tasks}" CardTemplate="{StaticResource KanbanCardTemplate}">
</kanban:SfKanban>
</Grid> |
public class StringToColorConvertor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value.ToString() == "Low")
{
return new SolidColorBrush(Colors.Blue);
}
if (value.ToString() == "Normal")
{
return new SolidColorBrush(Colors.Green);
}
if (value.ToString() == "High")
{
return new SolidColorBrush(Colors.Red);
}
return new SolidColorBrush(Colors.Transparent);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value;
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.