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 8838375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:58:42+00:00 2026-06-14T09:58:42+00:00

I am creating an application to show a list of windows services not running.

  • 0

I am creating an application to show a list of windows services not running. the problem is that those services should reflect any changes occurring, that is if a service starts, that service should be removed from the displayed list.

I used a ListView, here is the code:

<Window.Resources>
    <ObjectDataProvider ObjectType="{x:Type local:NotifiableServiceController}"
    MethodName="GetServices" x:Key="ManageServices">
    </ObjectDataProvider>
</Window.Resources>

<Grid>
    <ListView Name="lstViewServices" Width="Auto" ItemsSource="{Binding Source={StaticResource ManageServices}}"
                SelectionMode="Single">
        <ListView.View>
            <GridView>
                <GridViewColumn Header="SoftOne Services" DisplayMemberBinding="{Binding Path=DisplayName}" />
                <GridViewColumn Header="Status">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=Status}">
                            </TextBlock>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
            </GridView>
        </ListView.View>
    </ListView>
</Grid>

and the function getting the service List:

public static ObservableCollection<NotifiableServiceController> GetServices()
        {
            ObservableCollection<NotifiableServiceController> oaServices = new ObservableCollection<NotifiableServiceController>();

            //Retrieving the services starting with "SQL"
            foreach (ServiceController sc in ServiceController.GetServices().Where(p => p.DisplayName.StartsWith("SQL")))
            {
                oaServices.Add(new NotifiableServiceController(sc));
            }

            return oaServices;
        }

The NotifiableServiceController is being updated at time interval to refresh the status of the associated Windows service. But only the first-time retrieved services (from GetServices() function) will be refreshed.

That is all fine till now. I just need to have only stopped processes displayed in the Listview and I think that can be done using Style or Triggers in XAML? if yes, how?

Thanks for your time.

  • 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-14T09:58:43+00:00Added an answer on June 14, 2026 at 9:58 am

    The solution was to add a style to the ListView and targetting the ListViewItem as follow:

    <ListView.Resources>
        <Style TargetType="ListViewItem">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Status}" Value="Running">
                    <Setter Property="ListBoxItem.Visibility" Value="Hidden" />
                    <Setter Property="Height" Value="0" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ListView.Resources>
    

    Depending of the Service Status, I can take set the visibility and the Height of the ListViewItem

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

Sidebar

Related Questions

I am creating a Windows Application that capture the all users session details. I
I am creating a map application that receives a list of coords from a
I am creating store locator application. This application should show nearest store to given
am creating one application for student. I need to show digital clock with remaining
I am creating a dashboard application in which i show information about the servers.
So I'm creating an application for my mobile programming class and I'm running into
I'm creating an application that allows the user to store information about their classes.
I will be creating an Application that will be showing the Products in a
I'm creating a WPF (in c#) application that will create html files based on
I am developing an application in android in which i creating a list view

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.