locked
Sparkle and custom/user controls (Lubo) - 1/24/2006 11:31 AM PST RRS feed

  • Question

  • By: Lubo


    Hi,
    
    Will a future (and if known, how close it is) release of Sparkle support 
    creation of custom and user controls? Currently, when opening an user control 
    xaml created in VS2005/Jan CTP and modifying it contents, Sparkle destroys 
    the whole xaml :(
    
    Thanx,
    Lubo
    Monday, February 18, 2008 8:48 PM

Answers

  • By Pete(MS):

    Hi Lubo,
    
    Couple of answers :
    
    i) Sparkle supports editing control styles / templates (right click->edit 
    template) on existing controls
    
    ii) You can create a custom control by sub-classing an existing control via 
    code; then add the .cs file to your project and do a build in sparkle. You 
    can then instantiate your control via our library by dropping the combobox at 
    the top of the library and choose the section which has the name of your 
    project (we're working on improving this). You can instantiate your control
    
    iii) We don't do a greta job on user control today - it uses a fixed 
    template which gives a XAML file. You can edit the XAML file separately, but 
    not in place in sparkle. We're working on this issue.
    
    Hope this helps
    
    Pete Faraday
    Microsoft.
    "Lubo" wrote:
    
    > Hi,
    > 
    > Will a future (and if known, how close it is) release of Sparkle support 
    > creation of custom and user controls? Currently, when opening an user control 
    > xaml created in VS2005/Jan CTP and modifying it contents, Sparkle destroys 
    > the whole xaml :(
    > 
    > Thanx,
    > Lubo
    Monday, February 18, 2008 8:56 PM

All replies

  • By Pete(MS):

    Hi Lubo,
    
    Couple of answers :
    
    i) Sparkle supports editing control styles / templates (right click->edit 
    template) on existing controls
    
    ii) You can create a custom control by sub-classing an existing control via 
    code; then add the .cs file to your project and do a build in sparkle. You 
    can then instantiate your control via our library by dropping the combobox at 
    the top of the library and choose the section which has the name of your 
    project (we're working on improving this). You can instantiate your control
    
    iii) We don't do a greta job on user control today - it uses a fixed 
    template which gives a XAML file. You can edit the XAML file separately, but 
    not in place in sparkle. We're working on this issue.
    
    Hope this helps
    
    Pete Faraday
    Microsoft.
    "Lubo" wrote:
    
    > Hi,
    > 
    > Will a future (and if known, how close it is) release of Sparkle support 
    > creation of custom and user controls? Currently, when opening an user control 
    > xaml created in VS2005/Jan CTP and modifying it contents, Sparkle destroys 
    > the whole xaml :(
    > 
    > Thanx,
    > Lubo
    Monday, February 18, 2008 8:56 PM
  • By Unni Ravindranathan (MS):

    We have couple examples to demonstrate how Points 1 and 2 that Pete makes
    works in Sparkle - we will post here as more become available:

    a)
    http://blogs.msdn.com/expression/archive/2006/01/24/517010.aspx - Flickr
    Browser
    b)
    http://blogs.msdn.com/unnir/archive/2006/01/23/516606.aspx - a looping
    ItemsControl.

    Be sure to check these out!

    Thanks,
    Unni
    --
    This posting is provided "AS IS" with no warranties, and confers no rights.

    "Pete(MS)" <Pete(MS)@discussions.microsoft.com> wrote in message
    news:87B74049-3469-47F7-9D6E-A82692F59B1D@microsoft.com...
    > Hi Lubo,
    >
    > Couple of answers :
    >
    > i) Sparkle supports editing control styles / templates (right click->edit
    > template) on existing controls
    >
    > ii) You can create a custom control by sub-classing an existing control
    > via
    > code; then add the .cs file to your project and do a build in sparkle. You
    > can then instantiate your control via our library by dropping the combobox
    > at
    > the top of the library and choose the section which has the name of your
    > project (we're working on improving this). You can instantiate your
    > control
    >
    > iii) We don't do a greta job on user control today - it uses a fixed
    > template which gives a XAML file. You can edit the XAML file separately,
    > but
    > not in place in sparkle. We're working on this issue.
    >
    > Hope this helps
    >
    > Pete Faraday
    > Microsoft.
    > "Lubo" wrote:
    >
    >> Hi,
    >>
    >> Will a future (and if known, how close it is) release of Sparkle support
    >> creation of custom and user controls? Currently, when opening an user
    >> control
    >> xaml created in VS2005/Jan CTP and modifying it contents, Sparkle
    >> destroys
    >> the whole xaml :(
    >>
    >> Thanx,
    >> Lubo
    Monday, February 18, 2008 8:57 PM
  • By Pete (MS):

    Lubo - can you also provide more details of your steps here - where did you 
    create the user control.
    Thx
    
    Pete
    Microsoft
    
    "Lubo" wrote:
    
    > Hi,
    > 
    > Will a future (and if known, how close it is) release of Sparkle support 
    > creation of custom and user controls? Currently, when opening an user control 
    > xaml created in VS2005/Jan CTP and modifying it contents, Sparkle destroys 
    > the whole xaml :(
    > 
    > Thanx,
    > Lubo
    Monday, February 18, 2008 8:57 PM
  • By Lubo:

    Hi Pete,
    
    First - thanx for the answers. 
    
    I have a project I am working on with VS2005/Jan CTP that has few 
    UserControls. I've opened the project in Sparkle and hit the following issues:
    
    a) Sparkle complains that my user controls cannot have children upon parsing 
    the main xaml where the controls are used - the controls implement IAddChild 
    though. 
    b) I've cleared up the children from my  main user control - got a stack 
    dump in the design view:
       Non-static method requires a target
         at System.Reflection.RuntimeMehotdInfo.CheckConsistency(Object target)
         at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
    invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean 
    skipVisibilityChecks)
    c) opened one of the user controls - upon the first edit in the design view 
    the xaml is 'emptied' - from:
    <?Mapping XmlNamespace="controls" ClrNamespace="PlasmaBox" ?>
    
    <UserControl x:Class="PlasmaBox.Track"
        xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
        xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
        xmlns:cc="controls"
        >
    
        <UserControl.FixedTemplate>
            <Grid Name="grid">
              <Grid Name="trackGrid" VerticalAlignment="Stretch"/>
              <Rectangle Stroke="#FF302F35" StrokeThickness="1" Height="1" 
    VerticalAlignment="Bottom"/>
            </Grid>
        </UserControl.FixedTemplate>
    </UserControl>
    
    only remains:
    
    <?Mapping XmlNamespace="controls" ClrNamespace="PlasmaBox" ?>
    
    <UserControl x:Class="PlasmaBox.Track"
        xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
        xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
        xmlns:cc="controls"
        />
    
    d) also tried to databind property of a control in the 
    UserControl.FixedTemplate to this user control property (I've posted some 
    time ago in the avalon newsgroup about this problem, so I hope it gets fixed 
    in the SDK/Runtime, because it seriously limits the usability of the user 
    controls) - didnt work.
    
    Regards,
    Lubo
    
    "Pete(MS)" wrote:
    
    > Lubo - can you also provide more details of your steps here - where did you 
    > create the user control.
    > Thx
    > 
    
    Monday, February 18, 2008 8:58 PM
  • By Pete (MS):

    Lubo - Thanks for giving me more details.
    
    We basically don't do a good job with User Control at all today - in 
    particular we don't know how to edit fixedtemplate in our current CTP.
    
    We're actively working on this.
    
    Pete Faraday
    Microsoft.
    
    "Lubo" wrote:
    
    > Hi Pete,
    > 
    > First - thanx for the answers. 
    > 
    > I have a project I am working on with VS2005/Jan CTP that has few 
    > UserControls. I've opened the project in Sparkle and hit the following issues:
    > 
    > a) Sparkle complains that my user controls cannot have children upon parsing 
    > the main xaml where the controls are used - the controls implement IAddChild 
    > though. 
    > b) I've cleared up the children from my  main user control - got a stack 
    > dump in the design view:
    >    Non-static method requires a target
    >      at System.Reflection.RuntimeMehotdInfo.CheckConsistency(Object target)
    >      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
    > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean 
    > skipVisibilityChecks)
    > c) opened one of the user controls - upon the first edit in the design view 
    > the xaml is 'emptied' - from:
    > <?Mapping XmlNamespace="controls" ClrNamespace="PlasmaBox" ?>
    > 
    > <UserControl x:Class="PlasmaBox.Track"
    >     xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
    >     xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
    >     xmlns:cc="controls"
    >     >
    > 
    >     <UserControl.FixedTemplate>
    >         <Grid Name="grid">
    >           <Grid Name="trackGrid" VerticalAlignment="Stretch"/>
    >           <Rectangle Stroke="#FF302F35" StrokeThickness="1" Height="1" 
    > VerticalAlignment="Bottom"/>
    >         </Grid>
    >     </UserControl.FixedTemplate>
    > </UserControl>
    > 
    > only remains:
    > 
    > <?Mapping XmlNamespace="controls" ClrNamespace="PlasmaBox" ?>
    > 
    > <UserControl x:Class="PlasmaBox.Track"
    >     xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
    >     xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
    >     xmlns:cc="controls"
    >     />
    > 
    > d) also tried to databind property of a control in the 
    > UserControl.FixedTemplate to this user control property (I've posted some 
    > time ago in the avalon newsgroup about this problem, so I hope it gets fixed 
    > in the SDK/Runtime, because it seriously limits the usability of the user 
    > controls) - didnt work.
    > 
    > Regards,
    > Lubo
    > 
    > "Pete(MS)" wrote:
    > 
    > > Lubo - can you also provide more details of your steps here - where did you 
    > > create the user control.
    > > Thx
    > > 
    > 
    Monday, February 18, 2008 8:59 PM