Freigeben über


Two birds, one stone [Silverlight/WPF Data Visualization Development Release 2 and DataVisualizationDemos update]

**

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments

  • Anonymous
    November 04, 2009
    Hi, The above trick for sharing XAML across both platforms won't work for TabControl. Do you know of any way around this? It would be very useful. Thanks aaadrian

  • Anonymous
    November 05, 2009
    aaadrian, TabControl/TabItem aren't sealed, so the first (easy) version of the trick works fine for me. I just created a new solution which shares MainPage.xaml across Silverlight and WPF. Here's the code. MainPage.xaml (shared): <UserControl x:Class="XamlSharedTabControlSL.MainPage"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"    xmlns:local="clr-namespace:XamlSharedTabControlSL">    <Grid>        <local:TabControl>            <local:TabItem Header="Header 1" Content="Item 1"/>            <local:TabItem Header="Header 2" Content="Item 2"/>        </local:TabControl>    </Grid> </UserControl> MainPage.xaml.cs (shared): using System.Windows.Controls; namespace XamlSharedTabControlSL {    public partial class MainPage : UserControl    {        public MainPage()        {            InitializeComponent();        }    }    public class TabControl : System.Windows.Controls.TabControl    {    }    public class TabItem : System.Windows.Controls.TabItem    {    } } Window1.xaml (WPF): <Window x:Class="XamlSharedTabControlWPF.Window1"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="clr-namespace:XamlSharedTabControlSL">    <Grid>        <local:MainPage/>    </Grid> </Window> Hope this helps!