locked
A heartfelt missive to Team LightSwitch RRS feed

  • Question

  • I love LightSwitch and the ideas behind it; in the main, manna from heaven! With all the new activity and enhancements ( OData, HTML client preview et al ), it seems the product is moving forward at a great pace.

    However it would be just wonderful if someone could take it as their responsibility to sort out some basic issues which the team have been aware of since V1 beta and are still not fixed. The ones I will mention and others have been logged through connect and endless forum posts, to no avail whatsoever. In fact I seem to recall that a V2 feature request list, set up by the team, was inundated with basic fix requests and it seems that many of these were ignored for V2.

    The main reason I ask this (apart from the sheer annoyance of having to use messy workarounds) is based ironically on the fact that we are all being steered towards Microsoft's UIX vision of content over chrome. OK I can live with that, the plethora of migraine-inducing colour-schemes prevalent in real world applications is testament to why we may need a whole new design philosophy.

    Given that, then:

    1. WHY am I not able to right-align column headers in my dataGrids when I'm displaying right-aligned numeric data? It looks atrocious and totally unprofessional, completely screwing the users' ability to instantly derive what's going on visually, thus negating the whole idea of CONTENT immediately drawing the attention.
    2. WHY are there inconsistencies between whether or not the combination of 'Alignment' and 'TextAlignment' settings give the same visual appearance (often not) across various 'input' type controls.
    3. WHY cant my grid columns auto-size to content just by using one setting?
    4. Having supplied us all with the Cosmopolitan Shell & Theme, WHY has the source code not been released as promised? At the very least then us devs could have a go at fixing these incredibly annoying basic issues, some of which are enough to put potential customers off? (from bitter personal experience).

    All these questions as I said have been asked many times but we have no firm responses so I ask again that someone on the team take personal responsibility in order to sort them out for us all. If it weren't for these and other quirks we really would have almost the perfect tool. It's great to have all the new stuff but if the basics aren't right then it tends to take the gloss off! If you want us to follow good design principles, great; just give us the means to do so!

    So, Team, anyone want to respond positively to this? Please?

    Regards,

    Ian Mac


    Ian Mac

    Wednesday, November 28, 2012 6:33 PM

Answers

  • Hi Ian,

    I completely understand your desire to have the above sample integrated into the Cosmo theme.  I have a blog post in the making that will do just that.  Or if you're feeling adventurous, you can add the above to Cosmo theme yourself--we did finally get it released this morning. Download the cosmopolitan source here.

    With regard to your other point(s), we are presently collecting a set of bugs to be fixed in an out-of-band release.  Naturally, we won't be able to fix everything; but we are paying particular attention to connect bugs that have received confirmation or votes from the community.  So please be sure to put in a vote for anything beyond the issues raised here that are top-of-mind for you.  I don't have a specific release plan/timeframe in mind just yet--we need to first identify the bugs we can fix--but our intention is to release them out-band if at all possible. I am personally driving this effort, so feel free to contact me if you have any questions.

    Stay tuned for the above sample integrated into the cosmo theme.  I aim to publish the blog on it early next week.

    Thanks.

    Joe

    • Marked as answer by Ian Mac Tuesday, December 18, 2012 6:07 PM
    Thursday, December 13, 2012 8:39 PM

All replies

  • Excellent wrapup Ian!

    Items 1-3 are some of my personal bugbears as well, so I agree with your comments 100%. I look forward to hearing back from the team about these issues just as much as you do. It should now be much easier for them to do so, with them all wrapped up in one thread like you've done.

    Thanks for doing this.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, November 29, 2012 12:25 AM
    Moderator
  • Hi Yann,

    Many thanks for your support!

    However as you can see your enthusiasm has not, after 5 days, been shared by anyone from the LightSwitch team. I guess I should not be that surprised as, after all, the points I made have been made by myself and others in the past with as far as I am aware not even an acknowledgment of the issue, hence my repeated requests.

    To be honest I find this baffling and frankly, downright rude, not to say dismissive, especially when you consider that we're talking about basic UI requirements which the Team can't or won't put right despite repeated polite and respectful calls to do so, through 'proper' channels or otherwise!

    There has as far as I am aware, never been an official response to these items and it's this that annoys and irritates me almost more than the bugs themselves!

    Go figure!

    Ian


    Ian Mac

    Monday, December 3, 2012 6:07 PM
  • Hi Ian,

    On behalf of the team, I apologize for the delay--both in responding to your inquiry here and the underlying issues you've described.  Before going further, let me say that I can relate to your frustration.  Please feel free to stay in contact with me directly to ensure that these issues are resolved. My email is my first initial (J) plus last name (Binder) @microsoft.com. 

    Please do understand that while our public focus has largely been rooted in the HTML client in recent months, our first priority is always on the bits we've already shipped. At times our ability to maintain that priority wavers under the pressure and excitement of finalizing the next release, and posts like yours are an important reminder to all of us. So while I wish we had answered your inquiries earlier, I very much appreciate you taking the time to bring them to our attention again.

    Before responding to this, I did grovel through our bug database and connect to find the issues you've mentioned, but I wasn't able to track down some of the specific bugs and so I'll need a bit more information to provide definitive answers.

    1. Right-Aligned column headers in the data grid

    Indeed, this is something that we've heard and we actually hoped to fix with the source release of the Cosmo theme (see below), as it's relatively straightforward to do in the theme's ColumnHeaderStyle.  If you would like a sample of how to do it in the meantime, let me know and I will put something together for you.  

    2. Text/Content Alignment

    Can you provide the specific controls that exhibit the inconsistencies? I ran through our base control set and--with the exception of checkbox--could not identify the issue(s), but I am no doubt missing something.

    3. Auto-sized sells.

    This is unfortunately just a bug.  I have re-entered it internally for us to fix in an upcoming release.  I realize part of what you're asking is to make auto sized columns *easy*--and they ought to be--but if you want a workaround, just let me know.  This one is pretty straightforward to enable via code.  (It will also be easy to do with the upcoming theme.)

    4. Source code for the cosmo theme & shell

    Sigh!  As a team, we underestimated the amount of work releasing the source for this would entail; however, we are working through the final steps of the release process now and we aim to make it available as soon as possible.  I don't know the specific date just yet, but it is coming...

    While our response to the issues you've raised has been largely absent, we very much listen closely to the issues we hear via connect and the forums.  This is important data for us as we balance new investments with support/improvements to existing features.  The last two releases of the HTML client preview have weighted the former more heavily, but I think you'll see some encouraging responses to known issues with our SL client as we move forward.

    Again, don't hesitate to reach out to me directly if you'd like to discuss any of these further.

    Thanks.

    Joe


    Tuesday, December 4, 2012 3:52 AM
  • Hi Joe,

    Thanks for taking the time to write such a comprehensive reply. We all know you guys are busy, but I can understand the frustration of feeling like one's not being heard. These particular issues have been around since the beginning.

    1. Personally, I would like to see not just a particular hard-coded column header alignment, as this will nearly always have times where it will just look silly. Centered would have been a much more sensible default in my opinion (though that is just MY opinion). I actually think that the header alignment should follow the alignment of the data (left-justified column, left-justified header, right-justified column, right-justified header etc). Or even better, be able to specifiy the alignment somehow per column, maybe a Header Alignment property, just like Vertical Alignment & Horizontal Alignment). For example, I might have right-justified numeric data, but a right (or even worse left) justified header might not look right, depending on the width of the grid column. I don't know how many times I've been asked by a client "Why is it that the data in that column is centered (or right-aligned), but the heading is way over there on the left. Can't you fix that? It looks so unprofessional."
    2. I submitted a bug report on this ages ago: TextAlignment Doesn't Work For Label, Text & Money Controls In Grids Any More. This bug was introduced in the RTM of LS 2011.
    3. This should be just a simple setting. Along with the Auto width setting, there could perhaps be a Fill option as well. Yes, I can currently do this in code (& I do), but it's a lot of effort every time I need a column that fills the remainder of the available space in a grid.

    I hope you find these comments helpful. And thanks again for replying to Ian.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Tuesday, December 4, 2012 5:09 AM
    Moderator
  • Hi Joe,

    Thank you for replying in such a comprehensive manner but I must say ( and this is not directed at you personally ) that it is incredibly frustrating to have to make SUCH a noise to illicit a direct response!

    I must also say that while I do air some valid  frustrations in these posts it would be remiss of me as a grateful developer not to wholeheartedly thank the team for their amazing work over the past few years in bringing us a tool which greatly improves productivity in the RIA space and which elicits genuine excitement amongst our development community, so again, thank you all.

    In direct response to your points:

    1. Yes please! I DO use code for this ( something I believe Jewel Lambert blogged ), however in my case I believe space on the right is still being taken up by an area for the sort glyph, even when I am not displaying said glyph, so the header text is not exactly right-aligned in her scenario.
    2. I can do no better than to refer you to the connect post that Yann kindly refers us to in his reply to you; very succinct and descriptive.
    3. Yes in the meantime please I would love a code sample, as in point 1 !
    4. I wish I could understand just how much work is involved in releasing source code, when it obviously existed at the point of the release of the shell/theme, which was a long time ago! In any case, this is REALLY going to energise devs, whether or not they are also designers. We have a great 'base' theme to work on and it will be greatly empowering for us to get our hands on this since obviously we will be more able to provide OUR customers with the customisations they require and this can only bolster the presence of LightSwitch applications. Therefore I cannot emphasise enough just how important this is to us. Up until now, in my humble opinion, this has been a lost opportunity and I respectfully ask that, if at all possible, the team put this at or near the top of the priority list. It has been a long time since we were informed that source code would be released.

    I DO appreciate how busy the team must be and once again I thank you for your response. I would finish by saying that we are the guys and gals out there building the apps, doing the tweaks, finding the workarounds etc and in partnership with yourselves, feeding back our findings. In this scenario, it is important for us to at least be aware that you have received our information, whether or not you are able to do anything about it in the 'yesterday' time frame so beloved of us devs!

    Many thanks,

    Ian 


    Ian Mac

    Tuesday, December 4, 2012 2:09 PM
  • Hi Ian & Yann,

    Thanks for taking the time to follow-up--the additional information is helpful. 

    Yann, thanks for the pointer to the bug.  I am sorry that this bug was incorrectly resolved. I have been able to reproduce it pretty easily.  I've re-activated it and I'll track it down.

    Since there seems to be a number of issues surrounding the grid specifically, what I'd like to do is put together a sample that shows how to override all aspects of the datagrid--and of course fixes the issues mentioned here--without changing the styles for the other LS controls.  I think this might be the best near-term solution, as it would enable you to categorically override behaviors in the grid you find frustrating without writing code in every application.  This being somewhat involved, please expect some follow-up from me early next week--it will take me some time to cook this up. If the sample is deemed useful, we can integrate the changes into the source for the Cosmo theme.

    In more general terms, we're currently re-reviewing connect bugs to identify similar issues that may have fallen through the cracks, paying particular attention to bugs that have a few or more votes associated with them. 

    Thanks for patience. We very much appreciate the feedback.

    Joe

    Tuesday, December 4, 2012 11:04 PM
  • You're welcome Joe. I'm glad it was helpful.

    I've been wanting to do what you described (with the grid) for quite a while, I just haven't had time.

    I'd be disappointed if the improvements only went into the Cosmopolitan theme. I didn't like it at all during my brief foray into LS 2012. I hope you won't forget that there will be people who will want to use the Classic (2011) shell (I have my own custom version of it, but it looks basically the same, with a few nice additions).

    I can do pretty much whatever I want with the grid (through code), but it's the wrigmarole that you have to go through getting the reference to the control so you can cast it as a grid that's annoying to have to do over & over.

    About the only thing I wasn't able to figure out, was how to make the column header alignments match the horizontal alignment of the column's control. I tried for a while, but I eventually gave up. I settled for centered headers, which isn't always perfect, but it's better than left-aligned headers which looks really bad. Oh, I just remembered something. I'm able to center the headers, but the header row styling changes for some reason.

    I can loop through the column headers & make them all centered, or right-aligned just fine (apart from the style change), I just can't figure out how to have different alignments that depend on the column's control.

    It's great to hear that these issues are finally being looked at.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Wednesday, December 5, 2012 6:01 AM
    Moderator
  • Hi Joe,

    Thanks again for your response. Your sample re overriding all aspects of the datagrid for the near-term is eagerly anticipated, particularly correct column alignment and auto-fit to content!

    Looking forward to seeing the fruits of your labours!

    Ian


    Ian Mac

    Friday, December 7, 2012 11:03 AM
  • Hi Ian & Yann,

    I wanted to give you an update on where we're at with the issues we've raised.  Since issues 1 & 4 are things that have no workaround I've focused on those first.

    In terms of the source for the Cosmo shell & theme source code, we are prepping the release of it for this week.  We'll post a blog entry on it as soon as it is up. Again, we apologize for the lengthy delay on this.

    In terms of the first issue--Column Header alignment--I have put together a sample that shows how to accomplish this with a custom theme.  The technique used in the sample will work with the Classic and Cosmo themes, but what's included here will work as-is with the classic theme.  I will post an update to this that works with the Cosmo theme just as soon as it's released.  

    Per your suggestion, the resulting grid will align its column headers in accordance with the respective column's HorizontalAlignment.  Here's what it looks like:

    To create this, I created a new Theme extension (requires the LightSwitch SDK and VS 2012 SDK) and overridden the ColumnHeader style for the default grid. When the theme is used, the ColumnHeader style is applied and--because the theme does not include any other styles--falls back to the default (classic) theme for all other controls. I took this approach to keep the theme simple.  The defining parts of the theme are as follows:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
        xmlns:ctl="clr-namespace:Microsoft.LightSwitch.Presentation.Implementation.Controls;assembly=Microsoft.LightSwitch.Client.Internal"
        xmlns:converters="clr-namespace:DataGridTheme.Presentation.Converters"
        >
       
        <converters:DataGridColumnHeaderAlignmentConverter x:Key="ColumnHeaderAlignmentConverter"/>
        <converters:SortGlyphAlignmentConverter x:Key="GlyphAlignmentConverter"/>
        
        <Style x:Key="DataGridHeaderStyle" TargetType="sdk:DataGridColumnHeader">
            <!--The content alignment of the column (i.e., how the header is aligned) is based on the horizontal alignment of the respective
                column, as determined by the DataGridColumnHeaderAlignmentConverter.  The Converter parameter is used to specify the default 
                horizontal alignment that's used if the column is set to stretch. -->
            <Setter Property="HorizontalContentAlignment" Value="{Binding Converter={StaticResource ColumnHeaderAlignmentConverter}, ConverterParameter='Left'}"/>
        </Style>
    
        <Style TargetType="sdk:DataGrid" x:Key="CustomDataGridStyle">
            <Setter Property="ColumnHeaderStyle" Value="{StaticResource DataGridHeaderStyle}"/>
        </Style>   
        <Style TargetType="ctl:DataGridVisual">
            <Setter Property="DataGridStyle" Value="{StaticResource CustomDataGridStyle}"/>
        </Style>
        
    </ResourceDictionary>
    

    The converter used to determine the HorizontalContentAlignment looks like the following:

    using System;
    using System.Windows;
    using System.Windows.Data;
    using Microsoft.LightSwitch.Presentation;
    
    namespace DataGridTheme.Presentation.Converters
    {
        /// <summary>
        // This converter is used to set the content alignment of a column header in accordance with the 
        // column's horizontal alignment setting--i.e., if a column in the grid uses HorizontalAlignment=Right,
        // the corresponding column header will be right-aligned. The converter assumes that the data context 
        // is a LightSwitch content item.
        /// </summary>
        public class DataGridColumnHeaderAlignmentConverter : IValueConverter
        {
            private IContentItem contentItem;
            private int columnIndex = 0;
    
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                string defaultAlignmentValue = "Left";
                if (parameter != null)
                {
                    defaultAlignmentValue = parameter as string;
                }
                // The root content item represents the root grid/collection.  Each time the converter is called 
                // for a given collection, we return the HorizontalAlignment for the subsequent column.
                if (value as IContentItem != contentItem)
                {
                    contentItem = value as IContentItem;
                    columnIndex = 0;
                }
                else
                {
                    columnIndex++;
                }
    
                // The first (and only) child of the grid is always the Row template
                var rowTemplate = contentItem.ChildItems[0];
                // Now we find the content item that corresponds to the column we're styling
                if (columnIndex >= rowTemplate.ChildItems.Count || columnIndex < 0)
                {
                    return null;
                }
                var column = rowTemplate.ChildItems[columnIndex];
                if (column != null)
                {
                    // Get the content item property for the HorizontalAlignment and return the respective 
                    // horizontalalignment value to be used in the ColumnHeaderStyle.  
                    // 
                    // The default alignment is left.
                    var horizontalAlignment = column.Properties[@"Microsoft.LightSwitch:RootControl/HorizontalAlignment"] as string;
                    if (horizontalAlignment == "Right")
                    {
                        return HorizontalAlignment.Right;
                    }
                    else if (horizontalAlignment == "Center")
                    {
                        return HorizontalAlignment.Center;
                    }
                    else if (horizontalAlignment == "Left")
                    {
                        return HorizontalAlignment.Left;
                    }
                    else
                    {
                        return StringToAlignment(defaultAlignmentValue);
                    }
                }
                return StringToAlignment(defaultAlignmentValue);
            }
    
            private HorizontalAlignment StringToAlignment(string alignment)
            {
    
                if (alignment == "Left")
                    return HorizontalAlignment.Left;
                else if (alignment == "Right")
                    return HorizontalAlignment.Right;
                else if (alignment == "Center")
                    return HorizontalAlignment.Center;
                else if (alignment == "Stretch")
                    return HorizontalAlignment.Stretch;
                else
                    return 0;
            }
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
    }
    

    This gets us 95% of the way there, but as Ian pointed out--the sort glyph looks a little weird when you right-align the header.  I had to re-template the column header to re-position the glyph based on the header's alignment.  The complete style now looks like this:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
        xmlns:ctl="clr-namespace:Microsoft.LightSwitch.Presentation.Implementation.Controls;assembly=Microsoft.LightSwitch.Client.Internal"
        xmlns:converters="clr-namespace:DataGridTheme.Presentation.Converters"
        >
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Colors.xaml"/>
        </ResourceDictionary.MergedDictionaries>    
        
        <converters:DataGridColumnHeaderAlignmentConverter x:Key="ColumnHeaderAlignmentConverter"/>
        <converters:SortGlyphAlignmentConverter x:Key="GlyphAlignmentConverter"/>
        
        <Style x:Key="DataGridHeaderStyle" TargetType="sdk:DataGridColumnHeader">
            <!--The content alignment of the column (i.e., how the header is aligned) is based on the horizontal alignment of the respective
                column, as determined by the DataGridColumnHeaderAlignmentConverter.  The Converter parameter is used to specify the default 
                horizontal alignment that's used if the column is set to stretch. -->
            <Setter Property="HorizontalContentAlignment" Value="{Binding Converter={StaticResource ColumnHeaderAlignmentConverter}, ConverterParameter='Left'}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="sdk:DataGridColumnHeader">
                        <Grid x:Name="Root">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BackgroundRectangle"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BackgroundRectangle"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SortStates">
                                    <VisualState x:Name="Unsorted" />
                                    <VisualState x:Name="SortAscending">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SortIcon"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="SortDescending">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SortIcon"/>
                                            <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Duration="0" To="180"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle x:Name="BackgroundRectangle" Grid.ColumnSpan="2" Opacity="0" Fill="{StaticResource ListHeaderBackgroundMouseOverBrush}"/>
                            <Grid Margin="{TemplateBinding Padding}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                  Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  />
                                <Path x:Name="SortIcon" Width="9" Height="5" Margin="3,1,3,0" 
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Opacity="0"
                                    Data="F1 M0,1 L2,1 L1,0 z"
                                    Fill="{StaticResource ScrollBarThumbGlyphBrush}" Stretch="Fill"
                                    Grid.Column="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GlyphAlignmentConverter}}" RenderTransformOrigin=".5,.5">
                                    <Path.RenderTransform>
                                        <CompositeTransform/>
                                    </Path.RenderTransform>
                                </Path>
                                
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    
        <Style TargetType="sdk:DataGrid" x:Key="CustomDataGridStyle">
            <Setter Property="ColumnHeaderStyle" Value="{StaticResource DataGridHeaderStyle}"/>
        </Style>   
        <Style TargetType="ctl:DataGridVisual">
            <Setter Property="DataGridStyle" Value="{StaticResource CustomDataGridStyle}"/>
        </Style>
        
    </ResourceDictionary>

    This addition requires another relatively simple converter that figures out where to put the sort glyph:

    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    
    namespace DataGridTheme.Presentation.Converters
    {
        public class SortGlyphAlignmentConverter : IValueConverter
        {
    
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                var columnHeader = value as ContentControl;
                if (columnHeader != null)
                {
                    return columnHeader.HorizontalContentAlignment == HorizontalAlignment.Right ? 0 : 2;
                }
                return 2;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
    }
    

    Unfortunately, the forums do not allow me to upload files... so I will put all of this together into a blog entry with a complete sample. If you would like to try this in the meantime, just shoot me an email.

    For issues 2 & 3, we are tracking these actively as bugs.  While they can also be fixed with the theme, doing so is cumbersome.  

    I hope this helps.

    Thanks.

    Joe

    Tuesday, December 11, 2012 9:58 PM
  • Hi Joe,

    Many thanks for your efforts on this. With the imminent (thankfully) release of the Cosmo source though and your promise to build a version of the above for same, I must confess in my case I will wait for that simply because a Cosmo theme with 'classic' grids is visually problematic, but I understand that your example can be looked at as illustrative of what can be achieved. So; looking forward to the Cosmo version!

    WIth regard to bugs in general, I'd like to make the observation that, despite many issues logged on connect between V1 and V2, as far as I am aware the ONLY actual update to LightSwitch during this period was one in which an Azure publishing issue was fixed.

    When V2 was released I certainly couldn't find any documentation within which there were references to which reported bugs HAD actually been fixed. I'd like to believe I am mistaken on this, perhaps you could enlighten me?

    This seems particularly odd since MS went to a great deal of trouble to actually set up the infrastructure to allow us to report! I seem to remember that when V2 was actually released, many comments focused on these facts rather than by the inclusion of, for example, OData, whose great promise and impact appeared rather overshadowed by this.

    Regardless; and in particular in relation to issues 2 & 3, what will be the process for getting said ( and other ) fixes? Are they likely to be released within a Service Pack/update or as an out-of-band 'hotfix'?

    Thanks in advance Joe

    Ian


    Ian Mac

    Thursday, December 13, 2012 9:54 AM
  • Hi Ian,

    I completely understand your desire to have the above sample integrated into the Cosmo theme.  I have a blog post in the making that will do just that.  Or if you're feeling adventurous, you can add the above to Cosmo theme yourself--we did finally get it released this morning. Download the cosmopolitan source here.

    With regard to your other point(s), we are presently collecting a set of bugs to be fixed in an out-of-band release.  Naturally, we won't be able to fix everything; but we are paying particular attention to connect bugs that have received confirmation or votes from the community.  So please be sure to put in a vote for anything beyond the issues raised here that are top-of-mind for you.  I don't have a specific release plan/timeframe in mind just yet--we need to first identify the bugs we can fix--but our intention is to release them out-band if at all possible. I am personally driving this effort, so feel free to contact me if you have any questions.

    Stay tuned for the above sample integrated into the cosmo theme.  I aim to publish the blog on it early next week.

    Thanks.

    Joe

    • Marked as answer by Ian Mac Tuesday, December 18, 2012 6:07 PM
    Thursday, December 13, 2012 8:39 PM
  • Hi Joe,

    Just following up on your stated intentions in your last response? I cannot seem to find any blog posts on these issues as you suggested there would be?

    Ian


    Ian Mac

    Thursday, February 7, 2013 9:59 AM
  • @Joe - thanks so much for the effort you've put in to supplying a workaround for some of these issues.

    Unfortunately, your reply somehow slipped through the cracks of my forum notifications, & I've only just seen your code.

    I've created theme extensions before (in fact I'm quite proud to say that my Luminous Themes extension had the very first community-based themes), so I'll be able to add your code to a theme without any difficulty, now that I've finally seen it.

    Thanks again. Sorry if it seemed that I was ungrateful by not replying earlier.

    PS - I'm also looking forward to your blog post(s) on these types of issues. :-)


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, February 7, 2013 12:32 PM
    Moderator
  • Hi Joe,

    I've just installed VS2012 Update 2 and was very disappointed that the Column Header alignment issue still hasn't been provided!

    Can you advise if this is actively being addressed and if so when we might see something? You've also talked about providing a blog on this. Have you been able to do it yet?

    Thanks,

    Phil

    Friday, April 12, 2013 12:04 PM