We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind custom business object to SFKanban card

Thread ID:

Created:

Updated:

Platform:

Replies:

141971 Jan 14,2019 12:25 AM UTC Jan 16,2019 07:08 AM UTC WPF 1
loading
Tags: SfKanban
ICS
Asked On January 14, 2019 12:25 AM UTC

I am attempting to create a custom Kanban card view to use inside of the SfKanban control. I have it mostly working, except that the binding values do not show correctly. My SfKanban control is set up as follows:

<kanban:SfKanban Grid.Row="1"  
                                 ItemsSource="{Binding CurrentResources}"
                                 MaxColumnWidth="200"
                                 CardDragEnd="SfKanban_CardDragEnd"
                                 CardDragStart="SfKanban_CardDragStart"
                                 Columns="{Binding TacPlanColumns}"
                                 ColumnMappingPath="TacPlanName"
                                 ColumnsGenerated="SfKanban_ColumnsGenerated"
                                 AutoGenerateColumns="True"
                                 x:Name="kanban">
                    <!--CardTemplate="{StaticResource ResourceCard}">-->
                    <kanban:SfKanban.CardTemplate>
                        <DataTemplate>
                            <controls:ResourceCard Value="{Binding}"/>
                        </DataTemplate>
                    </kanban:SfKanban.CardTemplate>
                </kanban:SfKanban>

The columns are created successfully, and the correct number of cards show up, but Value is not bound in the ResourceCard control. 

The ResourceCard.xaml uses the following:
<Border Background="White" BorderBrush="Black" BorderThickness="2" CornerRadius="4" Margin="2">
        <Grid Background="White" Margin="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="30"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="5"/> <!-- par timer -->
            </Grid.RowDefinitions>
            
            <TextBlock Grid.Column="0" Grid.Row="0" Margin="1" Text="{Binding ResourceId}" FontWeight="Bold" Style="{DynamicResource TextBlockStyle}"/>
            <TextBlock Grid.Column="0" Grid.Row="1" Margin="1" Text="{Binding AssignedPersons}" FontStyle="Italic" Style="{DynamicResource TextBlockStyle}"/>
            <skia:SKElement x:Name="canvasView" PaintSurface="CanvasView_PaintSurface" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Margin="0"/>
            <Image Grid.Column="1" Grid.Row="0" Source="{Binding StatusImagePath}" Height="30" Width="30"/>
            <Image Grid.Column="1" Grid.Row="1" Source="{Binding InChargeImagePath}" Height="30" Width="30"/>
            
        </Grid>
    </Border>

In the code behind, I have added a DependencyProperty for Value, but it is never set. 

I have looked at previous questions about this on this forum, and they have been provided links to the Getting Started project, which does not do what I need it to do. Is this even possible?




Muneesh Kumar G [Syncfusion]
Replied On January 16, 2019 07:08 AM UTC

Hi Dev, 
 
Greetings, we have analyzed your query and code snippet and checked the same with our sample. We suspect that you have not implemented OnPropertyChanged method handler for that dependency property. We have tested this handler with property changed, it works fine. Please find the code snippet below.  
 
public partial class ResourceCard : UserControl 
    { 
        public ResourceCard() 
        { 
            InitializeComponent(); 
        } 
 
        public object Value 
        { 
            get { return (object)GetValue(ValueProperty); } 
            set { SetValue(ValueProperty, value); } 
        } 
 
        // Using a DependencyProperty as the backing store for Value.  This enables animation, styling, binding, etc... 
        public static readonly DependencyProperty ValueProperty = 
            DependencyProperty.Register("Value", typeof(object), typeof(ResourceCard), new PropertyMetadata(null, OnValueChanged)); 
 
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
        { 
            var value = e.NewValue; 
        } 
    } 
 
We have prepared a sample based on your code snippet, please find it in below location.  
 
 
If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to give better solution in this. 
 
Thanks,     
Muneesh Kumar G.   
 


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;