private static void AcaoPropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { GIBotaoAcaoGrid botao = (GIBotaoAcaoGrid)d; if (botao != null) { GIAcaoBotao acao = (GIAcaoBotao)e.NewValue; ImageSourceConverter conversor = new ImageSourceConverter(); if (acao != GIAcaoBotao.Customizado) { botao.Imagem = (ImageSource)conversor.ConvertFromString("/Imagens/White/" + acao.ToString() + ".png"); botao.ImagemOver = (ImageSource)conversor.ConvertFromString("/Imagens/White/" + acao.ToString() + ".png"); //botao.Descricao = botao.TraduzTexto(acao.ToString()); } } }
private static void ActionPropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { GIBotaoAcao botao = (GIBotaoAcao)d; if (botao != null) { GIAcaoBotao acao = (GIAcaoBotao)e.NewValue; ImageSourceConverter conversor = new ImageSourceConverter(); if (acao != GIAcaoBotao.Customizado) { try { string strAcao = acao.ToString(); botao.Content = NL.GI.ComponentesWPF.Cliente.Resources.Resources.ResourceManager.GetString(acao.ToString()); botao.Image = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Normal/GridButtons/" + strAcao + ".png"); botao.ImageOver = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Over/GridButtons/" + strAcao + ".png"); botao.ImagePressed = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Pressed/GridButtons/" + strAcao + ".png"); } catch (NullReferenceException nr) { var x = nr.InnerException; botao.Image = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Normal/GridButtons/Indisponivel.png"); botao.ImageOver = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Over/GridButtons/Indisponivel.png"); botao.ImagePressed = (ImageSource)conversor.ConvertFromString("pack://siteoforigin:,,,/Images/Pressed/GridButtons/Indisponivel.png"); } catch (Exception ex) { var y = ex.InnerException; botao.Image = (ImageSource)conversor.ConvertFromString("pack://application:,,,/NL.GI.ComponentesWPF.Cliente;component/images/botaoacao/indisponivel.png"); botao.ImageOver = (ImageSource)conversor.ConvertFromString("pack://application:,,,/NL.GI.ComponentesWPF.Cliente;component/images/botaoacao/white/indisponivel.png"); botao.ImagePressed = (ImageSource)conversor.ConvertFromString("pack://application:,,,/NL.GI.ComponentesWPF.Cliente;component/images/botaoacao/pressed/indisponivel.png"); } } } }