0
這可能是我的無知,但我遇到了一個問題,我的組合框的樣式在運行時會消失,但不會在編輯器中消失。我有:WPF組合框樣式丟失
<DataTemplate x:Key="DropDownSelectTemplate">
<Grid>
<ComboBox x:Name="cb"
ItemsSource="{Binding Source={StaticResource HookCollection}, Path=Collect }"
DisplayMemberPath="Device"
SelectedItem="{Binding Path=HookCollection.SelectedItem}"
>
</ComboBox>
<TextBlock x:Name="tb" Foreground="#858585" IsHitTestVisible="False" Padding="4,1,0,0" Visibility="Hidden">
<Italic>Select A Device</Italic>
</TextBlock>
</Grid>
<DataTemplate.Triggers>
<Trigger SourceName="cb" Property="SelectedItem" Value="{x:Null}">
<Setter TargetName="tb" Property="Visibility" Value="Visible"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
與...
<ContentControl ContentTemplate="{DynamicResource DropDownSelectTemplate}" Margin="5,0" Height="20" Grid.Row="1" Grid.Column="2" Panel.ZIndex="1" />
我的目標:有一個databinded組合框。我不要求多...
我的結果:
所以,我能做些什麼來保持默認的風格,或者說,最大可以更改的設置文本顯示的組合框,但沒有擺脫背景,窗口效果和更多。
你在comboBox上應用了一些樣式嗎? – 2014-10-03 16:31:14
我不這麼認爲。除非上述內容不是我可以輸入風格的唯一地方。我沒有任何背後的代碼...... – BlndLeadingDef 2014-10-03 17:42:00
在窗口資源或應用程序資源下,可能會爲ComboBox聲明一些默認樣式。發佈的代碼對我來說似乎很好。 – 2014-10-03 17:57:31