BlankMauser
Topic Author
Posts: 1
Joined: 02 Oct 2024, 09:07

Extending ComboBox

07 Oct 2024, 07:27

In WPF I can extend control templates (like ComboBox). However, when I try extending ComboBox in Noesis, even when I declare identical comboboxes (Which appear identical in Blend), the extended combobox in Unity is just completely broken:

Image

Left is the extended combobox that has no code, just inherits from Noesis.Combobox. While right is the default one.

I'm guessing that this is just not the intended workflow for Noesis? If I want to extend combobox I should be creating my own control and inheriting from ItemClass and essentially re-doing a lot of the default functionality?
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: Extending ComboBox

10 Oct 2024, 10:48

Hi, the magenta indicates that Noesis is using the internal default styles for your custom ComboBox. This means that you haven't defined a style for your custom control in the Application Resources. If you want to use the style+template defined in NoesisTheme for the ComboBox you can just extend that style:
<Style TargetType="{x:Type local:CustomComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}"/>
Could you please try that?
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: Extending ComboBox

10 Oct 2024, 11:24

I declare identical comboboxes (Which appear identical in Blend)
Just to clarify, did you include our NoesisTheme in the Blend project?
To do so you'll have to add a reference in the Blend project to our Noesis.GUI.Extensions NuGet and then add the following line to your App.xaml (Application Resources):
<Application>
  <Application.Resources>
    <ResourceDictionary Source="pack://application:,,,/Noesis.GUI.Extensions;component/Theme/NoesisTheme.DarkBlue.xaml" />
  </Application.Resources>
</Application>
This way you can see Noesis styles while designing in Blend.

When this is correctly setup and you add a ComboBox and a CustomComboBox to your window you should see that the CustomComboBox is not using the Noesis theme either, it just falls back to the operating system (internal) template.
blend-cb.png
blend-cb.png (7.16 KiB) Viewed 2169 times

Who is online

Users browsing this forum: No registered users and 3 guests