Skip to content

Commit 612909d

Browse files
committed
Add SetListImageSize to set the image size for RibbonListButton
1 parent 05612d2 commit 612909d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111
### UI
1212
- Update `RibbonExtension` to support `CreateSplitButton` and `CreatePulldownButton`.
1313
- Update `MessageBox.ShowMessage` to close window using `Key.Escape`.
14+
- Add `SetListImageSize` to set the image size for `RibbonListButton`.
1415
### Example
1516
- Add `CreateSplitButton` and `CreatePulldownButton` to the example project.
1617

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.3.0-alpha</Version>
3+
<Version>0.3.0-alpha.1</Version>
44
</PropertyGroup>
55
</Project>

ricaun.AutoCAD.UI/RibbonExtension.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,27 @@ public static RibbonSplitButton NewPulldownButton(this RibbonPanel ribbonPanel,
504504
return pulldownButton;
505505
}
506506

507+
/// <summary>
508+
/// Sets the image size for the list items in a <see cref="RibbonSplitButton"/>.
509+
/// </summary>
510+
/// <typeparam name="T">The type of the ribbon split button.</typeparam>
511+
/// <param name="ribbonSplitButton">The ribbon split button to extend.</param>
512+
/// <param name="listImageSize">The image size to set for the list items. Default is <see cref="RibbonImageSize.Standard"/>.</param>
513+
/// <returns>The ribbon split button with the updated list image size.</returns>
514+
public static T SetListImageSize<T>(this T ribbonSplitButton, RibbonImageSize listImageSize = RibbonImageSize.Standard) where T : RibbonSplitButton
515+
{
516+
ribbonSplitButton.ListImageSize = listImageSize;
517+
return ribbonSplitButton;
518+
}
519+
507520
/// <summary>
508521
/// Adds the specified ribbon items to the <see cref="RibbonListButton"/>.
509522
/// </summary>
510523
/// <typeparam name="T">The type of ribbon list button.</typeparam>
511524
/// <param name="ribbonListButton">The ribbon list button to extend.</param>
512525
/// <param name="ribbonItems">The ribbon items to add.</param>
513526
/// <returns>The ribbon list button with the items added.</returns>
514-
public static T AddItems<T>(this T ribbonListButton, params RibbonItem[] ribbonItems) where T : RibbonListButton, new()
527+
public static T AddItems<T>(this T ribbonListButton, params RibbonItem[] ribbonItems) where T : RibbonListButton
515528
{
516529
return ribbonListButton.AddItems(null, ribbonItems);
517530
}
@@ -526,7 +539,7 @@ public static RibbonSplitButton NewPulldownButton(this RibbonPanel ribbonPanel,
526539
/// <returns>
527540
/// The ribbon list button with the items added.
528541
/// </returns>
529-
public static T AddItems<T>(this T ribbonListButton, RibbonPanel ribbonPanel, params RibbonItem[] ribbonItems) where T : RibbonListButton, new()
542+
public static T AddItems<T>(this T ribbonListButton, RibbonPanel ribbonPanel, params RibbonItem[] ribbonItems) where T : RibbonListButton
530543
{
531544
foreach (var ribbonItem in ribbonItems)
532545
{

0 commit comments

Comments
 (0)