WPF에서 Window 또는 UserControl 요소에서 StaticResource를 호출하면 오류가 발생했습니다.

5716 단어 XamlMVVMC#WPF
뭔가 오류가 나왔다.

이런 ViewModel이 있다면
    public class MainVM : BindableBase
    {
        private string _Title;
        public string Titile
        {
            get { return _Title; }
            set { SetProperty(ref _Title, value); }
        }

        private bool _IsVisible;
        public bool IsVisible
        {
            get { return _IsVisible; }
            set { SetProperty(ref _IsVisible, value); }
        }

    }

이런 Xaml이라고 한다.
<Window x:Class="WpfApplication1.MainWindow"
        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:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Height="350" Width="525" 
        Title="{Binding Title}" 
        Visibility="{Binding Path=IsVisible,Converter={StaticResource bvConv}}">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="bvConv" />
    </Window.Resources>
    <Grid>

    </Grid>
</Window>



갓~~( ;∀;)

<Window x:Class="WpfApplication1.MainWindow"
        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:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Height="350" Width="525" 
        Title="{Binding Title}">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="bvConv" />
    </Window.Resources>
    <Window.Style>
        <Style TargetType="{x:Type Window}">
            <Setter Property="Visibility" Value="{Binding Path=IsVisible,Converter={StaticResource bvConv}}" />
        </Style>
    </Window.Style>
    <Grid>

    </Grid>
</Window>

오케이(^^)/

좋은 웹페이지 즐겨찾기