小编Ste*_*hlm的帖子

在Visual Studio中对应NUnit属性[SetUp()]

我正在"翻译"NUnit测试到Visual Studios单元测试,我想知道[ClassInitialize()]VS中的属性是否等同[SetUp()]于NUnit?

.net nunit unit-testing visual-studio-2008 visual-studio

5
推荐指数
1
解决办法
1052
查看次数

使用自定义面板问题将附加属性绑定到ItemsControl中的项目

我不能让以下XAML按我的意愿工作.所有绑定都起作用,因为绑定没有错误.但是我没有从RatioShape矩形的绑定中获得预期的结果.问题是附加属性wpflib:RatioPanel.Ratio始终返回其默认值,而不是数据绑定值.

所以我认为RatioShape上的附加属性设置在错误的"上下文"中.如何绑定到附加属性,以便wpflib:RatioPanel获取绑定值?

<wpflib:RatioContentPresenter2 RatioMaxValue="{Binding Path=RatioMaxValue}">
    <ItemsControl Grid.Row="0" wpflib:RatioContentPresenter2.RatioOffset="{Binding Path=RatioOffset}" wpflib:RatioContentPresenter2.RatioValue="{Binding Path=RatioValue}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                    <wpflib:RatioPanel />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>

        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Rectangle x:Name="RatioShape" wpflib:RatioPanel.Ratio="{Binding Path=Value}" Fill="{Binding Path=Brush}" />
            </DataTemplate>
        </ItemsControl.ItemTemplate>

        <ItemsControl.ItemsSource>
            <Binding  Path="RatioItems" Mode="OneWay" />
        </ItemsControl.ItemsSource>
    </ItemsControl>
</wpflib:RatioContentPresenter2>
Run Code Online (Sandbox Code Playgroud)

wpf xaml binding attached-properties

4
推荐指数
1
解决办法
2669
查看次数