I would like to create a button whose size is that of it’s largest edge.
The reason for this is I want the button to be a small information circle embedded inside a DataGrid column.
Currently I have:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="i" Padding="2" Margin="0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width="{Binding Source=Self, Path=Height}">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Ellipse Fill="#FFF4F4F5" Stroke="#FF6695EB"/>
<ContentPresenter Margin="0"
RecognizesAccessKey="False"
SnapsToDevicePixels="True"
VerticalAlignment="Center"
HorizontalAlignment="Center"
/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Create a class derived from Button and override the Measuring, e.g.
You can then use it something like this: