- golgepapaz
- Posts: 43
- Joined:
Padding between buttons
I am programmatically adding buttons to a Stackpanel.All is well but there are spaces between
buttons as shown in the image below.
I've tried using SnaptoDevicePixels instead of UseLayoutRounding property at GUIRoot after a Google search as a remedy to the problem but it seem Noesis does not respect to the property.
Also how can I set dependency properties in unity script? I am guessing it's done with SetValue() but I was unable to use it for SnaptoDevicePixels property. Should I define it myself? will it work in that case?
buttons as shown in the image below.
I've tried using SnaptoDevicePixels instead of UseLayoutRounding property at GUIRoot after a Google search as a remedy to the problem but it seem Noesis does not respect to the property.
Also how can I set dependency properties in unity script? I am guessing it's done with SetValue() but I was unable to use it for SnaptoDevicePixels property. Should I define it myself? will it work in that case?
-
sfernandez
Site Admin
- Posts: 3095
- Joined:
Re: Padding between buttons
Hi, I will try to explain what is happening.
The visual aspect of a control is determined by its Template. The buttons in your attached image are using our default style, which is designed to have a space around the button for the focus border (just click on a button and you will see a blue border around the button indicating which control has the focus).
You can modify that default appearance by defining your own ControlTemplate:
Then you can apply that template to any button:
About SnapsToDevicePixels, we didn't implement it, in favor of UseLayoutRounding because of performance reasons.
The visual aspect of a control is determined by its Template. The buttons in your attached image are using our default style, which is designed to have a space around the button for the focus border (just click on a button and you will see a blue border around the button indicating which control has the focus).
You can modify that default appearance by defining your own ControlTemplate:
Code: Select all
<ControlTemplate x:Key="MyButtonTemplate" TargetType="{x:Type ButtonBase}">
<Grid UseLayoutRounding="True">
<Border x:Name="Bg"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="1"/>
<Grid Margin="{TemplateBinding BorderThickness}">
<ContentPresenter
RecognizesAccessKey="True"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"/>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bg" Property="Background" Value="Yellow"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Bg" Property="Background" Value="Gold"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Code: Select all
<Button Template="{StaticResource MyButtonTemplate}" Content="Button"/>
- golgepapaz
- Posts: 43
- Joined:
Re: Padding between buttons
alright, thank you. Also added a bug to mantis tracker about noesis crashing seeing it was empty I was not sure whether you are checking it.
-
sfernandez
Site Admin
- Posts: 3095
- Joined:
Re: Padding between buttons
Bug tracker is the appropriate place to post bugs.
And you see it empty because visibility is limited to only your own reported bugs.
And you see it empty because visibility is limited to only your own reported bugs.
-
sfernandez
Site Admin
- Posts: 3095
- Joined:
Re: Padding between buttons
All dependency properties are wrapped with the corresponding Getter and Setter functions. For example, to set the Text dependency property in a TextBlock, you can use the SetText function:Also how can I set dependency properties in unity script? I am guessing it's done with SetValue() but I was unable to use it for SnaptoDevicePixels property. Should I define it myself? will it work in that case?
Code: Select all
NoesisGUIPanel gui = GetComponent<NoesisGUIPanel>();
FrameworkElement root = gui.GetRoot<FrameworkElement>();
TextBlock tb = root.FindName<TextBlock>("tb");
tb.SetText("Some text");
- golgepapaz
- Posts: 43
- Joined:
Re: Padding between buttons
So if I don't see it in the intellisense that means it's not implemented is that right?All dependency properties are wrapped with the corresponding Getter and Setter functions. For example, to set the Text dependency property in a TextBlock, you can use the SetText function:
Code: Select allNoesisGUIPanel gui = GetComponent<NoesisGUIPanel>(); FrameworkElement root = gui.GetRoot<FrameworkElement>(); TextBlock tb = root.FindName<TextBlock>("tb"); tb.SetText("Some text");
As for the mantis, you could at the very least make user issues visible (if that's at all possible) this would prevent duplicate entries and help refining bugs.Surely you can use another tracker for your own internal use in any case.
Re: Padding between buttons
Yes, probably. But if you miss anything just tell us.So if I don't see it in the intellisense that means it's not implemented is that right?
Yes, we have our own internal tracker (with hundreds of tickets). The one found at bugs.noesisengine.com is for clients. We made it private on purpose because many times we need resources (scenes, xamls) to track the bug and we think that data must remain private, not visible for the rest of the users.As for the mantis, you could at the very least make user issues visible (if that's at all possible) this would prevent duplicate entries and help refining bugs.Surely you can use another tracker for your own internal use in any case.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 6 guests