When you place a transition control in a ViewBox (specifically with the Fade transition, but mostly on all of them), it does a strange scaling. The text starts out tiny, then goes large, then fades. In other examples I have done, it starts out almost 2x as large as it should and then fades normally. Is there a way to stop if from doing this?
See the below code example:
See the below code example:
<
Window
x:Class
=
"WpfApplication20.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
telerik:FadeTransition
x:Key
=
"fadeTransition"
/>
</
Window.Resources
>
<
Grid
>
<
Viewbox
>
<
telerik:RadTransitionControl
x:Name
=
"tran"
Transition
=
"{StaticResource fadeTransition}"
Content
=
"{Binding Text}"
>
<
telerik:RadTransitionControl.ContentTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding}"
></
TextBlock
>
</
DataTemplate
>
</
telerik:RadTransitionControl.ContentTemplate
>
</
telerik:RadTransitionControl
>
</
Viewbox
>
</
Grid
>
</
Window
>
public
partial
class
MainWindow : Window , INotifyPropertyChanged
{
DispatcherTimer _timer =
null
;
public
MainWindow()
{
InitializeComponent();
_timer =
new
DispatcherTimer();
_timer.Interval = TimeSpan.FromSeconds(1);
_timer.Tick += _timer_Tick;
this
.DataContext =
this
;
_timer.Start();
}
int
count = 0;
private
string
_text =
"0"
;
public
string
Text
{
get
{
return
_text;
}
set
{
if
(_text != value)
{
_text = value;
this
.NotifyOfPropertyChange(
"Text"
);
}
}
}
#region INotifyPropertyChanged Members
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
NotifyOfPropertyChange(
string
prop)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(prop));
}
}
#endregion
void
_timer_Tick(
object
sender, EventArgs e)
{
count++;
Text = count.ToString();
}
}