Welcome to the Xceed Community Sign in | Join | Help
Community Search  

converting XAML to code

Sort Posts: Previous Next
  •  09-06-2008, 3:46 PM Post no. 14970

    converting XAML to code

    Hi

    I need to code all the options instead of using xaml.  I am finding the help file could do will some code examples of how to set the options.

    For example, I need to produce code for the following but just not able to find out how to do most of this.  Do you have any tools which can convert the xaml to code?

    I can see how to set some items:

     View3D1.GRID.View = New Xceed.Wpf.DataGrid.Views.CompactCardView
            View3D1.GRID.View.Theme = New Xceed.Wpf.DataGrid.ThemePack.WMP11Theme
            View3D1.GRID.SelectionMode = Windows.Controls.SelectionMode.Single
            View3D1.GRID.NavigationBehavior = NavigationBehavior.RowOnly
            View3D1.GRID.ItemScrollingBehavior = ItemScrollingBehavior.Immediate


    Things like setting CardWidth, I can find no way to set.

    <UserControl x:Class="AlbumView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300" xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" xmlns:my="clr-namespace:System;assembly=mscorlib">
        <Grid>
            <xcdg:DataGridControl Margin="4,4,2,0" Name="GRID" ReadOnly="True" SelectionMode="Single" NavigationBehavior="RowOnly" ItemScrollingBehavior="Immediate" >
                <xcdg:DataGridControl.Columns>
                    <xcdg:Column FieldName="Image" MaxWidth="0" ReadOnly="True" Title="Artwork" Width="0" TextTrimming="None" />
                    <xcdg:Column FieldName="Album" IsMainColumn="True" ReadOnly="True" Title="Album" />
                    <xcdg:Column FieldName="Artist" ReadOnly="True" Title="Artist" />
                    <xcdg:Column FieldName="Year" ReadOnly="True" Title="Year" />
                </xcdg:DataGridControl.Columns>
                <xcdg:DataGridControl.Resources>
                    <Style x:Key="{x:Type xcdg:ScrollTip}" TargetType="xcdg:ScrollTip">
                        <Setter Property="HorizontalAlignment" Value="Right" />
                        <Setter Property="VerticalAlignment" Value="Top" />
                    </Style>
                </xcdg:DataGridControl.Resources>
                <xcdg:DataGridControl.View>
                    <xcdg:CompactCardView CardWidth="156" UseDefaultHeadersFooters="False" ShowScrollTip="True" AllowCardResize="False">
                        <xcdg:CompactCardView.SeparatorLinePen>
                            <Pen Brush="#FF9CA3B5" Thickness="1">
                                <Pen.DashStyle>
                                    <DashStyle Dashes="0 2" Offset="0" />
                                </Pen.DashStyle>
                            </Pen>
                        </xcdg:CompactCardView.SeparatorLinePen>
                        <xcdg:CompactCardView.Theme>
                            <xcdg:WMP11Theme />
                        </xcdg:CompactCardView.Theme>
                    </xcdg:CompactCardView>
                </xcdg:DataGridControl.View>
            </xcdg:DataGridControl>
        </Grid>
    </UserControl>

  •  09-07-2008, 11:12 PM Post no. 14975 in reply to 14970

    Re: converting XAML to code

    So far I am finding that the help is less than average for the WPF grid, all answers come from the same person and they provide less than they promise up front. For $1000 this control is not a good buy when comparing the help.

     

    Hmm 

  •  09-08-2008, 2:09 AM Post no. 14977 in reply to 14970

    Re: converting XAML to code

    Try:

    View3D1.GRID.View.SetValue(CompactCardView.CardWidthProperty, 123)

    And yes, I share your disgust.

    I also need to build 99.9% of my grid in code behind and Xceed does not make it easy.

    For use on one or two screens doing something very specific Xceed is great. But to use in an enterprise application where you have hundreds of screens and must use a generic grid to display the data it is unpleasant.

    Anyway, I have found a way to do most of what we need in code behind. None of it "out of the box" and most with very little to no support.

  •  09-08-2008, 8:36 AM Post no. 14988 in reply to 14977

    Re: converting XAML to code

    I am sorry you are not satisfied with the level of support received by Xceed. Yes, I may be the one who answers most posts on the forums; however, when I find it is necessary for a developer to respond or if I need more information, I make sure to ask them. If you require a higher level of support, I suggest you purchase a Vanguard subscription.

    Now XAML vs code: Trust me when I tell you that I do not enjoy XAML but that is the "WPF way". Basically, I go with the notion that if you can see it (i.e., appearance), it should be XAMLed. If you can't see it (i.e., behavior) then it should be in code-behind.

     


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
  •  09-08-2008, 1:10 PM Post no. 15027 in reply to 14975

    Re: converting XAML to code

    Sam, Du Toit,

    I don't know if you know this, but if you have a Vanguard subscription, your best option for support is to use the priority email support address you were given when you got your subscription. We don't guarantee any response at all in the forums, as there are a huge number of users of the free Express Edition and we're unable to provide free tech support for a free product. Jenny, Marc and others on the WPF team visit the forums anyway (voluntarily) and answer questions, but it doesn't mean that this is the spot for tech support.

    That said, and correct me if I am wrong, but I think that it isn't the quality and level of Vanguard-level support that you really have issues with, but rather the fact that Xceed has not provided any documentation or samples for working with the DataGrid's UI using code-behind instead of XAML.

    We didn't invest in samples and documentation for working with code-behind because our development team felt it just wasn't the WPF way. Over time, we have received a few requests on how to accomplish things in code-behind, but we still felt that providing a second set of samples and examples for working this way was not wise versus other priorities. Some things just aren't recommended (by Microsoft) to be done in code-behind (such as DataTemplates), and others felt like hacks or workarounds, when using XAML was more natural.

    This means also that answering questions about how something should be done in code-behind is more difficult, though we do it for Vanguard subscribers.

    We are open to various options, but before I list them, I wanted to determine whether or not there is really a support issue (with paid support, because I explained about the forums), or whether the problem is really our decision not to encourage using code-behind for UI.

    Thanks.


    Odi Kosmatos
    VP, R&D, Xceed
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.