This is a migrated thread and some comments may be shown as answers.

RadRibbonButton define LargeImage from Path in xaml

5 Answers 383 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Aurore
Top achievements
Rank 1
Aurore asked on 01 Jun 2010, 02:40 PM
Hello,

I have some graphics described in a xaml way (using viewbox and path).
I use these graphics in some places, and I'd like if it is possible to use them directly in a RadRibbonButton, whithout export them in jpeg image.

for sample, here one of my graphic :
<ControlTemplate x:Key="ModifFigure"
        <Viewbox Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
        <Canvas Width="25.000" Height="25.000"
            <Canvas> 
 
                <Canvas> 
 
                    <!-- Calque 1/<Groupe>/<TracĂ©> --> 
                    <Path StrokeThickness="0.5" Stroke="#ffc4c6c8" StrokeMiterLimit="1.0" Data="F1 M 12.498,25.000 C 5.596,25.000 0.000,19.404 0.000,12.500 C 0.000,5.596 5.596,0.000 12.498,0.000 C 19.402,0.000 25.000,5.596 25.000,12.500 C 25.000,19.404 19.402,25.000 12.498,25.000 Z"
                        <Path.Fill> 
                            <LinearGradientBrush MappingMode="Absolute" StartPoint="396.500,312.884" EndPoint="396.500,291.182"
                                <LinearGradientBrush.GradientStops> 
                                    <GradientStop Offset="0.00" Color="#fffefefe"/> 
                                    <GradientStop Offset="1.00" Color="#ffdddedf"/> 
                                </LinearGradientBrush.GradientStops> 
                                <LinearGradientBrush.Transform> 
                                    <MatrixTransform Matrix="0.000,1.000,1.000,0.000,-291.000,-383.999" /> 
                                </LinearGradientBrush.Transform> 
                            </LinearGradientBrush> 
                        </Path.Fill> 
                    </Path> 
 
                    <!-- Calque 1/<Groupe>/<TracĂ©> --> 
                    <Path StrokeThickness="1.0" Stroke="#ff8c989f" StrokeMiterLimit="1.0" Data="F1 M 12.500,21.506 C 7.525,21.506 3.492,17.475 3.494,12.500 C 3.494,7.525 7.525,3.492 12.500,3.492 C 17.473,3.492 21.506,7.525 21.506,12.500 C 21.506,17.475 17.473,21.506 12.500,21.506 Z"
                        <Path.Fill> 
                            <RadialGradientBrush MappingMode="Absolute" GradientOrigin="433.388,315.667" Center="433.388,315.667" RadiusX="16.788" RadiusY="16.788"
                                <RadialGradientBrush.GradientStops> 
                                    <GradientStop Offset="0.00" Color="#fffefefe"/> 
                                    <GradientStop Offset="1.00" Color="#ffb1bfc7"/> 
                                </RadialGradientBrush.GradientStops> 
                                <RadialGradientBrush.Transform> 
                                    <MatrixTransform Matrix="0.000,0.802,0.802,0.000,-233.813,-335.440" /> 
                                </RadialGradientBrush.Transform> 
                            </RadialGradientBrush> 
                        </Path.Fill> 
                    </Path> 
 
                </Canvas> 
 
                <!-- Calque 1/<TracĂ©> --> 
                <Path Fill="#ffe7511e" Data="F1 M 18.651,11.870 L 20.354,10.170 C 20.966,9.558 20.966,8.561 20.354,7.950 L 18.099,5.695 C 17.489,5.081 16.490,5.083 15.880,5.695 L 14.175,7.396 C 15.744,8.962 17.778,10.998 18.651,11.870 Z"/> 
 
                <!-- Calque 1/<TracĂ© transparent> --> 
                <Path Fill="#ff1a171b" Data="F1 M 9.038,18.250 L 7.789,17.000 L 8.886,13.998 L 12.044,17.154 L 9.038,18.250 Z M 12.833,15.531 C 12.767,15.596 12.681,15.633 12.585,15.633 C 12.495,15.633 12.406,15.596 12.341,15.531 C 12.206,15.396 12.206,15.178 12.341,15.041 L 16.595,10.793 L 15.254,9.453 L 10.979,13.717 C 10.913,13.785 10.827,13.822 10.731,13.822 C 10.641,13.822 10.554,13.785 10.486,13.717 C 10.418,13.650 10.388,13.561 10.388,13.473 C 10.388,13.385 10.418,13.297 10.486,13.229 L 14.764,8.962 C 14.764,8.962 14.275,8.477 13.684,7.886 L 8.227,13.340 L 8.231,13.346 C 8.200,13.383 8.173,13.424 8.158,13.467 L 5.943,19.543 C 5.884,19.701 5.923,19.879 6.042,19.996 C 6.160,20.119 6.337,20.156 6.496,20.098 L 12.573,17.881 C 12.621,17.867 12.661,17.836 12.697,17.807 L 12.703,17.814 L 18.159,12.361 C 17.712,11.908 17.086,11.285 17.086,11.285 L 12.833,15.531 Z"/> 
 
            </Canvas> 
        </Canvas> 
    </Viewbox> 
    </ControlTemplate>

 <Button Name="btnEdit"
                                        Style="{StaticResource NodeBtn}"
                                        Width="20"
                                        Height="20"
                                        Command="v6:Commands.EditVariableCommand"
                                        CommandParameter="Node"
                                        Visibility="{Binding Path=Data.HasItem, Converter={StaticResource convBoolVisibility}}">
                                    <Button.Content>
                                        <ContentControl Template="{StaticResource ModifFigure}" Width="18" Height="18"/>
                                    </Button.Content>
                                </Button>            


well, the aim is to keep your functionality "Large, small" but using xaml figures.

Thanks
Aurore

5 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 02 Jun 2010, 08:02 AM
Hi Aurore,

This is not currently possible, but it is in our plans to implement it soon. You can vote for this issue here:
http://www.telerik.com/support/pits.aspx#/public/silverlight/1575

All the best,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Aurore
Top achievements
Rank 1
answered on 04 Jun 2010, 08:09 AM
Hello,

I use WPF version, is  there a currently pits for this issue in WPF ?

Regards
Aurore
0
Valentin.Stoychev
Telerik team
answered on 04 Jun 2010, 08:12 AM
Hello Aurore,

the code is shared between SL and WPF ( and the PITS items are shared actually). So once you get it in SL - it will be avail in WPF also.

Regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
tomcrusader
Top achievements
Rank 2
answered on 23 Apr 2014, 07:34 AM
This is still not possible? Our application enables the user to switch theme between Windows 8 and ExpressionDark. In the latter case our icons need to be switched out, and using XAML paths for different icons would be optimal.

Otherwise, any suggestion on how to switch icon sets?
0
Pavel R. Pavlov
Telerik team
answered on 25 Apr 2014, 03:05 PM
Hi,

I am not sure where you keep your icons and how exactly you visualize them but I would suggest using MVVM pattern. If you do so you will be able to create a custom ContentTemplate holding an Image control. Furthermore, you will be able to bind the Source property of the Image to a property exposed by your custom ViewModel. That property should hold the path to the image.

Also if every property of your ViewModel triggers the PropertyChanged event once it is changed, your View will be updated accordingly. This means that your icons will be changed at runtime once you change your ViewModel.

I hope this information is helpful.

Regards,
Pavel R. Pavlov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Buttons
Asked by
Aurore
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Aurore
Top achievements
Rank 1
tomcrusader
Top achievements
Rank 2
Pavel R. Pavlov
Telerik team
Share this question
or