2017-06-25 2 views
1

Wie die BarCheckITem Hintergrundfarbe zu ändern, sind hardtime die Stile für DevExpress Wechsel mit KontrollenWie dxb ändern: BarcheckItem Hintergrund- und Vordergrund Stil

 <dxb:ToolBarControl ShowBackground="True" Grid.Row="0" HorizontalAlignment="Stretch" 
         VerticalAlignment="Top" 
         AllowCustomizationMenu="True" 
         BarItemDisplayMode="ContentAndGlyph" UseWholeRow="True" 
         AllowHide="False" AllowQuickCustomization="False" RotateWhenVertical="False"> 


     <dxb:BarCheckItem Content="Forms" 
          Glyph="{dx:DXImage Image=AddItem_16x16.png}" 
          GroupIndex="-11" 
          BarItemDisplayMode="ContentAndGlyph" 
          LargeGlyph="{dx:DXImage Image=AddItem_32x32.png}" /> 
<dxb:ToolBarControl> 

Antwort

1

Sie müssen die BarCheckItemLink.CustomResources außer Kraft zu setzen und dann ein hinzufügen Stil, um die Standardvorlage zu überschreiben. Ich habe eine einfache Probe zu zeigen, dies gemacht:

<dx:DXWindow x:Class="BarCheckItemBackground.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" 
     xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" 
     Title="MainWindow" Height="350" Width="525"> 
    <Grid> 
     <dxb:BarManager ToolbarGlyphSize="Large"> 
      <dxb:BarManager.Items> 
       <dxb:BarCheckItem x:Name="ItemNormal" 
            Content="I am normal" 
            Glyph="{dx:DXImage Image=AddItem_16x16.png}" 
            BarItemDisplayMode="ContentAndGlyph" 
            LargeGlyph="{dx:DXImage Image=AddItem_32x32.png}" /> 
       <dxb:BarCheckItem x:Name="ItemNotNormal" 
            Content="I am not normal lol" 
            Glyph="{dx:DXImage Image=AddItem_16x16.png}" 
            GroupIndex="-11" 
            BarItemDisplayMode="ContentAndGlyph" 
            LargeGlyph="{dx:DXImage Image=AddItem_32x32.png}" /> 
      </dxb:BarManager.Items> 
      <dxb:BarManager.Bars> 
       <dxb:Bar> 
        <dxb:Bar.DockInfo> 
         <dxb:BarDockInfo ContainerType="Top"/> 
        </dxb:Bar.DockInfo> 
        <dxb:BarCheckItemLink BarItemName="ItemNormal" /> 
        <dxb:BarCheckItemLink BarItemName="ItemNotNormal"> 
         <dxb:BarCheckItemLink.CustomResources> 
          <ResourceDictionary> 
           <Style TargetType="{x:Type dxb:BarCheckItemLinkControl}"> 
            <Setter Property="Template"> 
             <Setter.Value> 
              <ControlTemplate TargetType="{x:Type dxb:BarItemLinkControl}"> 
               <Grid> 
                <Border Background="Yellow"/> 
                <dxb:BarItemLayoutPanel x:Name="PART_LayoutPanel"/> 
               </Grid> 
              </ControlTemplate> 
             </Setter.Value> 
            </Setter> 
           </Style> 
          </ResourceDictionary> 
         </dxb:BarCheckItemLink.CustomResources> 
        </dxb:BarCheckItemLink> 
       </dxb:Bar> 
      </dxb:BarManager.Bars> 
     </dxb:BarManager> 
    </Grid> 
</dx:DXWindow> 

Und das Ausgabefenster: enter image description here

this helps

Verwandte Themen