We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Icon RibbonButton

Is there a way to set the size of the icon on a RibbonButton?
I made an icon with 96px and it's smaller there.
Can I change it?

Thanks

15 Replies

KL Karthikeyan L Syncfusion Team July 30, 2012 11:17 AM UTC

Hi Wiley,

We have edited the template of the RibbonButton and bounded the properties with the icon height and width to achieve the expected behavior, we have attached the sample for your reference.

[Sample link]:

RibbonButtonDemo.zip

Please let us know if you have any queries.

Regards,

Karthikeyan



KL Karthikeyan L Syncfusion Team July 30, 2012 11:17 AM UTC

Hi Wiley,

We have edited the template of the RibbonButton and bounder the properties with the icon height and width to achieve the expected behavior, we have attached the sample for your reference.

[Sample link]:

RibbonButtonDemo.zip

Please let us know if you have any queries.

Regards,

Karthikeyan



WB Wiley Barbosa Marques July 30, 2012 12:55 PM UTC

Thank you, very helpful!

One more thing,

I'm trying to make my own ButtonAdv template inheriting from yours, but it's not inheriting, it's overriding it.
I don't if I'm missing something
<Style TargetType="sync:ButtonAdv" x:Key="GenericButton" BasedOn="{StaticResource {x:Type sync:ButtonAdv}}">

Do you know what's going on? Or can you give me the ButtonAdv template?

Thanks!


MM Muthalagu M Syncfusion Team August 23, 2012 08:37 AM UTC

Hi Wiley,

Thanks for your update.

Sorry for the delay in getting back to you.

We have prepared a sample to inherit our ButtonAdv template and we have attached the sample please find this.

In this sample, we have acheived this by place our ButtonAdv style in window resources with key value then we have applied this style to ButtonAdv control.

Please let us know if you have any queries.

Regards,

Muthalagu.



ButtonAdvSample104372Demo_29c8b446.zip


FE fernando August 25, 2016 09:46 PM UTC

hi i have a problem.
how i can open a image in Diagram, I am using the template of Diagramming of wpf on syncfusion, i  created a new windows where the user choose the image and when clicking in the button, i have a problem.


Attachment: Video_1472143179_bc5d22db.rar


FE fernando replied to fernando August 26, 2016 07:54 PM UTC

hi i have a problem.
how i can open a image in Diagram, I am using the template of Diagramming of wpf on syncfusion, i  created a new windows where the user choose the image and when clicking in the button, i have a problem.


Attachment: Video_1472143179_bc5d22db.rar

hi i have a problem.
how i can open a image in Diagram, I am using the template of Diagramming of wpf on syncfusion, i  created a new windows where the user choose the image and when clicking in the button, i have a problem.

Attachment: Video_1472143179_3db490d7.rar


KR Keerthivasan Ramamoorthy Syncfusion Team August 28, 2016 12:54 PM UTC

 Hi Fernando, 
  
 
Thank you for contacting Syncfusion support and shared a video. 
 
Requirement: “To Load an image to Diagram when click is made on the button. 
 
we have analyzed and created a simple sample to achieve your requirement. We have provided a sample to represent this. Please refer to the sample from the following link. 
 
Sample Link:125582 
 
Regards, 
Keerthivasan R. 



FE fernando replied to Keerthivasan Ramamoorthy August 29, 2016 03:18 PM UTC

 Hi Fernando, 
  
 
Thank you for contacting Syncfusion support and shared a video. 
 
Requirement: “To Load an image to Diagram when click is made on the button. 
 
we have analyzed and created a simple sample to achieve your requirement. We have provided a sample to represent this. Please refer to the sample from the following link. 
 
Sample Link:125582 
 
Regards, 
Keerthivasan R. 


Hi
I have problem downloading  the example,
your example it does not work 
please update  the file example.

Can you help me. Please


FE fernando replied to fernando August 29, 2016 03:22 PM UTC

 Hi Fernando, 
  
 
Thank you for contacting Syncfusion support and shared a video. 
 
Requirement: “To Load an image to Diagram when click is made on the button. 
 
we have analyzed and created a simple sample to achieve your requirement. We have provided a sample to represent this. Please refer to the sample from the following link. 
 
Sample Link:125582 
 
Regards, 
Keerthivasan R. 


Hi
I have problem downloading  the example,
your example it does not work 
please update  the file example.

Can you help me. Please

Hi
I have problem downloading  the example,
your example it does not work 
please update  the file example.

Can you help me. Please

error: one or more projects in the solutions were not loaded correctly please see the output windows for details.

Attachment: Captura_de_pantalla_(28)_b42847a3.rar


FE fernando August 29, 2016 03:39 PM UTC

sorry 
I solved the problem of my error :D


KR Keerthivasan Ramamoorthy Syncfusion Team August 30, 2016 04:25 AM UTC

Hi Fernando,  
 
Thanks for the update.  
Please let us know if you need any further assistance. 
  
Regards,  
Keerthivasan R.  



FE fernando August 31, 2016 11:13 PM UTC

A question big  
I have a error in my code is: object reference not set to an instance of an object.
I am using Wpf (Windows Presentation Foundation) the tool that I have using  Diagramming of Syncfusion en this plataform, I believe a new window where the user select a imagen of combobox and when el user click in load, i have much problem because  can not  find the object reference not set to an instance of an object.

my code de my new window is:

 private void ComboBox_SelectionChanged1(object sender, SelectionChangedEventArgs e)
        {
            try
            {              
   (this.DataContext as SfDiagram).Nodes = new bservableCollection<Node>();//error
                OpenFileDialog openFileDialog = new OpenFileDialog();
  openFileDialog.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";
                if (openFileDialog.ShowDialog() == true)
                {
                    bitmap = new BitmapImage(new Uri(openFileDialog.FileName, UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }

My other method is

private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (bitmap != null)
            {
                double offX = (((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.HorizontalOffset / ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.CurrentZoom) + ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.ViewportWidth / 2 - (bitmap.Width * ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.CurrentZoom) / 2;
                double offY = (((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.VerticalOffset / ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.CurrentZoom) + ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.ViewportHeight / 2 - (bitmap.Height * ((this.DataContext as SfDiagram).Info as IGraphInfo).ScrollInfo.CurrentZoom) / 2;
                Node nodevm = new Node()
                {
                    OffsetX = offX,
                    OffsetY = offY,
                    Content = new Image() { Stretch = Stretch.UniformToFill, Source = bitmap }
                };
                ((this.DataContext as SfDiagram).Nodes as ObservableCollection<Node>).Add(nodevm);
            }
        }
the purpose is to load the image in the diagram environment.
immediately have a video as an example



Attachment: object_reference_not_set_to_an_instance_of_an_object_e8e0ae99.rar


KR Keerthivasan Ramamoorthy Syncfusion Team September 1, 2016 12:39 PM UTC

Hi Fernando, 
  
Thank you for shared a video. 
  
We have analyzed your query and the problem is DataContext is not assigned when try move to the new window. Please assign DataContext as Diagram to new Window. Please refer to the code example as below. 
  
Code example: 
Window1 a = new Window1(); 
a.DataContext = this.diagram; 
a.Owner = this; 
a.Show(); 
  
Here, 
diagram is instance of SfDiagram; 
  
  
  
Regards, 
Keerthivasan R. 



FE fernando September 1, 2016 06:25 PM UTC

hi

your help think it's wrong, because I'm using Diagramming, the link is the following that I'm using https://www.syncfusion.com/products/wpf/diagram
in a class of this project there is a class called TabbedDiagrams.xaml, where you create the diagram very different,
then I'll show you the code.

 <view:Diagram x:Name="diagrambuilder" Background="#FFF5FC" Visibility="{Binding Path=IsSelected, Converter={StaticResource BTV}}"
                               ExportSettings="{Binding ExportSettings}"
                               PrintingService="{Binding PrintingService}"
                               Tool="{Binding Tool, Mode=TwoWay}"
                               DrawingTool="{Binding DrawingTool}"
                               DefaultConnectorType="{Binding DefaultConnectorType, Mode=TwoWay}"
                               Nodes="{Binding NodeCollection}"
                               Groups="{Binding GroupCollection}"
                               Connectors="{Binding ConnectorCollection}"
                               SelectedItems="{Binding SelectedItems}"
                               PageSettings="{Binding PageSettings}"
                               HorizontalRuler="{Binding HorizontalRuler}"
                               VerticalRuler="{Binding VerticalRuler}"
                               SnapSettings="{Binding SnapSettings}"
                               PortVisibility="{Binding PortVisibility}">
                    </view:Diagram>

this code Xaml that is in the class TabbedDiagrams.xaml
and I can not initialize the object as you comment because  the view, not have  the button to open a window, the button event  that habre the bentana is in MainWindow.xaml in other vista.

Example of buttn event of MainWindos.xaml

       <Button  x:Uid="2" Width="300" Command="{Binding DataContext.Open, Mode=TwoWay,ElementName=ribbon }" CommandParameter="1XH" Click="Button_Click_2">
                                        <Button.Template>
                                            <ControlTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <Image Source="{StaticResource newpagepng}" Width="35" Height="35" Stretch="Fill" VerticalAlignment="Center"/>
                                                    <TextBlock Text="Hiper" FontSize="14" VerticalAlignment="Center"/>
                                                    <StackPanel.Style>
                                                        <Style TargetType="StackPanel">
                                                            <Style.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter Property="Background" Value="LightBlue"/>
                                                                </Trigger>
                                                                <Trigger Property="IsMouseOver" Value="False">
                                                                    <Setter Property="Background" Value="Transparent"/>
                                                                </Trigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </StackPanel.Style>
                                                </StackPanel>
                                            </ControlTemplate>
                                        </Button.Template>
                                    </Button>

                             
In a word I'm using
3 view
1-TabbedDiagrams.xaml ---- Design Diagram
2- Main Windows.xaml --- system startup
3-NewSheet.xaml --- my window images
Option 3 is where I want  initialize the object


Attachment: object_reference_not_set_to_an_instance_of_an_object_a6157f5b.rar


KR Keerthivasan Ramamoorthy Syncfusion Team September 2, 2016 01:15 PM UTC

Hi Fernando, 
  
 
Requirement: “To Load an image to Diagram when click is made on the button”. 
 
Already we have provided a simple sample to achieve your requirement. Now, we have provided a code example and video to achieve your requirement in DiagramBuilder. Please refer to the code example and video as below. 
 
Code example: 
Add below code in ManiWindow.Xaml: 
   <syncfusion:BackStageCommandButton Click="BackStageCommandButton_Click" Header="Open"  ></syncfusion:BackStageCommandButton> 
Add Below code in MainWindow.cs: 
private void BackStageCommandButton_Click(object sender, RoutedEventArgs e) 
        { 
            View.NewSheet a = new View.NewSheet(); 
            a.DataContext = this; 
            a.Owner = this; 
            a.Show(); 
        } 
Add the Below attached .xaml and .cs file to View Folder. 
NewWindow File:125582_File

 
Add the below codde in DiagramBuilderVM.cs: 
public void OnOpenCommand(object param) 
        { 
            string file = param.ToString(); 
            BitmapImage bitmap = new BitmapImage(new Uri(file, UriKind.Absolute)); 
            double offX = ((this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.HorizontalOffset / (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.CurrentZoom) + (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.ViewportWidth / 2 - (bitmap.Width * (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.CurrentZoom) / 2; 
            double offY = ((this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.VerticalOffset / (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.CurrentZoom) + (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.ViewportHeight / 2 - (bitmap.Height * (this.SelectedDiagram.Info as IGraphInfo).ScrollInfo.CurrentZoom) / 2; 
            NodeVM nodevm = new NodeVM() 
            { 
                OffsetX = offX, 
                OffsetY = offY, 
                Content = new Image() { Stretch = Stretch.Fill, Source = bitmap } 
            }; 
            (this.SelectedDiagram.Nodes as ObservableCollection<NodeVM>).Add(nodevm); 
             
        } 
 
 

 
 
Regards, 
Keerthivasan R. 
 


Loader.
Up arrow icon