Blendability : Degign 모드에 DataContext 설정

뷰의 xaml 코드에 다음을 추가.
<Window x:Class="WpfApplication1.Window1"
        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"
        mc:Ignorable="d"
        d:DataContext="{d:DesignInstance Type=local:ImageData, IsDesignTimeCreatable=True}"
        xmlns:local="clr-namespace:WpfApplication1"
        Title="Window1" Height="452" Width="624.972">


그리고 뷰모델의 생성자에 기본 데이타를 세팅하도록 수정.

        public ImageData()
        {
            var prop = DesignerProperties.IsInDesignModeProperty;
            bool design =
                (boolDependencyPropertyDescriptor.FromProperty(proptypeof (FrameworkElement)).Metadata.DefaultValue;
            if (design)
            {
                ImagePath = @"E:\Pictures\소녀시대 - FirstPhoto\019.jpg";
            }
 
            _openImageFileCommand = new OpenImageFileCommand(this);
            _zoomCommand = new ZoomCommand(this);
        }

댓글

이 블로그의 인기 게시물

Oracle NLS_DATE_FORMAT 변경

Stop console process using Ctrl+C.

Alternative to IValueConvert, QuickConverter