converter

Boolean to Visibility Converter

霸气de小男生 提交于 2019-12-18 09:37:32
问题 how do i do something like this <BooleanToVisibilityConverter x:Key="BoolToVis"/> <WrapPanel> <TextBlock Text="{Binding ElementName=ConnectionInformation_ServerName,Path=Text}"/> <Image Source="Images/Icons/Select.ico" Margin="2" Height="15" Visibility="{Binding SQLConnected,Converter={StaticResource BoolToVis},ConverterParameter=true}"/> <Image Source="Images/Icons/alarm private.ico" Margin="2" Height="15" Visibility="{Binding SQLConnected,Converter={StaticResource BoolToVis}

Why Json.net does not use customized IsoDateTimeConverter?

时间秒杀一切 提交于 2019-12-18 09:09:07
问题 I use Json.net to serialize my objects and I want to customize DateTime output: Here is a small example: [DataContract] class x { [DataMember] [JsonConverter(typeof(IsoDateTimeConverter))] public DateTime datum = new DateTime(1232, 3, 23); } var dtc = new IsoDateTimeConverter(); dtc.DateTimeFormat = "yy"; JsonConvert.SerializeObject(new x(), dtc); The result is {"datum":"1232-03-23T00:00:00"} instead of {"datum":"1232"} . This works correctly (returning "32" ): return JsonConvert

h:selectOneMenu generic converter for all entities without calling DB again and again

我是研究僧i 提交于 2019-12-18 08:55:37
问题 I want to get selected object from <h:selectOneMenu> , but the problem is I couldn't find any generic converter for all type of entities. My first question is, is there a generic converter for all type of entities? I don't want to write another converter again for each other entity. My second question is, is there a way to get selected object without any converter? I don't want to call the DB again and again. I have a Car entity with id and name properties. 回答1: My first question is, is there

<f:selectItems> only shows toString() of the model as item label

拥有回忆 提交于 2019-12-18 07:17:20
问题 I am facing a problem to populate SelectOneMenu correctly using converter. I followed several google references and lastly http://balusc.blogspot.in/2007/09/objects-in-hselectonemenu.html link of BalusC. But could not figure out the problem. I am giving all my entity, managedbean and jsf code for your consideration. Entity: @Entity @Table(name = "gender") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Gender.findAll", query = "SELECT g FROM Gender g"), @NamedQuery(name = "Gender.findById

How can I convert html.slim to html.erb?

时光毁灭记忆、已成空白 提交于 2019-12-18 05:54:01
问题 I have many html.slim files that I would like to convert into html.erb files since I am not familiar with the slim syntax. Is there a converter for slim to erb? I found a converter for html to slim that has the functionality I am looking for but it does not do slim to erb. http://html2slim.herokuapp.com/ 回答1: Use Slim::ERBConverter from slim itself , there is also a command-line tool slimrb, see http://rdoc.info/gems/slim/frames for more documentation. 回答2: try the slimrb utility... slimrb -

Converting hex to string in C?

做~自己de王妃 提交于 2019-12-18 05:04:36
问题 Hello I am using digi dynamic c. I am trying to convert this in to string char readingreg[4]; readingreg[0] = 4a; readingreg[1] = aa; readingreg[2] = aa; readingreg[3] = a0; Currently when I do printf statements it has to be like this: printf("This is element 0: %x\n", readingreg[0]); But I want this in string so I can use printf statement like this printf("This is element 0: %s\n", readingreg[0]); I am essentialy sending the readingreg array over TCP/IP Port, for which I need to have it as

Converting hex to string in C?

一世执手 提交于 2019-12-18 05:04:05
问题 Hello I am using digi dynamic c. I am trying to convert this in to string char readingreg[4]; readingreg[0] = 4a; readingreg[1] = aa; readingreg[2] = aa; readingreg[3] = a0; Currently when I do printf statements it has to be like this: printf("This is element 0: %x\n", readingreg[0]); But I want this in string so I can use printf statement like this printf("This is element 0: %s\n", readingreg[0]); I am essentialy sending the readingreg array over TCP/IP Port, for which I need to have it as

Should I use WPF converter or trigger?

耗尽温柔 提交于 2019-12-18 04:39:06
问题 I was wondering how do you decide when to use converters and when to use triggers . I prefer using a triggers for operations on GUI (like showing/hiding controls, changing their appearance etc.). Some time ago I used a BooleanToVisibilityConverter for this purpose but now, I just don't need it, I do all things connected to the visibility using a triggers and I even started to think " what was the purpose of creating a BooleanToVisibilityConverter by the MS team?". Generally, when it's

Color operations in less

*爱你&永不变心* 提交于 2019-12-18 01:13:32
问题 I'm already using color theme in my website, where, for example I have a standard hex color for link states regular/hover/active. Now I want to use color operations in LESS like color:darken(@base_color, x%); So my question is: If I know my base color and my output color after the 'darken' operation, how do I know what % to give the darken operation to produce my output color? eg: If i'm going from #952262 -> #681744 what would be my %? Maybe there's a site that does these conversions?

RGB to HSL conversion

拈花ヽ惹草 提交于 2019-12-17 22:24:37
问题 I'm creating a Color Picker tool and for the HSL slider, I need to be able to convert RGB to HSL. When I searched SO for a way to do the conversion, I found this question HSL to RGB color conversion. While it provides a function to do conversion from RGB to HSL, I see no explanation to what's really going on in the calculation. To understand it better, I've read the HSL and HSV on Wikipedia. Later, I've rewritten the function from the "HSL to RGB color conversion" using the calculations from