The thing is, i want to be able to add custom user controls to the TransitionControl. Something like...
...and to be able to implement custom transition logic inside the inherited class.
Now, the class CardControl inherits from RadTransitionControl, like shown below:
As you can see, I've added the ContentPropertyAttribute, which in turn, should allow the user to add items in XAML, and store them in the Items property. It works, if i use a single item, but it shows no reaction, when i try to use the collection of UIElements.
Any ideas on how to make it work?
Thanks,
<
local:CardControl
>
<
Button
Content
=
"Hello"
/>
<
Button
Content
=
"Hello"
/>
</
local:CardControl
>
...and to be able to implement custom transition logic inside the inherited class.
Now, the class CardControl inherits from RadTransitionControl, like shown below:
[ContentProperty(
"Items"
)]
[ContentWrapper(
typeof
(Collection<UIElement>))]
public
class
CardControl : RadTransitionControl
{
public
static
readonly
DependencyProperty ItemsProperty =
DependencyProperty.Register(
"Items"
,
typeof
(Collection<UIElement>),
typeof
(CardControl),
new
FrameworkPropertyMetadata(
new
Collection<UIElement>(),
FrameworkPropertyMetadataOptions.AffectsRender
, OnItemsChanged));
public
Collection<UIElement> Items
{
get
{
return
(Collection<UIElement>)GetValue(ItemsProperty); }
set
{
SetValue(ItemsProperty, value);
}
}
public
CardControl()
{
}
private
static
void
OnItemsChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs)
{
(dependencyObject
as
CardControl).Content = (eventArgs.NewValue
as
Collection<UIElement>)[0];
}
}
As you can see, I've added the ContentPropertyAttribute, which in turn, should allow the user to add items in XAML, and store them in the Items property. It works, if i use a single item, but it shows no reaction, when i try to use the collection of UIElements.
Any ideas on how to make it work?
Thanks,