My company is stuck on .Net 3.0. The task I am trying to tackle is simple, I need to bind the IsChecked property of the CheckBoxResolvesCEDAR to the CompletesCEDARWork in my Audio class. The more I read about this it appears that I have to declare CompletesCEDARWork as dependancy propert, but I can not find a good example of how this is done. I found this example, but when I pasted into my code I get an "is not defined" error for GetValue and I have not successfully figure out what MyCode is supposed to represent. Any help/examples would be greatly appreciated.
Thanks
Public Shared ReadOnly IsSpinningProperty As DependencyProperty = DependencyProperty.Register("IsSpinning", GetType(Boolean), GetType(MyCode))
Public Property IsSpinning() As Boolean
Get
Return CBool(GetValue(IsSpinningProperty))
End Get
Set(ByVal value As Boolean)
SetValue(IsSpinningProperty, value)
End Set
End Property
Here is my slimed down Audio Class as it stands now.
Imports System.Xml
Imports System Imports System.IO Imports System.Collections.ObjectModel Imports System.ComponentModel
Public Class Audio
Private mXMLString As String
Private mTarpID As Integer
Private mStartTime As Date
Private mEndTime As Date
Private mAudioArray As Byte()
Private mFileXMLInfo As IO.FileInfo
Private mFileXMLStream As IO.FileStream
Private mFileAudioInfo As IO.FileInfo
Private mDisplayText As String
Private mCompletesCEDARWork As Boolean
Private Property CompletesCEDARWork() As Boolean
Get
Return mCompletesCEDARWork
End Get
Set(ByVal value As Boolean)
mCompletesCEDARWork = value
End Set
End Property
And here is my XML Datatemplate where I set the binding.
<DataTemplate x:Key="UploadLayout" DataType="Audio">
<Border BorderBrush="LightGray" CornerRadius="8" BorderThickness="1" Padding="10" Margin="0,3,0,0">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Path=DisplayText}">
</TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="TARP ID" VerticalAlignment="Center"/>
<ComboBox x:Name="ListBoxTarpIDs"
ItemsSource="{Binding Path=TarpIds}"
SelectedValue="{Binding Path=TarpID}"
BorderBrush="Transparent"
Background="Transparent" >
</ComboBox>
</StackPanel>
<CheckBox x:Name="CheckBoxResolvesCEDAR"
Content="Resolves CEDAR Work"
IsChecked="{Binding ElementName=Audio,Path=CompletesCEDARWork,Mode=TwoWay}"/>
</StackPanel>
</Border>
</DataTemplate>