WPF: How to make the first column does not show row separator and Left column separator in DataGrid?

Our WPF application uses DataGrid.
One of request is that first column of DataGrid does not show row separator and also does not show Left column separator. So it looks like the first column does not belong to the DataGrid. However, when select a row, the cell of first column still get selected.
How do we make it? Thx!
JaneC

Hi Magnus,
Thanks for replying our question and provide your solution!
Your solution works by setting "HorizontalGridLinesBrush" and "VerticalGridLinesBrush" to {x:Null} in the DataGrid style and modify "CellStyle" in first column as following:
<DataGridTextColumn MinWidth="32"
Binding="{Binding CellName}"
CanUserReorder="False"
CanUserSort="False"
Header="Cell}"
IsReadOnly="true" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="IsEnabled" Value="False"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderThickness="0" BorderBrush="{x:Null}"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Margin="-1">
<Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
<ContentPresenter VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
We found another way to achieve it by using DataGridRowHeader. The good way to use DataGridRowHeader is that we do not need to make the first column ReadOnly (click on first column does not select whole row anymore). Select RowHeader in a row will select
whole row. Move scroll bar horizontally, the row header still keep in visible area.
<Style TargetType="{x:Type DataGridRowHeader}" x:Key="dataGridRowHeaderStyle">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Height" Value="42" />
<Setter Property="SeparatorBrush" Value="{x:Null}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRowHeader}">
<Grid>
<Border x:Name="rowHeaderBorder"
BorderThickness="0"
Padding="3,0,3,0"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
BorderBrush="{x:Null}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataGrid>
<DataGrid.RowHeaderStyle>
<Style TargetType="DataGridRowHeader" BasedOn="{StaticResource dataGridRowHeaderStyle}">
<Setter Property="Content" Value="{Binding CellName}" />
<Setter Property="Width" Value="35"/>
</Style>
</DataGrid.RowHeaderStyle>
</<DataGrid>
JaneC

Similar Messages

  • HT2905 what should i do if "display duplicate" in the first step does not show up ?

    what should i do if "display duplicate" in the first step does not show up ?

    If you're using iTunes 11, they've changed where the duplicate option is.  You can now find it under the View menu.  Note, if you hold Option on that menu, it'll give you the "exact" option.

  • How to Make the Default Button Marker Not Show Upon Launching...

    I am trying to only have the markers show up on the menu item when you roll over it.  However, when the menu is first launched, the marker is automatically showing up on the first button.
    I have selected "None" as the default menu button in the menu config.  I am also using Photoshop to make the menu and creating the (+) buttons there.
    Any help would be greatly appreciated.
    Thanks.
    Dave

    Create an invisible button (turn off the visibility of all layers) and
    set it to use Highlight Group 2 (edit the Menu Color Set).  Set the
    opacity of all the highlight states to 0%.  Make the invisible button
    the default button.
    -Jeff

  • My playlists show how many titles are in the playlist but does not show the list of titles

    my playlists show how many titles are in the playlist but does not show the list of titles. Is there a setting that I hit by mistake to hide the content?

    Perhaps you have made one column extra wide and the window isn't currently showing the Name column. Try resizing columns, turning off those that you don't need, or scrolling sideways.
    tt2

  • I have Windows 8. The address bar does not show on firefox. How do I fix this?

    The address bar does not show. How do I get it to appear?

    * If the menu bar is hidden then press and hold the Alt key down, that should make the Menu bar appear. Make sure that you have the Navigation Toolbar and other toolbars visible: View > Toolbars .
    * If items are missing then see if you can find them in the View > Toolbars > Customize window.
    * If you see the item in the Customize window then drag it back from the Customize window to the Navigation toolbar.
    * If you do not see that item then click the Restore Default Set button in the View > Toolbars > Customize window.
    See also [[Back and forward or other toolbar buttons are missing]] and [[Customize navigation buttons like back, home, bookmarks and reload]] See http://kb.mozillazine.org/Toolbar_customization

  • I've a new account on iMac.  When composing an email the contact list does not show up on the bar.  WWhen I start keying in a name, it comes up with the address.  How do I engage the  contact list from the email?

    I've a new account on iMac.  When composing an email the contact list does not show up on the bar, which would allow me to select the persons I want to include on the distribution of the email.  When I start keying in a name in the email, it comes up with the person's address, which shows it is synced.  How do I engage the contact list from the email like I do on my old account (where a contact list icon shows up, along with the "attach" and other icons) ?

    With the New Message window open, go to the View menu and select "Customize Toolbar...".
    In the screen that opens, drag the item labelled "Address" into the Toolbar area of the New Message window, then click the "Done" button.
    That item should be then added to the Toolbar for the New Message window.
    Note that the main Mail window and the New Message window (as well as the separate message window if you open a message that way) use different toolbars - the settings/inclusions for one do not carry over to another.

  • The Airplay icon does not show, regardless that it is clicked on display. How can I do to see the Airplay Icon in order to connect my apple TV with my Mac Pro?

    The Airplay icon does not show on my Mac Pro, regardless that it is clicked on display. How can I do to see the Airplay Icon in order to connect my apple TV with my Mac Pro?

    To check your model go to About This Mac (by clicking on the Apple icon, top left) and then select more info. If you wish to use mirroring you will need one from 2011 or later running OSX 10.8 or later. The alternative would be to use 3rd party software like Airparrot.
    About AirPlay Mirroring in OS X

  • I read the article on how to remove Bing; however, it does not show up on my list of installed programs and it does not show up in the list of extenstions under "Tools" and "Addon" yet it is installed as an extention to the right of the addlress line.

    I read the article on how to remove Bing; however, it does not show up on my list of installed programs and it does not show up in the list of extenstions under "Tools" and "Addon" yet it is installed as an extention to the right of the addlress line. It is not my home page. Help!!!

    See also:
    *https://support.mozilla.com/kb/Removing+the+Search+Helper+Extension+and+Bing+Bar
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    *http://kb.mozillazine.org/Resetting_preferences

  • I really need someone to help me. I have been trying to figure out how to select a PDF document to convert to a Word doc. When I go to select a PDF file, all that shows up is the WORD docs. does not show ANY of my PDF files... Please help me figure out wh

    I really need someone to help me. I have been trying to figure out how to select a PDF document to convert to a Word doc. When I go to select a PDF file, all that shows up is the WORD docs. does not show ANY of my PDF files... Please help me figure out what is going on? We have it set on auto renewal so I know its not that we haven't renewed this subscription, because we pay automatically.

    Hi olivias,
    It sounds like there may be some confusion on your system about what application should be associated with PDF files. You can reset filename associations by following the steps in these articles (depending on your operating system):
    How to change the default application for a file type | Macworld
    http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
    Please let us know if you have additional questions.
    Best,
    Sara

  • I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    Before you connect any device to a new library go to the Devices tab of the the preferences panel via Edit > Preferences (Windows) or iTunes > Preferences (Mac) and ensure the box next to Prevent iPods, iPhones, and iPads from syncing automatically is ticked. You can now safely connect the device to your computer without the danger of media being automatically deleted or overwritten.
    To get all your content off your connect your iPad to your new computer.
    Then use a 3rd party piece of software to transfer your content
    I have found Senuti useful but there are others listed in the article I linked to in a previous post.
    https://discussions.apple.com/docs/DOC-3991
    That will let you transfer your non purchased content
    For Purchased content log in to iTunes on the new computer
    In Itunes Store click on Purchased under the Quick Links section on the right.
    Download any music by clicking on the cloud button

  • I am trying to uninstall a program that is running in the background but does not show when I force quit.  How do I remove it?

    How do I uninstall a program that is running in the background but does not show in Force Quit?

    Open Activity Monitor and look for the program.  Select it and Quit or Force quit it from within Acitiviy Monitor.
    Search for the application with Find Any File as it can search areas that Spotlight can't, like invisible folders, system folders and packages.  You can drag the app and any associated files from the search result window to the Trash bin in the Dock.
    OT

  • Change password on the first use - does not work

    Change password on the first use - does not work.
    Created a user and specified 'Change password on the first use' - when user logs in - the 'Change password' window does not pop- up.
    Please advise.

    (APEX 4.0.2) I am running into this same issue - if you don't set the password expiration and locking to 'Yes', the user gets into the app without being asked to change the pw.
    When you do set expiration and locking - after the user logs on with their temporary password, it does take them to the change password page (4155:50) but the username is blank. Because the username didn't get to the page the old password will never match and you get the "Invalid password" message.
    What am I missing? Anyone successful doing this?
    Simple application, default authentication, no javascript, HTTP_SERVER, no ssl.
    Thanks,
    Steve

  • Hello I have a problem related to synchronization. When you synchronize ipad Section 3 "Other" takes as much memory up to 8 gigobayt. How to make the section "Other" did not increase? Thank you.

    Hello
    I have a problem related to synchronization.
    When you synchronize ipad Section 3 "Other" takes as much memory up to 8 gigobayt.
    How to make the section "Other" did not increase?
    Thank you.

    DOCUMENTS AND DATA IS ALSO WHERE YOUR MAIL INFORMATION IS STORED SO IF YOU ARE A "HOARDER" IN EMAIL, GO INTO THE GMAIL, HOTMAIL, ICLOUD ETC WHATEVER YOU USE, AND DELETE YOUR TRASH, SENT, DRAFTS, ETC.
    THAT SHOULD HELP A LOT.

  • How to upgrade to aperture 3.5 when the app store does not show the update. I did buy aperture 3 on DVD not thru the app store. what to do?

    I can not open aperture databases anymore as osx10.9 keeps telling me i have opened it with a newer version, which i have not but i understand from other discussions that thru the upgrade of iphoto osx automatically thinks that you have opened with aperture 3.5. the app store does not show me the update as i have not purchased the program thru the app store but on dvd. what to do?

    If you are running MacOS X 10.9 and Aperture is installed in your Applications folder and simply called Aperture, not Apertre 3 or something, the AppStore should be showing you the update.
    Have you already updated to Aperture 3.4.5 from the Support page  Aperture 3.4.5?
    Try to update manually to 3.4.5 and then reboot and sign again into the AppStore with your AppleID and look at the Update page.
    For some forum members it helped to set the main system language to English U.S. to make the update finally show.
    Léonie

  • Why when i buy books on my ipad, when i log onto the store it does not show that i have purchased them?

    Why when i buy books on my ipad, when i log onto the store it does not show that i have purchased them?
    how many books and songs were therefore lost when i had to wipe my ipad?
    this is SHOCKING from Apple... this is not in my domain of settings!!!

    In the iBooks application on the Mac, there is a checkbox to sync highlights and notes across devices. 
    I don't see a similar setting in the iBooks app on my iPad.  It may require iBooks on the Mac as a mediator.
    Also:
    Can I highlight text and make notes?
    Yes, iBooks includes built-in Highlight and Note features. Highlight any word or passage of text within a book. You can also create a Note from your highlighted selection. Review your Highlights and Notes by tapping the Table of Contents button and then tapping Bookmarks. Highlights and Notes appear in their own section under Bookmarks. 

Maybe you are looking for