An MVVMresources.xaml example.

Published 10/30/2014 by Christian
Tags: , , ,

OK - a quick WPF/XAML/MVVM post. Mostly for my own benefit, so I can remember the syntax. This one about a MVVM resource file.

<ResourceDictionary x:Class="FooBar.MVVMResources"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:vm="clr-namespace:foo.ViewModel"
                    xmlns:vw="clr-namespace:foo.View"
                    xmlns:vm_common="clr-namespace:bar.ViewModel;assembly=BarAssembly"
                    xmlns:vw_common="clr-namespace:bar.View;assembly=BarAssembly">

    <DataTemplate DataType="{x:Type vm:fooViewModel}">
        <vw:fooView/>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm_common:barViewModel}">
        <vw_common:barView/>
    </DataTemplate>
</ResourceDictionary>

 

As always, feel free to comment, or ask.


Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading