【问题标题】:How to bind a View/ViewModel to Properties.Settings.Default using Caliburn Micro?如何使用 Caliburn Micro 将 View/ViewModel 绑定到 Properties.Settings.Default?
【发布时间】:2012-10-05 04:11:36
【问题描述】:

我可以将视图直接绑定到我的 Properties.Settings.Default 中的设置吗?或者我需要创建具有相同名称的属性并手动刷新值?

【问题讨论】:

    标签: wpf caliburn.micro


    【解决方案1】:

    试试这个:

    <Window x:Class="WpfApplication1.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:Properties="clr-namespace:WpfApplication1.Properties" Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
    
            <Label Content="{Binding Source={x:Static Properties:Settings.Default}, Path=BrandOfBeerOfChoice}"/>
    
        </Grid>
    </Window>
    

    在这个小应用程序中,我创建了一个名为 BrandOfBeerOfChoice 的设置条目。

    【讨论】:

      猜你喜欢
      • 2020-10-24
      • 1970-01-01
      • 2013-06-26
      • 1970-01-01
      • 1970-01-01
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-31
      相关资源
      最近更新 更多