Click here to Skip to main content
12,829,014 members (38,952 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB WPF VB.NET

I'd like to create a table to show which user has which software opened in their system.

To show if the user has the software or not, I'd like to create an ellipsis that would be colored green if true and red if false.

I should have no problem with the code, what i'm now trying to figure out (since i've never used WPF before) is the best approach.

I think I should create a data grid to have optimal control over the look of the grid itself, as i want the lines of the grid to appear. However, datagrids don't allow me to insert ellipsis in their cells.

I then tried using the Grid, which works great, but I found no possible way to customize the appearance of the grid lines. I can only find the option to show or not show grid lines, and I would like to specify color, width, style, etc.

So what should I do? Any suggestions?

Posted 22-Feb-13 10:19am
Sergey Alexandrovich Kryukov 22-Feb-13 15:33pm
So, ellipsis or ellipse? These two things are totally unrelated. In principle, in WPF you can use them both, in any content, even in a grid view :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1 can do following.your DataGridColumn must be like:
<DataGridTemplateColumn Header="Status">
                                    <ControlTemplate TargetType="{x:Type Button}">
                                        <Ellipse Fill="{TemplateBinding Background}" Width="10" Height="10"/>
                                    <Style TargetType="{x:Type Button}">
                                        <EventSetter Event="Button.Loaded" Handler="StatusButtonHandler"/>

and in your codeBehind you can define a property for checking the status of users' software.
in here i define a IsLoad property:

private void StatusButtonHandler(object sender, RoutedEventArgs e)
            Button source = e.OriginalSource as Button;
            if (this.IsLoad == true)
                source.Background = Brushes.Green;
                source.Background = Brushes.Red;

my IsLoad property:
public bool IsLoad

I hope this help you.
Good Luck
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi. i credate a DataGridCheckBoxColumn.this is more professional:
<DataGridCheckBoxColumn Binding="{Binding IsFlagged}">
                                    <DataTemplate >
                                        <Image Source="/Images/BlueFlag.png" Width="24" Height="24"/>
                                    <Style TargetType="{x:Type CheckBox}">
                                        <Setter Property="Height" Value="10"/>
                                        <Setter Property="Width" Value="10"/>
                                        <Setter Property="Template">
                                                <ControlTemplate TargetType="{x:Type CheckBox}">
                                                    <Ellipse x:Name="FlagEllipse" Fill="LightGray" Width="10" Height="10"/>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter TargetName="FlagEllipse" Property="Fill" Value="Red"/>

"IsFlagged " is your property for checking.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170326.1 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100