How to realize PixelLab.Wpf switching effect in wpf
How to achieve PixelLab.Wpf switching effect in wpf? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
/ / define the namespace of pixlab, and configure the switching effect of PixelLab in the xaml page of app or style
Xmlns:lib= "clr-namespace:PixelLab.Wpf.Transitions;assembly=PixelLab.Wpf"
/ / there are many switching effects. You can configure all the lib in the array, as shown in the github code.
.
/ / on the wpf page to which you want to add a switch, add the namespace of pixlab
Xmlns:lib= "clr-namespace:PixelLab.Wpf.Transitions;assembly=PixelLab.Wpf
/ / add the host control of the switching control, the type is ContentControl, and change the control in it to achieve the switching effect.
The binding method is used here. The use of mvvmlight can be searched on the Internet. Transition is the switching effect, that is, the switching effect defined above, and Content is the switching control.
/ / effect object of animation switch
Private Transition _ mainTrans = null
Public Transition MainTrans
{
Get
{
Return _ mainTrans
}
Set
{
Set (() = > MainTrans, ref _ mainTrans, value)
}
}
/ / content controls for animation switching
Private object _ transObject = null
Public object TransObject
{
Get
{
Return _ transObject
}
Set
{
Set (() = > TransObject, ref _ transObject, value)
}
}
/ / the effect can be achieved by pressing the following settings in the code
TransObject = null
MainTrans = "effect of switching"
TransObject = "switched object"
This is the answer to the question about how to achieve PixelLab.Wpf switching effect in wpf. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.