Questions tagged [viewbox]

The ViewBox is a very useful control in WPF. If does nothing more than scale to fit the content to the available size. It does not resize the content, but it transforms it.

358 questions
9
votes
1 answer

How to use viewbox when height of svg is dynamically changing

I have a resizable div. It has two inner divs. One of the inner divs has an svg element in it. In the svg element I am adding and removing the content dynamically such that each time I add something in my svg. I increase its height by adding 20px to…
A_user
  • 2,087
  • 6
  • 25
  • 33
8
votes
1 answer

How to stretch text in a square button?

In my application, I have a grid of square buttons. The text content for each button is set at runtime. In most cases, the text is just one character long, but sometimes it's longer. I need to make the whole text to be always visible, i.e. stretch…
agnes
  • 83
  • 1
  • 5
8
votes
3 answers

Why doesn't an HTML anchor tag wrap a scalable SVG ?
I have created a scalable SVG object, using the preserveAspectRatio and viewBox attributes in the SVG file itself:
Jake Rayson
  • 921
  • 7
  • 20
8
votes
1 answer

WPF. How to show only part of big canvas?

Lets say I have a canvas defined to be 1000x1000 big. Is it possible to only show a 100x100 part of it in a Viewbox(or a rectangel)? Any help is apreciated.....
Erik Z
  • 4,660
  • 6
  • 47
  • 74
8
votes
2 answers

Calculating viewBox parameters based on path elements in SVG

I get an XML or JSON with paths only, and I need to recreate the SVG image. I create an empty , I add a in it,…
Martin Spa
  • 1,494
  • 1
  • 24
  • 44
7
votes
1 answer

Scrollable content inside WPF Viewbox with "UniformToFill"

How could I make the content which is put inside WPF Viewbox with Stretch="UniformToFill" be scrollable? For example:
rem
  • 16,745
  • 37
  • 112
  • 180
7
votes
2 answers

How to keep viewBox centered when "zooming" in SVGs?

Often I use the viewBox attribute to "zoom" a SVG element. Zoom is accomplished of course by using lower width and height values for the viewBox attribute - but the x and y values are tricky to figure out for keeping the scene centered. Below is a…
basement
  • 718
  • 8
  • 15
7
votes
2 answers

How do I keep a constant FontSize in WPF Viewbox?

I have a Viewbox with a number of TextBlocks that are scaled and positioned perfectly by the ViewBox. Something like this:
Hallgrim
  • 15,143
  • 10
  • 46
  • 54
7
votes
1 answer

Change in mouse position when viewbox is added

I am currently learning and working in JavaScript and SVG and I am new to it. Here is my scenario I have a div which has an SVG inside it.
Now I want…
A_user
  • 2,087
  • 6
  • 25
  • 33
6
votes
1 answer

checking if svg element is inside the viewbox

having a SVG inline an HTML document , with a viewbox "x y w h". How can I check if an element is inside the view box? by saying element it could be a nested child path inside a group and so on ... so I think I'm looking for a build in function of…
Haddar Macdasi
  • 3,477
  • 8
  • 37
  • 59
6
votes
2 answers

Stretch inside an to fit window size

I am trying to stretch an svg document inside an DOM in order to fit the window size. like so:
click to zoom