WPF Grid

  • 9 years ago

    Hi,

    Iam working on WPF Datagrid with VS2008, code is in VB. I wish to provide facility  to user to select "Columns" of a Table using ListBox(if possible, by clicking on Checkboxes within the ListBox) and the Report will be generated for those selected "Columns" only. Selection to be made at run time !

    I have run the program , but 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>
    <CheckBox IsChecked="{Binding Visibility ,
                        Converter={x:Static local:VisibilityToBoolConverter.Default},
                                    Mode=TwoWay}"/>
        <TextBlock Text="{Binding Caption}"/>
    </XAML>


    <VisibilityToBoolConverter.vb>
    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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay