0

I need a little kickstart for creating a Visual Studio "Startpage" in the Version 2015. There are old information (https://msdn.microsoft.com/en-us/library/Ee663382(v=vs.120).aspx) out there and some projects on Visual Studio Galery (eg "BetterStartPage" or "SolutionStartPage". Expecialy the "Custom Start Page Project Template" is out of date :-(

I do start a project with this tutorial: https://msdn.microsoft.com/en-us/library/ff425532(v=vs.140).aspx But the steps and the information are quite ... short.

Here is my problem: I compile the Custom Control Library project and following the manual installation steps mention in the article. I can select my custom start page, but it doesn't start my custom contol. The page is just empty. Its like the code in the DLL is not executed.

Here is the test-XAML file:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:MyNamespace="clr-namespace:StartPageControl;assembly=StartPageControl"
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0"
xmlns:MeineControls="clr-namespace:StartPageControl"
xmlns:local="clr-namespace:StartPageControl"
 x:Class="StartPageControl.UserControl1" 
mc:Ignorable="d"
 Height="350" Width="525">
<Grid>
    <Grid x:Name="LayoutGrid" >
        <Button Click="Button_Click" Content="push me" Foreground="black" />      
        <Label x:Name="label" Content="Label" HorizontalAlignment="Left" Margin="720,171,-295,0" VerticalAlignment="Top" Width="100"/>
    </Grid>
</Grid>
</UserControl>

UserControl1.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace StartPageControl
{
/// <summary>
/// Interaktionslogik für UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl { 
    public UserControl1()
    {
        InitializeComponent();
        ButtonApp ButtonApp1 = new ButtonApp();
        LayoutGrid.Children.Add(ButtonApp1 as UIElement);
    }

    private void Button_Click(object sender, RoutedEventArgs e) {
        label.Content = "Something happend!";
    }
}
}

EDIT:

Here are the steps I did:

  • Creating a new WPF Control Libraby Project
  • Add a new XAML and add/change the namespaces
  • Add some "code behind" eg a Button with a Click-Event
  • Compile
  • Copy the XAML file in %USERPROFILE%\My Documents\Visual Studio 2015\StartPages\
  • Copy the Project .DLL in \Common7\IDE\PrivateAssemblies\
  • Start a new VS and choose the new Startpage
  • Getting the error (translated from german): "System.Windows.Markup.XamlParseException" ... "Error creating 'Click' from Text 'Button_Click'" ..so I tried to use a UserControl in a UserControl (as you can see in the code above). There comes the the message "{clr-namespace:StartPageControl}ButtonApp can not be created"

:-( It seems to me, VS don't use the "Code Behind"/DLL...

I know it's a kind of diffuse question. Knows anybody a better startingpoint?

EDIT 2: Paste all the Test-Code.

A. Kay
  • 1
  • 1
  • Check closing tag here : `` , I created one and it works nicely. – AnjumSKhan Oct 05 '16 at 15:23
  • Thanks. Yes,... i lost this one by translating the german "Meine" to "My" ;-) But,... can you please describe a ruff list of steps from begining to a working startpage? – A. Kay Oct 06 '16 at 07:58
  • XamlParseException can also mean that there are errors in your xaml. Either that or an error in your viewmodels constructor. There's no "Button_Click" in your code though so it's hard to tell - could you add a complete example of your code? – default Oct 06 '16 at 08:10
  • OK. Thanks. Pasted all the testcode... – A. Kay Oct 06 '16 at 11:27

0 Answers0