Click here to Skip to main content
15,888,208 members
Home / Discussions / WPF
   

WPF

 
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 
AnswerRe: Handle Title Bar Icon Click Pin
CHill6011-May-16 22:42
mveCHill6011-May-16 22:42 
AnswerRe: Handle Title Bar Icon Click Pin
Pete O'Hanlon11-May-16 23:50
mvePete O'Hanlon11-May-16 23:50 
Questionwpf Pin
Member 113037949-May-16 7:39
Member 113037949-May-16 7:39 
AnswerRe: wpf Pin
Pete O'Hanlon9-May-16 8:34
mvePete O'Hanlon9-May-16 8:34 
QuestionRe: wpf Pin
ZurdoDev11-May-16 9:20
professionalZurdoDev11-May-16 9:20 
QuestionWPF Dependency Property Of Type UserControl Pin
Kevin Marois3-May-16 5:32
professionalKevin Marois3-May-16 5:32 
QuestionUse TTF Font From Resources Pin
Kevin Marois28-Apr-16 12:13
professionalKevin Marois28-Apr-16 12:13 
AnswerRe: Use TTF Font From Resources Pin
Richard Deeming29-Apr-16 2:18
mveRichard Deeming29-Apr-16 2:18 
GeneralRe: Use TTF Font From Resources Pin
Kevin Marois29-Apr-16 5:21
professionalKevin Marois29-Apr-16 5:21 
GeneralRe: Use TTF Font From Resources Pin
Kevin Marois29-Apr-16 5:26
professionalKevin Marois29-Apr-16 5:26 
GeneralRe: Use TTF Font From Resources Pin
Kevin Marois29-Apr-16 5:43
professionalKevin Marois29-Apr-16 5:43 
QuestionSave And Restore Attached Property Values Pin
Kevin Marois27-Apr-16 11:53
professionalKevin Marois27-Apr-16 11:53 
AnswerRe: Save And Restore Attached Property Values Pin
Mycroft Holmes27-Apr-16 14:34
professionalMycroft Holmes27-Apr-16 14:34 
GeneralRe: Save And Restore Attached Property Values Pin
Kevin Marois28-Apr-16 6:47
professionalKevin Marois28-Apr-16 6:47 
AnswerRe: Save And Restore Attached Property Values Pin
Richard Deeming28-Apr-16 8:30
mveRichard Deeming28-Apr-16 8:30 

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.