Click here to Skip to main content
15,914,642 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Quick Binding Question Pin
SledgeHammer0128-Mar-12 9:46
SledgeHammer0128-Mar-12 9:46 
GeneralRe: Quick Binding Question Pin
Kevin Marois28-Mar-12 11:00
professionalKevin Marois28-Mar-12 11:00 
GeneralRe: Quick Binding Question Pin
SledgeHammer0128-Mar-12 11:08
SledgeHammer0128-Mar-12 11:08 
GeneralRe: Quick Binding Question Pin
Kevin Marois28-Mar-12 11:17
professionalKevin Marois28-Mar-12 11:17 
GeneralRe: Quick Binding Question Pin
SledgeHammer0128-Mar-12 12:15
SledgeHammer0128-Mar-12 12:15 
QuestionWPF Splitter Not Working Pin
Kevin Marois28-Mar-12 6:59
professionalKevin Marois28-Mar-12 6:59 
AnswerRe: WPF Splitter Not Working Pin
Gerry Schmitz28-Mar-12 14:12
mveGerry Schmitz28-Mar-12 14:12 
Questionbinding text and 2 radio buttons Pin
Sutton Mehaffey28-Mar-12 5:37
Sutton Mehaffey28-Mar-12 5:37 
I've successfully bound two strings to a list, but am having trouble figuring out how to bind text with 2 radio buttons properly.

I have a zone array of 8 bytes, that holds On/Off values of the zone. There are 64 zones, thus the 8 bytes. So, bit 0 of byte 0 is '1', if the zone is ON, '0' if OFF.

I have limited space in a Grid, so I want to use a List or some other control that has automatic scrolling.

Something like:

Zone 1 ON<rb> OFF<rb>
Zone 2 ON<rb> OFF<rb>
.
.
Zone 63 ON<rb> OFF<rb>
Zone 64 ON<rb> OFF<rb>

I don't need any NotifyPropertyChanges, because when the user clicks on the SAVE button, the 8 bytes get resaved with the current settings.

I tried some things as I did before with string binding (see code), but this syntax isn't correct, and I don't know if I'm doing it correctly for Radio Buttons. Or maybe a list isn't the correct control.

List<ZoneEntry> zentry = new List<ZoneEntry>

public class ZoneEntry
{
public string ZoneNum { get; set; }
public RadioButton ZoneOff;
public RadioButton ZoneOn;
}

void CreateZoneTable()
{
for (byte i = 0; i < 64; i++)
{
zentry.Add(new ZoneEntry()
{
ZoneNum = "Zone " + (i + 1),
ZoneOff = ???
ZoneOn = ???
});
}
ZoneTable.ItemsSource = zentry;
}

C#
<DataGrid Grid.Column="0" Grid.Row="1" Height="150" Width="300"
CanUserAddRows="false"
AutoGenerateColumns ="false"
HorizontalAlignment="Left"
RowHeight ="20"
Margin="15,10,0,0"
VerticalAlignment="Top"
Name="ZoneTable"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
SelectionUnit="Cell">

<DataGrid.Columns>
<DataGridTextColumn Header = "Zone #"
Width = "SizeToHeader"
Binding = "{Binding ZoneNum}"
IsReadOnly="true"/>

<DataGridTextColumn Header = "Zone Setting"
Binding = "{Binding ZoneOn}"
Binding = "{Binding ZoneOff}"
Width="*"/>
</DataGrid.Columns>
</DataGrid>


What I want to do is set the RB to checked, if the proper zone[i] byte and bit is set to '1' when the table loads. When the user clicks SAVE, the values from zentry are converted back into the zone[i] array.

The WPF binding isn't right, because I don't know how to bind 2 RB under the same column.

Any help on the simplest approach or corrections/additions to the above?

Thanks.

Sutton
Questionwpf 3d with lots of models Pin
soheilvb28-Mar-12 5:26
soheilvb28-Mar-12 5:26 
AnswerRe: wpf 3d with lots of models Pin
Pete O'Hanlon28-Mar-12 5:56
mvePete O'Hanlon28-Mar-12 5:56 
QuestionHow to localize a DatePicker? Pin
Bernhard Hiller28-Mar-12 0:46
Bernhard Hiller28-Mar-12 0:46 
AnswerRe: How to localize a DatePicker? Pin
Bernhard Hiller28-Mar-12 19:57
Bernhard Hiller28-Mar-12 19:57 
GeneralRe: How to localize a DatePicker? Pin
Mycroft Holmes28-Mar-12 21:54
professionalMycroft Holmes28-Mar-12 21:54 
QuestionAnother Expander Style Question Pin
Kevin Marois27-Mar-12 8:14
professionalKevin Marois27-Mar-12 8:14 
AnswerRe: Another Expander Style Question Pin
Mycroft Holmes27-Mar-12 12:57
professionalMycroft Holmes27-Mar-12 12:57 
GeneralRe: Another Expander Style Question Pin
SledgeHammer0127-Mar-12 13:21
SledgeHammer0127-Mar-12 13:21 
GeneralRe: Another Expander Style Question Pin
Mycroft Holmes27-Mar-12 14:12
professionalMycroft Holmes27-Mar-12 14:12 
AnswerRe: Another Expander Style Question Pin
SledgeHammer0127-Mar-12 13:20
SledgeHammer0127-Mar-12 13:20 
GeneralRe: Another Expander Style Question Pin
Kevin Marois27-Mar-12 13:24
professionalKevin Marois27-Mar-12 13:24 
QuestionUnable to catch Key.Down in a combox with applied style Pin
George Nistor26-Mar-12 23:31
George Nistor26-Mar-12 23:31 
QuestionWPF Styling/Templating Problem Pin
Kevin Marois26-Mar-12 14:14
professionalKevin Marois26-Mar-12 14:14 
AnswerRe: WPF Styling/Templating Problem Pin
Abhinav S26-Mar-12 15:21
Abhinav S26-Mar-12 15:21 
GeneralRe: WPF Styling/Templating Problem Pin
Kevin Marois27-Mar-12 6:17
professionalKevin Marois27-Mar-12 6:17 
Questionhow to design Bubble chart with Datapoints like Piechart Pin
Tryxo26-Mar-12 12:11
Tryxo26-Mar-12 12:11 
QuestionMerge cells in C1Flexgrid for WPF Pin
Greeshma M J25-Mar-12 22:42
Greeshma M J25-Mar-12 22:42 

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.