0

I want to put several graphs in one WPF window using OXYplot library, so there will be some WPF components (like buttons) and some rectangles with graphs. It there a way to do it? In all examples the OXYplot graph occupies the whole WPF window.

I tried to put it inside a rectangle like this, but got an error "The type 'Rectangle' does not support direct content"

<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100" Margin="932,547,0,0" Stroke="Black" VerticalAlignment="Top" Width="100">
   <oxy:PlotView Model="{Binding Model}"/>
</Rectangle>
1

2 Answers 2

1

Put it in a Panel or decorate it with a a Border:

<Border Background="Yellow" BorderBrush="Black" BorderThickness="1" Padding="10">
    <oxy:PlotView Model="{Binding Model}"/>
</Border>

A PlotView is just a custom Control that you can use in your layout as you would use any other control in WPF.

Sign up to request clarification or add additional context in comments.

Comments

0

To keep it simple, you could use Grid as well, to arrange multiple PlotView and buttons in desired layout.

<Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Column="0" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <oxy:PlotView Height="500" Width="500" Model="{Binding GraphModel1}"/>
            <Button Grid.Column="1" Content="Click"/>
        </Grid>
        <Grid Grid.Column="1" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <oxy:PlotView Height="500" Width="500" Model="{Binding GraphModel2}"/>
            <Button Grid.Column="1" Content="Click"/>
        </Grid>
        <Grid Grid.Column="1" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <oxy:PlotView Height="500" Width="500" Model="{Binding GraphModel3}"/>
            <Button Grid.Column="1" Content="Click"/>
        </Grid>
        <Grid Grid.Column="0" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <oxy:PlotView Height="500" Width="500" Model="{Binding GraphModel4}"/>
            <Button Grid.Column="1" Content="Click"/>
        </Grid>
    </Grid>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.