vMix Forums
»
General
»
General Discussion
»
Xaml and codebehind experts
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Hi
Will vMix title Xaml codebehind allow to trigger an animation based on the content of a textblock ( or other control) ?
Thanks to the 'DynamicImage title' Martin posted I was able to use this example to autoupdate a listdisplay from a xml file. Using another title ( as .dll) I managed to let animation play coded in codebehind. So certain things I managed to get working.
As externally triggering animations (similar to what Casparcg does with its flash templates) is not an option I thought about using values as triggers
aim is to animate in a extra background to display some info only when needed in addition to the standaard ones shown at load. Trying to avoid having to use 2 or more titles for the effect.
thanks Guy
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Not managing any form of triggered animation :-( But at least I can make a "background" disappear when a value is empty. Quote:Imports System.Windows.Threading Imports System.Windows.Media.Imaging Imports System.IO Imports System.Windows.Media.Animation
Public Class UserControl1
Private Sub UserControl1_DataContextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LayoutUpdated If ToHideLabel.Text = "" Then ToHideBox.Visibility = System.Windows.Visibility.Hidden Else ToHideBox.Visibility = System.Windows.Visibility.Visible End If
End Sub End Class
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/6/2014(UTC) Posts: 62 Location: Texas, US
Thanks: 21 times Was thanked: 13 time(s) in 10 post(s)
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 2/2/2018(UTC) Posts: 13 Location: Foz do Iguaçu
Thanks: 5 times
|
Hi friends, How can I use that?? Originally Posted by: doggy Not managing any form of triggered animation :-( But at least I can make a "background" disappear when a value is empty. Quote:Imports System.Windows.Threading Imports System.Windows.Media.Imaging Imports System.IO Imports System.Windows.Media.Animation
Public Class UserControl1
Private Sub UserControl1_DataContextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LayoutUpdated If ToHideLabel.Text = "" Then ToHideBox.Visibility = System.Windows.Visibility.Hidden Else ToHideBox.Visibility = System.Windows.Visibility.Visible End If
End Sub End Class
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Originally Posted by: claudeir Hi friends, How can I use that??
To show or hide a colored rectangle or By using this bit of code in your xaml title ( using Blend for Visual Studio ) You might have noticed that the original post is 5 years old and I knew zero about xaml . Ultimately this bit code was "found" by comparing the example mentioned (still available for download) and a lot of using Google ;-)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/22/2020(UTC) Posts: 47 Location: Montpellier Thanks: 14 times Was thanked: 2 time(s) in 2 post(s)
|
Hi Doggy ! I allow myself into this conversation as I'm currently having trouble right into the topic. If you remember, I'm working on my bar charts project, data is binded to Gsheet, so I use the data manager to change what graph I want to see. There's an animation when the graph is set on screen, but I'll have to change quickly from on line to another one but the bars won't get updated : Only the text and it's position will. Here is the video showing my issue : I made this using BarGraph Elements in Blend for Visual Studio, I managed to change the style of them, and now I feel like I have to confront myself to codebehind. I tried to use EventTriggers as below : Code:
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RangeBase.Value)" Storyboard.TargetName="progressBar8">
<SplineDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:1.7" Value="{Binding Path=Text, ElementName=ValProg8}" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
With below : Code: <TextBlock Name="BarValTrig1" Text="{Binding Path=Text,ElementName=ValBar1, NotifyOnTargetUpdated=True}" FontSize="72" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" />
From what I understood I need this "BarValTrig1" Text to send the update notification that should get triggered in the code above, but it doesn't work. Would've been amazing! So I think my last chance is to use code behind and .dll I understood (From our talks and Google) that I should :- Make the .XAML file - Create the code behind - Trigger the animation when a data is changed, using the INotifyPropertyChanged or any other triggering solution. - Compile the .dll - Import both .dll and .xaml to VMIX.So we are in the "XAML and Codebehind" topic, here is my question : How to create and compile the .dll ? How to bind my XAML and CS code ? Thanks a lot :) David
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Looks nice ! Quote:- Import both .dll and .xaml to VMIX. no , only the .dll it looks like you are not triggering the animations on a data change , that is they are only triggering on loading the title which is standard in vMix Quote:use code behind and .dll Yes or just reload the title meaning overlay of and on again (currently)?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/22/2020(UTC) Posts: 47 Location: Montpellier Thanks: 14 times Was thanked: 2 time(s) in 2 post(s)
|
Thanks a lot ! Originally Posted by: doggy no , only the .dll
Ok, so the xaml is embedded in the .dll file ? Originally Posted by: doggy it looks like you are not triggering the animations on a data change , that is they are only triggering on loading the title which is standard in vMix
Exactly. I found out that vMix triggers "Storyboard 1" for the IN animation and "Storyboard 2" for the OUT. It looks like it's proper XAML, but it doesn't trigger. When I test it with the opacity of a textblock, it almost works : The text disappears, but not following the animation. I tried this example : Code:<DataTemplate.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:5" To="0.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="idField"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</DataTemplate.Triggers>
With Code:<TextField Name="idField" Text="{Binding ID, NotifyOnTargetUpdated=True}" />
Found there : https://stackoverflow.co...animation-on-data-changeOriginally Posted by: doggy Yes or just reload the title meaning overlay of and on again (currently)?
You mean : Play OUT animation -> changing data line -> play IN ? It could work of course, but the thing is there's a journalist explaining every numbers from every cities quickly, so it's been asked to switch without going back to the journalist camera. (But if I can't make it they won't have choice :D ) Thanks again Doggy ! You really helped me out with this !
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/22/2020(UTC) Posts: 47 Location: Montpellier Thanks: 14 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy Thanks a lot, I've read this a lot unfortunately, and I don't think it helps : Trigger works fine for mouse changes, but for data content it is said the best is DataTrigger. But those works when you know what value will be given. So the last option remaining is EventTrigger, but as I said earlier it looks like it's not working :/ //And I still don't get how to create a simple 1 textbox .dll :/EDIT : I managed to create my first .dll ! With it's IN and OUT animation. Now I'm working on calling storyboards and getting the IPropertyChangedValue trigger
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Quote:works when you know what value will be given or compare old value with new ;-)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/22/2020(UTC) Posts: 47 Location: Montpellier Thanks: 14 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy or compare old value with new ;-)
Hey this would be awesome, but it can be compared only on codebehind right ? Or does xaml handles it ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,287 Location: Belgium Thanks: 295 times Was thanked: 967 time(s) in 801 post(s)
|
Originally Posted by: davidcallahan Originally Posted by: doggy or compare old value with new ;-)
Hey this would be awesome, but it can be compared only on codebehind right ? Or does xaml handles it ? Codebehind check pm
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Xaml and codebehind experts
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close