Hi Diptimaya Patra!
I tried your Timeline Control Sample and its great!
I changed the count of your
TimeScale.cs columns to two because i want to set a period of time with a rectangle and its cutted if it will overlapp the next column.
public class TimeScale
{
public string FirstCol { get; set; }
public string SecondCol { get; set; }
}

It works fine if i add the rectangle in the
TimelineControl.xaml.cs Class if the control is loaded (
void TimelineControl_Loaded(object sender, RoutedEventArgs e))
It looks like this:
Rectangle rt1 = new Rectangle();
rt1.Name = "rectangle1";
rt1.Width = 120;
rt1.Height = 50;
rt1.StrokeThickness = 0;
rt1.Visibility = Visibility.Visible;
SolidColorBrush myBrush1 = new SolidColorBrush(Colors.Red);
rt1.Fill = myBrush1;
StackPanel2.Children.Insert(12, rt1);
But now i want to add this rectangle by pushing the button in
MainWindow.xaml.cs:
private void button1_Click(object sender, RoutedEventArgs e)
{
TimelineControl tc = new TimelineControl();
Rectangle rt = new Rectangle();
rt.Name = "AddedRectangle";
rt.Width = 10;
rt.Height = 50;
rt.StrokeThickness = 0;
rt.Visibility = Visibility.Visible;
SolidColorBrush myBrush = new SolidColorBrush(Colors.Red);
rt.Fill = myBrush;
tc.StackPanel2.Children.Insert(2, rt);
}
But nothing happens if i push the button...
What did i do wrong or how can i do this ?
Regards
Peter