locked
Tutorial:Customizing a WPF Control Type (Nathan Manning) - 5/6/2006 11:53 AM PST RRS feed

  • Question

  • By: Nathan Manning

    I am experiencing a problem with a VB version of this tutorial project.
    In step 3 & 4 of task 2, it states:
    3. Right-click the new ImageButton and then click Edit Template > Edit a 
    Copy of the Template.... 
    4. The Create ControlTemplate Resource dialog is displayed. In Target Type, 
    select ImageButtons.ImageButton and click OK. 
    
    When I have done this, the design screen of scene1.xaml reports this error:
    "Only public classes can be used in mark up. 'ImageButton' type is not 
    public."
    
    I have tried changing the vb code to declare it both 'Public' and also 
    'Partial Public' with no effect.  Is it possible that I should ignore all 
    this until all the binding is completed on the template?
    
    Thanks,
    
    Nathan Manning
    
    Going to go try this in C# to see if it is the same.
    
    Monday, February 18, 2008 11:59 PM

Answers

  • By: Unni Ravindranathan (MS) - 5/7/2006 1:30 PM PST
    Yes, that is correct. Template editing should be back to its best level in
    our next CTP :).

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

    "Nathan Manning" <nathe.manning@gmail.com> wrote in message
    news:26BE64DF-7AB3-4632-92A2-0802C62A700C@microsoft.com...

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:55 AM

All replies

  • By: Nathan Manning
    I think I may have found a bug in the VB side of this. Just adding the
    control to the scene causes building to fail. examination of the XAML and
    comparing it to the XAML generated for the CS version shows significant
    differences. The VB case doubles the namespace name to
    "ImageButtonsVB_ImageButtonsVB" and does this in several places. I tried
    hand editting the XAML at this point to make it match as close as possible to
    what was being generated for CS and alot of errors clear up, but there is
    still an error, "including invalid XAML code..." in design mode display for
    the vb.scene1, and an error in the result stating 'Unrecognized type name:
    ImageButton'. The form and content of the the Scene1.xaml file is identical
    with the CS version with the exception that the project and namespace is
    "ImageButtonsVB" rather than "ImageButtonsCS".

    Nathan Manning
    "Nathan Manning" wrote:

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:46 AM
  • By: Nathan Manning - 5/6/2006 1:44 PM PST
    Just Building after dropping the new imagebutton on the scene generates this
    error for both places that it appears in the scene1.g.vb file:
    "Type 'VBImageButtons.VBImageButtons.ImageButton' is not defined."
    -------------------------------------------------------------------------
    "Nathan Manning" wrote:

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 1:48 AM
  • By: Unni Ravindranathan (MS) - 5/6/2006 6:08 PM PST
    Hi Nathan,

    You are absolutely right - there are a few bugs I am seeing when using
    Visual Basic in our code. I will make sure they are fixed. Thanks for taking
    the time to report it.

    Thanks,
    -Unni

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

    "Nathan Manning" <nathe.manning@gmail.com> wrote in message
    news:2E906634-BCFA-4149-8715-2EF14DE24D78@microsoft.com...

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:49 AM
  • By: Nathan Manning - 5/6/2006 6:22 PM PST
    Hi Unni,
    You're welcome. I finished walking through this tutorial in CS. I wasn't
    able to figure out hand-fixes for the VB code; I changed Scene1.xaml.vb to
    make it look like the CS code, but there must be something being generated
    behind the scenes that is not right.
    I will be working through all the how-to's and samples in WPF with this,
    and I will gladly report any bugs along the way.

    Nathan

    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 1:50 AM
  • By: Nathan Manning - 5/7/2006 11:34 AM PST
    I spoke too soon. I have encountered a bug with the CS tutorial. Everything
    works fine, until you actually build the project. Then, The design view of
    the scene replaces the controls with a box like this (if I can paste a bitmap
    in here):
    Oh well, I guess not... It is a red and white rectangle with a fat border
    and a white exclamation point in a red dot on the left and the message is:
    'ImageButton' ControlTemplate TargetType does not match templated type
    'ImageButton'.

    I have repeated the steps of the tutorial enough times to be pretty sure
    that I am doing everything according to instructions.
    If this is indeed a bug too, I will start using bug reporting when I am this
    sure that its not me.

    Nathan Manning



    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:51 AM
  • Unni Ravindranathan (MS) - 5/7/2006 1:00 PM PST
    That issue should definitely be fixed for our next CTP. There is nothing
    wrong in the sequence of steps illustrated in the tutorials. Unfortunately,
    the Visual Basic issue that you reported still lingers.

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

    "Nathan Manning" <nathe.manning@gmail.com> wrote in message
    news:D881878B-DA16-4DA6-BCD2-FFFD06618B0C@microsoft.com...

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 1:53 AM
  • By: Nathan Manning - 5/7/2006 1:08 PM PST
    Hi Unni,
    So your saying the C# behavior I am seeing is documented and fixed for
    release in the next CTP, but the VB issue missed this cycle, right? If so, I
    will move on. I've gotten the idea of what is intended here: exposing an
    incapsulized property of an associated template.

    Thanks,

    Nathan

    "Unni Ravindranathan (MS)" wrote:



    Tuesday, February 19, 2008 1:54 AM
  • By: Unni Ravindranathan (MS) - 5/7/2006 1:30 PM PST
    Yes, that is correct. Template editing should be back to its best level in
    our next CTP :).

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

    "Nathan Manning" <nathe.manning@gmail.com> wrote in message
    news:26BE64DF-7AB3-4632-92A2-0802C62A700C@microsoft.com...

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:55 AM
  • By: Nathan Manning - 5/7/2006 1:34 PM PST
    Great! Thanks.

    Nathan

    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 1:56 AM