Добавить комментарий - CodeHelper

Добавить комментарий

А что если использовать стиль?

...
<ToolBar Grid.Row="0">
    <ToolBar.Resources>
        <Style x:Key="bindingButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=IsButtonsEnabled}"/>
        </Style>
    </ToolBar.Resources>
    <Button Content="Button1" Style="{StaticResource bindingButtonStyle}" />
    <Button Content="Button2" />
    <Button Content="Button3" Style="{StaticResource bindingButtonStyle}"/>

При этом кнопки, к которым применен стиль, получат привязку. Ну, либо все кнопки, если стилю не задавать ключ.

Внимание! Вы собираетесь отправить информацию от имени анонимного пользователя.
v1.7.123.556
© 2009—2010 CodeHelper FAQ | О сайте | Обратная связь | История изменений | Статьи
Creative Commons LicenseМатериалы сайта распространяются под лицензией Creative Commons Attribution-Share Alike 3.0 Unported.