gemini icon indicating copy to clipboard operation
gemini copied to clipboard

GraphEditor Settings

Open Goicox opened this issue 7 years ago • 4 comments

Dear All,

I am new to Gemini and I would like to add a settings page to the graphEditor. For instance, I would like to change the graphEditor background color or remove the grid, etc. with a settings view. However, I have noticed that some of these properties are embedded in the Generic.xaml located in:

gemini/src/Gemini.Modules.GraphEditor/Themes/

What would be the best way to do this?

Thank you in advance, Javier

Goicox avatar Jun 26 '17 06:06 Goicox

Javier, GraphControl class as a successor of Control class (see Gemini.Modules.GraphEditor/Controls/GraphControl.cs) has Background properties. For example see GraphView.xaml located in Gemini.Demo.Views

<local:GraphControl x:Name="GraphControl" Background="Gray" ...

To remove the grid you probably need to change Generic.xaml file. This code responsible for grid:

 <Border.Background>
 	<VisualBrush TileMode="Tile" 
 			 Viewport="0,0,25,25" ViewportUnits="Absolute"
 			 Viewbox="0,0,25,25" ViewboxUnits="Absolute">
 		<VisualBrush.Visual>
 			<Border BorderThickness="0 0 1 1"
 			Height="25" Width="25">
 			<Border.BorderBrush>
 			<SolidColorBrush Color="#77A9A9A9" />
 		</Border.BorderBrush>
 	</Border>
 </VisualBrush.Visual>
 </VisualBrush>
 </Border.Background>

You can add Visibility="Hidden" properties to prevent the grid being seen.

<Border BorderThickness="0 0 1 1" Height="25" Width="25" Visibility="Hidden">

Or it is better to make a binding, for example like this https://stackoverflow.com/questions/36991311/binding-for-border-visibility-hidden-in-wpf

luferau avatar Jun 26 '17 09:06 luferau

Aliaksei, thank you for your reply and suggestions. The thing that confuses me is that there are graph properties defined in the Generic.xaml, but others are related to GraphView.xaml (as in the demo example) like the item's background or label background.

I would like to change / access all these properties using a setting page inside Tools/Options/

What do you recommend for this? Thank you, Javier

Goicox avatar Jun 26 '17 09:06 Goicox

You need to create two properties in your GraphViewModel.cs and bind their in GraphView.xaml Like this

<local:GraphControl x:Name="GraphControl" Background="{Binding BackgroundColor}"

luferau avatar Jun 26 '17 09:06 luferau

Great! But how should I do with other properties defined in the Generic.xaml (e.g. grid visibility or spacing)?

Goicox avatar Jun 26 '17 11:06 Goicox