Click here to Skip to main content
15,912,294 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14315-May-16 12:40
indian14315-May-16 12:40 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon15-May-16 19:33
mvePete O'Hanlon15-May-16 19:33 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 6:32
indian14316-May-16 6:32 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 7:05
mvePete O'Hanlon16-May-16 7:05 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 14:39
indian14316-May-16 14:39 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 20:47
mvePete O'Hanlon16-May-16 20:47 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 22:08
indian14316-May-16 22:08 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 22:11
mvePete O'Hanlon16-May-16 22:11 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Meshack Musundi23-May-16 3:12
professionalMeshack Musundi23-May-16 3:12 
QuestionAdd Dictionary in ObsavableCollection Pin
indian14314-May-16 9:20
indian14314-May-16 9:20 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Pete O'Hanlon14-May-16 22:07
mvePete O'Hanlon14-May-16 22:07 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Richard Deeming16-May-16 1:18
mveRichard Deeming16-May-16 1:18 
GeneralRe: Add Dictionary in ObsavableCollection Pin
indian14316-May-16 6:35
indian14316-May-16 6:35 
QuestionDatagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:02
indian14313-May-16 11:02 
AnswerRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
Richard Deeming13-May-16 11:16
mveRichard Deeming13-May-16 11:16 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:44
indian14313-May-16 11:44 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 21:09
indian14313-May-16 21:09 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
Pete O'Hanlon14-May-16 3:39
mvePete O'Hanlon14-May-16 3:39 
QuestionConvert This XAML To C# Pin
Kevin Marois12-May-16 13:45
professionalKevin Marois12-May-16 13:45 
QuestionAdd a check box and delete multiple rows from DataGrid in WPF Pin
indian14312-May-16 8:46
indian14312-May-16 8:46 
AnswerRe: Add a check box and delete multiple rows from DataGrid in WPF Pin
Mycroft Holmes12-May-16 13:06
professionalMycroft Holmes12-May-16 13:06 
GeneralRe: Add a check box and delete multiple rows from DataGrid in WPF Pin
indian14312-May-16 14:12
indian14312-May-16 14:12 
QuestionUse Different Paths In Control Template Pin
Kevin Marois11-May-16 13:14
professionalKevin Marois11-May-16 13:14 
I have icons defined as Paths:
<!--SCOPE ICON-->
<Geometry x:Key="data1">M98.219,48.111C97...</Geometry>
<Geometry x:Key="data2">M98.219,46.948C97...</Geometry>
<UserControl x:Key="scopeIcon">
    <Path>
        <Path.Data>
            <GeometryGroup>
                <StaticResource ResourceKey="data1"/>
                <StaticResource ResourceKey="data2"/>
            </GeometryGroup>
        </Path.Data>
    </Path>
</UserControl

What I want to do now is use them in a Button control. I have subclassed Button into ImageButton:
public class MenuButton : Button
{
    public string Caption
    {
        get { return (string)GetValue(CaptionProperty); }
        set { SetValue(CaptionProperty, value); }
    }
    public static readonly DependencyProperty CaptionProperty =
        DependencyProperty.Register("Caption", typeof(string), typeof(MenuButton), new UIPropertyMetadata(null));

} 

and the style
<Style TargetType="Button"
        x:Key="TestButtonStyle">

<pre>
<Setter Property="Height" Value="140"/>
<Setter Property="Width" Value="195"/>

<Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="{x:Type controls:MenuButton}">

            <Border >

                <Grid>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="50*"/>
                        <RowDefinition Height="50*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    PATH(ICON) GOES HERE <=============

                    <TextBlock Grid.Row="1"
                            Grid.Column="0"Text="{TemplateBinding Caption}"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Top"
                            Margin="5"
                            Foreground="White"
                            FontSize="14"
                            TextAlignment="Center"
                            TextWrapping="WrapWithOverflow"/>

                </Grid>

            </Border>

        </ControlTemplate>

    </Setter.Value>
</Setter>




and it's used this way:
<controls:MenuButton Caption="{Binding Caption}"
                        Margin="2"
                        Width="100"
                        Style="{StaticResource TestButtonStyle}"
                        VerticalAlignment="Top"
                        Command="{Binding Path=ButtonClick}"
                        CommandParameter="{x:Static enums:Tabs.Oscilloscope}"/>

The question is, how in the button above to I set the path icon. It will be different for each use case. I want to set it up as part of the ControlTemplate then change it each time I add a new Menu Button.

Thanks
If it's not broken, fix it until it is

AnswerRe: Use Different Paths In Control Template Pin
Gerry Schmitz11-May-16 16:06
mveGerry Schmitz11-May-16 16:06 
QuestionHandle Title Bar Icon Click Pin
Kevin Marois11-May-16 5:56
professionalKevin Marois11-May-16 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.