Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8680217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:11:31+00:00 2026-06-12T21:11:31+00:00

Am having a list view with one GridViewColumn GridViewColumn gvc = new GridViewColumn(); DataTemplate

  • 0

Am having a list view with one GridViewColumn

        GridViewColumn gvc = new GridViewColumn();

        DataTemplate dt = new DataTemplate();
        FrameworkElementFactory ch = new FrameworkElementFactory(typeof(CheckBox));

        Binding bind= new Binding("Empty");
        ch.SetBinding(CheckBox.IsCheckedProperty, bind);

        dt.VisualTree = ch;
        gvc.CellTemplate = dt;
        (lv.View as GridView).Columns.Add(gvc);

later when I want to retrieve whether the checkbox is checked or not am facing the FrameworkElementFactory, as it has no GetValue method, didn’t know ho to cast it to a checkbox, so how can I get the IsChecked property from a FrameworkElementFactory, knowing that am able to access to it for any element of my listview

 ...
var mycheckboxFEF = template.VisualTree.FirstChild;// FirstChild is my FrameWorkElementFactory checkbox
bool isempty= (......) ????
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:11:32+00:00Added an answer on June 12, 2026 at 9:11 pm

    I did provide a solution to your problem through this exemple.

    This should work by selecting an item and pressing the button
    XAML :

    <Button Margin="0,12,401,276" Click="Button_Click">Button</Button>
            <ListView x:Name="yourListView" ItemsSource="{Binding Things}" SelectedItem="{Binding SelectedThing}" Margin="0,41,0,0">
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="Check"  Width="250">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox x:Name="myCBox" Content="{Binding ThingName}"></CheckBox>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView> 
    

    Code behind :

     /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
                Things = new List<Thing>
                             {
                                 new Thing {ThingName = "t1"},
                                 new Thing {ThingName = "t2"},
                                 new Thing {ThingName = "t4"},
                                 new Thing {ThingName = "t3"},
                             };
                DataContext = this;
    
            }
    
            public List<Thing> Things { get; set; }
            public Thing SelectedThing { get; set; }
    
            private void Button_Click(object sender, RoutedEventArgs e)
            {
                var yourListViewItem = (ListViewItem)yourListView.ItemContainerGenerator.ContainerFromItem(yourListView.SelectedItem);
                CheckBox cb = FindByName("myCBox", yourListViewItem) as CheckBox;
                MessageBox.Show(cb.Content + " IsChecked :" + cb.IsChecked);
            }
            private FrameworkElement FindByName(string name, FrameworkElement root)
            {
                Stack<FrameworkElement> tree = new Stack<FrameworkElement>();
                tree.Push(root);
    
                while (tree.Count > 0)
                {
                    FrameworkElement current = tree.Pop();
                    if (current.Name == name)
                        return current;
    
                    int count = VisualTreeHelper.GetChildrenCount(current);
                    for (int i = 0; i < count; ++i)
                    {
                        DependencyObject child = VisualTreeHelper.GetChild(current, i);
                        if (child is FrameworkElement)
                            tree.Push((FrameworkElement)child);
                    }
                }
    
                return null;
            }
        }
    
    
    
        public class Thing
        {
            public string ThingName { get; set; }
    
        }
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building one app having one list view showing list of users this
I am developing one Android application having the list view of items. Those listview
I am building one app having One list view showing the list of My
Using Asp.net MVC, I have one view that's strongly bind to List , and
I have created one list view.. it is having 5 items... Now I want
i have to show 3 columns in List view. I tried having table inside
Im having trouble with implementing list view inside a fragment. the xml code is:
I have list with items having two textview and one imageview.I inflate the list
I have a list of items in one view controller. I can select an
I want to make a custom List View having Two TextViews and a radio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.