Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. How to Bold a Particular field in a list view

How to Bold a Particular field in a list view

Scheduled Pinned Locked Moved WPF
databasehelptutorial
13 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Aslesh

    Hi I have a textbox in which user can enter some text and then i am populating a list view from database what ever matche with the user input in the textbox. I am getting the dataset and able to bind it to the list view. But i want to bold the particular field that exactly matches withe the input. is there any way to bold or highlight the particular field in a list view.. if any one knows the solution please help me.. Santhapur

    Y Offline
    Y Offline
    Yajnesh Narayan Behera
    wrote on last edited by
    #2

    You may try out these sites: http://forums.msdn.microsoft.com/en-US/wpf/thread/37a8dc03-1f6c-42c1-8705-764e07945588/[^] http://forums.msdn.microsoft.com/en/wpf/thread/c2113001-018a-4aa9-bef8-aa95ea7dbe96[^] :sigh:

    A 1 Reply Last reply
    0
    • Y Yajnesh Narayan Behera

      You may try out these sites: http://forums.msdn.microsoft.com/en-US/wpf/thread/37a8dc03-1f6c-42c1-8705-764e07945588/[^] http://forums.msdn.microsoft.com/en/wpf/thread/c2113001-018a-4aa9-bef8-aa95ea7dbe96[^] :sigh:

      A Offline
      A Offline
      Aslesh
      wrote on last edited by
      #3

      Hi I am familiar with one that you hvae Given.. but i want to change the view (Bold ) of the particular cell.. not the entire row.. If you can please help me Santhapur

      Y 1 Reply Last reply
      0
      • A Aslesh

        Hi I am familiar with one that you hvae Given.. but i want to change the view (Bold ) of the particular cell.. not the entire row.. If you can please help me Santhapur

        Y Offline
        Y Offline
        Yajnesh Narayan Behera
        wrote on last edited by
        #4

        I was trying to solve this problem. In many ways I tried, but as per your requirement you have to add "TextBlock", then after that you can highlight the particular cell changing the Foreground colour. :laugh:

        A 1 Reply Last reply
        0
        • Y Yajnesh Narayan Behera

          I was trying to solve this problem. In many ways I tried, but as per your requirement you have to add "TextBlock", then after that you can highlight the particular cell changing the Foreground colour. :laugh:

          A Offline
          A Offline
          Aslesh
          wrote on last edited by
          #5

          hey thanks for u r idea. if u have any sample that will be a gr8 help for me :(

          Y 1 Reply Last reply
          0
          • A Aslesh

            hey thanks for u r idea. if u have any sample that will be a gr8 help for me :(

            Y Offline
            Y Offline
            Yajnesh Narayan Behera
            wrote on last edited by
            #6

            Now let us have a XAML file, where there is a listview where Employee data such as FirstName,LastName & EmployeeNumber is being populated. I assume you are retrieving data from you database when a specify condition is beieng satisfied such as when FirstName matches the condition. In this case you want to heighlight those cells. In this case your XAML file looks like: <ListView.View> :-D <GridView AllowsColumnReorder="true" ColumnHeaderToolTip="Employee Information"> <GridViewColumn Header="First Name" Width="100" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=FirstName}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Last Name" Width="100" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=LastName}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="ID" Width="50" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=EmployeeNumber}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> Now in your cs class private void EditBox_Loaded(object sender, RoutedEventArgs e) { EditBox edtBox = sender as EditBox; if (edtBox.Value.ToString() == "Yajnesh") { edtBox.FontSize = edtBox.FontSize + 4; } } I have tried to paint the background, but it is not straight forward as you have to use the concept dependency property.

            Y 1 Reply Last reply
            0
            • Y Yajnesh Narayan Behera

              Now let us have a XAML file, where there is a listview where Employee data such as FirstName,LastName & EmployeeNumber is being populated. I assume you are retrieving data from you database when a specify condition is beieng satisfied such as when FirstName matches the condition. In this case you want to heighlight those cells. In this case your XAML file looks like: <ListView.View> :-D <GridView AllowsColumnReorder="true" ColumnHeaderToolTip="Employee Information"> <GridViewColumn Header="First Name" Width="100" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=FirstName}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Last Name" Width="100" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=LastName}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="ID" Width="50" > <GridViewColumn.CellTemplate> <DataTemplate> <l:EditBox Height="25" Value="{Binding Path=EmployeeNumber}" Loaded="EditBox_Loaded"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> Now in your cs class private void EditBox_Loaded(object sender, RoutedEventArgs e) { EditBox edtBox = sender as EditBox; if (edtBox.Value.ToString() == "Yajnesh") { edtBox.FontSize = edtBox.FontSize + 4; } } I have tried to paint the background, but it is not straight forward as you have to use the concept dependency property.

              Y Offline
              Y Offline
              Yajnesh Narayan Behera
              wrote on last edited by
              #7

              Sorry this is not the complete solution. I will post an article having this functionality today. :laugh:

              A 1 Reply Last reply
              0
              • Y Yajnesh Narayan Behera

                Sorry this is not the complete solution. I will post an article having this functionality today. :laugh:

                A Offline
                A Offline
                Aslesh
                wrote on last edited by
                #8

                My deadline is verysoon. please post it as soon as possible. plz help me

                Y 1 Reply Last reply
                0
                • A Aslesh

                  My deadline is verysoon. please post it as soon as possible. plz help me

                  Y Offline
                  Y Offline
                  Yajnesh Narayan Behera
                  wrote on last edited by
                  #9

                  I have posted ths article, please follow this link. http://www.code ;) project.com/KB/WPF/WPFHighlightCellListView1.aspx[^] Currently the code is not uploaded there as it is under scan, it will be available tomorrow.

                  A 1 Reply Last reply
                  0
                  • Y Yajnesh Narayan Behera

                    I have posted ths article, please follow this link. http://www.code ;) project.com/KB/WPF/WPFHighlightCellListView1.aspx[^] Currently the code is not uploaded there as it is under scan, it will be available tomorrow.

                    A Offline
                    A Offline
                    Aslesh
                    wrote on last edited by
                    #10

                    Thanks for your article ... but i am binding it to a Ilist collection not to a table and i wont get the single result i will get a multiple result set. Aslesh

                    Y 2 Replies Last reply
                    0
                    • A Aslesh

                      Thanks for your article ... but i am binding it to a Ilist collection not to a table and i wont get the single result i will get a multiple result set. Aslesh

                      Y Offline
                      Y Offline
                      Yajnesh Narayan Behera
                      wrote on last edited by
                      #11

                      OK now your problem is mine as I am stuck at this point. I am also trying to bind a collection to this ListView at runtime & to highlight the search. End point is that in "EditBox_Loaded" method we can highlight it. You try how to bind the data collection at run time, as well as I am trying on my end.

                      1 Reply Last reply
                      0
                      • A Aslesh

                        Thanks for your article ... but i am binding it to a Ilist collection not to a table and i wont get the single result i will get a multiple result set. Aslesh

                        Y Offline
                        Y Offline
                        Yajnesh Narayan Behera
                        wrote on last edited by
                        #12

                        Hi Please go through the zip file of my article the solution for collection class is there. :-D

                        A 1 Reply Last reply
                        0
                        • Y Yajnesh Narayan Behera

                          Hi Please go through the zip file of my article the solution for collection class is there. :-D

                          A Offline
                          A Offline
                          Aslesh
                          wrote on last edited by
                          #13

                          U did not perform any search right? u r just binding the listview to the collection .. is n't it ?

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups