CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: WPF DataGrid

  1. #1
    Join Date
    May 2008
    Posts
    8

    Unhappy WPF DataGrid

    I am running a program on ComponentOne DataGrid along with VS2008, coding is in VB.It is giving 2 errors.
    i)Could not create an instance of type'StaticExtension'
    ii)Cannot find the type 'VisibilityToBoolConverter'

    I am sending the relevant XAML code as well as the VisibilityToBoolConverter.vb code

    <XAML>---code----
    <CheckBox IsChecked="{Binding Visibility ,
    Converter={x:Static local:VisibilityToBoolConverter.Default},
    Mode=TwoWay}"/>
    <TextBlock Text="{Binding Caption}"/>
    </XAML>

    <VisibilityToBoolConverter.vb>---code--
    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Windows.Data
    Imports System.Windows
    Imports System.Globalization

    Namespace NEW_WpfApplication_20_5_08
    Public Class VisibilityToBoolConverter
    Implements IValueConverter

    Public Shared ReadOnly [Default] As New VisibilityToBoolConverter()

    Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
    If TypeOf value Is Visibility Then
    Return CType(value, Visibility) = Visibility.Visible
    Else
    Return Binding.DoNothing
    End If
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
    If TypeOf value Is Boolean Then
    Return If(CBool(value), Visibility.Visible, Visibility.Collapsed)
    Else
    Return Binding.DoNothing
    End If
    End Function
    End Class
    End Namespace
    </VisibilityToBoolConverter.vb>
    Could you please point out the error in my application ?
    Regards
    Arijit

  2. #2
    Join Date
    Feb 2000
    Location
    OH - USA
    Posts
    1,892

    Arrow Re: WPF DataGrid

    Try it as a StaticResource instead:

    http://learnwpf.com/Posts/Post.aspx?...2-a002f2250a64

    http://msdn.microsoft.com/en-us/libr...converter.aspx

    Make sure you use all appropriate namespaces too.
    Good Luck,
    Craig - CRG IT Solutions - Microsoft Gold Partner

    -My posts after 08/2015 = .NET 4.x and Visual Studio 2015
    -My posts after 11/2011 = .NET 4.x and Visual Studio 2012
    -My posts after 02/2010 = .NET 4.0 and Visual Studio 2010
    -My posts after 12/2007 = .NET 3.5 and Visual Studio 2008
    -My posts after 04/2007 = .NET 3.0 and Visual Studio 2005
    -My posts before 04/2007 = .NET 1.1/2.0

    *I do not follow all threads, so if you have a secondary question, message me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured