Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want change the color of resetbutton on click
c# function

private void ReasetButtonClick(object sender, RoutedEventArgs e)
{
int count =110000;
resetbutton.Background = (Brush)FindResource("MySelectedButtonOrangeGradientBrush");
applybutton.Background = SystemColors.ControlLightLightBrush;


while (count>0)
{



count--;

}

resetbutton.Background = SystemColors.ControlLightLightBrush;
int retval = BLLWrapper.BLLIsAdmin();
if (retval == 0)
MessageBox.Show(Properties.Resources.NO_ADMIN_PRIVILEDGES);
else
{
proxformate = 0;
RadioButtonRaw.IsChecked = true;
// proxformate = 254;
//RadioButtonAuto.IsChecked = true;
// BLLWrapper.BLLSaveProxFormat(proxformate);

}

}









wpf file














XML
<UserControl x:Class="HID_okworkbench.ProxCardSettingContent"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FontFamily="Tahoma" FontSize="11"

    Height="auto" Width="auto" Background="{DynamicResource MyBlueBackgroundGradientBrush}" >

    <TabControl Background="{DynamicResource MyBlueBackgroundGradientBrush}" >

        <TabItem Header="Proxcard Setting" PreviewKeyUp="UserControl_PreviewKeyUp" PreviewKeyDown="UserControl_PreviewKeyDown">

            <Grid Margin="0,0,20,10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >

                <Grid.RowDefinitions>

                    <RowDefinition Height=".920*"/>

                    <RowDefinition Height=".080*"/>

                </Grid.RowDefinitions>

                <GroupBox Header="ATR decoding Format" Grid.Row="0" Margin="50,50,50,20" >

                    <Grid>

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition/>

                            <ColumnDefinition/>

                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>

                            <RowDefinition/><rowdefinition />
                            <rowdefinition />
                            <rowdefinition />
                        
                        <radiobutton name="RadioButtonRaw" grid.row="0" grid.column="0" horizontalalignment="Left" verticalalignment="Center" margin="40,0,0,0">Raw</radiobutton>
                        <radiobutton name="RadioButtonH10301" grid.row="1" grid.column="0" horizontalalignment="Left" verticalalignment="Center" margin="40,0,0,0">H10301</radiobutton>
                        
                    
                
               
                    
                    <Button Name="resetbutton" Grid.Column="2" Click="ReasetButtonClick">
                        <Button.Content>
                            <textblock>
                                <underline>R</underline>eset
                            </textblock>
                        </Button.Content>
                    </Button>
Posted

Using a countdown as a timer ? Insane.

C#
int retval = BLLWrapper.BLLIsAdmin();
if (retval == 0)



Why is IsAdmin returning an int ? Why store it ? Why put BLL at the head of your metehods ?

Sounds like you have some vague ideas about programming but no idea how to apply them. I don't get what you're stuck with, surely this code will change your button color ?
 
Share this answer
 
A Style for Round Glassy WPF Buttons[^] should probably help you.
 
Share this answer
 
Comments
Christian Graus 10-Aug-11 2:14am    
Sometimes I think some people just post random article links. How is this link related to his changing the color of a button at runtime ? Can you see where his code is failing to do that ? I think his question is half formed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900