CheckBox in SAPUI5 xml view not shown as checked - checkbox

I have placed a checkbox in my SAPUI5 xml view as follows:
<CheckBox checked="true" editable="false"/>
However, the checkbox is shown as unchecked. Looking at the reference, "checked" is a boolean field; I cannot see anything wrong in above code.
Reference:
https://sapui5.hana.ondemand.com/sdk/test-resources/sap/ui/commons/demokit/CheckBox.html#settings
What's the matter?

sap.ui.commons.CheckBox uses checked, editable and enabled
sap.m.CheckBox uses selected and enabled
<CheckBox text="{field}" selected="true" enabled="false" />
is it possible you are using sap.m.Checkbox

Related

Devexpress ComboEdit Focus to options by text

I am using ComboBoxEdit of DevExpress like this:
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="1" SelectedIndex="0" EditValue="{Binding conti_cd, UpdateSourceTrigger=PropertyChanged}" SelectedIndexChanged="cboRegion_SelectedIndexChanged" ShowSizeGrip="False" x:Name="cboRegion"/>
Now, I donot allow user input text to this combox but, I wanna select options in ComboBox by text.
Example:
I have a combobox like above.
When I type "E" the combobox will focus to "EUROPE" options.
I tried to research but I don't know how to do.
Please give me some suggestion.
I found the solution by myself.
Just set AutoComplete = true;
Full code should be like this:
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="1" SelectedIndex="0" EditValue="{Binding conti_cd, UpdateSourceTrigger=PropertyChanged}" SelectedIndexChanged="cboRegion_SelectedIndexChanged" ShowSizeGrip="False" x:Name="cboRegion" AutoComplete="true"/>
And if someone get the trouble like me, please read below comment:
If the AutoComplete property is set to true, the text typed by an
end-user within the edit box is automatically completed, if it matches
a value displayed within the dropdown. By default, the AutoComplete
option is disabled for ComboBoxEdit, and enabled for LookUpEdit.
The Auto-Complete feature is not supported if the combobox editor's
popup window is represented by a check box list.

WiX: ListItems not displayed in ComboBox

When I create (try to create) a ComboBox in WiX, the box receives its initial value from the corresponding property's value set earlier in the .wxs-file. This far, everythings goes as planned. When I try to change its value graphically, it displays no available list items. I have not found any necessary or relevant attributes etc in the docs that I haven't used, but also I'm quite noobish on WiX so maybe have missed something obvious. The code is below:
<Property Id="LANGUAGE" Value="Swedish" />
... cut ...
<Control Type="ComboBox" ComboList="yes" Property="LANGUAGE" Id="languages_combo" Width="..." Height="..." X="..." Y="...">
<ComboBox Property="LANGUAGE">
<ListItem Value="Swedish" />
<ListItem Value="English" />
</ComboBox>
</Control>
I want to be able to select "English" instead of "Swedish" in the drop-down, but that option is not available (and not "Swedish" for that matter - even that's the default value). Any suggestions how to solve this? I have searched the net without success, so I guess it's so basic no one has run into the same problem :-)
If it helps, here is the compilation:
candle test.wxs
light -ext WixUIExtension -sice:ICE20 test.wixobj
Attempts made by me:
Adding Text="..." to the ListItems does not help.
Replacing "ComboBox" with "ListBox" (and removeing attribute ComboList) displays the options/ListItems, but unfortunately ListBox is not the control that I want.
It's interesting when you make the same mistake over and over again, and never realize it's the good old mistake. I increased the Height attribute for Control, so the ListItems fit. Works like a charm!
I think you need to set the visible displayed text on the ListItems.
Try this:
<ComboBox Property="LANGUAGE">
<ListItem Text="English" Value="English" />
<ListItem Text="Swedish" Value="Swedish" />
</ComboBox>

How to Enable , Disable checkbox column in Silverlight Datagrid based on my Data

i have a silverlight datagrid where first column is a checkbox column.
which looks like this..
<sdk:DataGridCheckBoxColumn Header ="Select" Binding="{Binding Path=IsChecked ,Mode=TwoWay}" ></sdk:DataGridCheckBoxColumn>
this would check or uncheck based on my binding property IsChecked.
i also have a Binding property IsCheckBoxEnabled.
Is it possible to enable disable the checkbox using this property.
something like this.
<sdk:DataGridCheckBoxColumn Header ="Select" IsReadOnly={Binding IsCheckBoxEnabled} Binding="{Binding Path=IsChecked ,Mode=TwoWay}" ></sdk:DataGridCheckBoxColumn>
though the above line doesn't work. Am I missing something? i don't want to handle it in code behind.
I had the same problem:
Silverlight, datagrid, autogenerated columns on modified column change cell visibility of content
This is how I found and fixed it.

Binding ribbon text box IsEnabled to checkbox IsChecked not working

Here is the sample XAML:
...
<ribbon:RibbonTab Header="MyTab">
<ribbon:RibbonGroup Header="Blah">
<ribbon:RibbonTextBox x:Name="MyTextBox"
IsEnabled="{Binding IsChecked, ElementName=MyCheckBox}" />
<ribbon:RibbonCheckBox x:Name="MyCheckBox" Label="some text" />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
...
For some reason, the text box stays disabled regardless of whether or not the check box is checked. Why is the binding not working properly?
You can add the above code minus the elipses at the top and bottom to a boiler plate WPF ribbon project and see if you can figure out what's wrong. I see no binding error diagnostics, for example.
Update: If a regular TextBox is substituted for the RibbonTextBox, the behavior becomes correct. I conclude that there must be some issue with binding the IsEnabled property of a RibbonTextBox.
Freaky update #2: Creating a basic RibbonTextBox and setting its IsEnabled property to True creates a disabled RibbonTextBox. What gives?
I have submitted a bug report on Microsoft Connect to further pursue this issue.
Final update: It's fixed in WPF 4.5.
As a wild guess, have you tried fully qualifying the property?
IsEnabled="{Binding RibbonCheckBox.IsChecked, ElementName=MyCheckBox}"
... or maybe even...
IsEnabled="{Binding CheckBox.IsChecked, ElementName=MyCheckBox}"

Checkbox cell click behaviour in Telerik RadGridView is not intuitive and requires multiple clicks

I have bound a Telerik RadGridView properly with the first column being a bound checkbox:
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Selected, Mode=TwoWay}"
Header="Generate" Width="95" IsReadOnly="False"/>
I can click and change the checkbox state no problem. The problem is that checking the checkbox is not intuitive. In order for a user to click a checkbox, they have to first click the checkbox cell, click again to activate, and then click again to check the check box. Three individual clicks to check the checkbox.
Is there a better or native way to make this seamless? I want the user to be able to click a checkbox and immidiately see it checked regardless if the row/cell is already selected. I want the user to be able to do a check in one click.
Infragistics controls could do this years ago.
Could someone please explain how to get more intuitive check box behaviour in the Telerik RadGridView for Silverlight?
I've had much the same issue as you recently. What I did to fix it was to put a CheckBox in the CellTemplate of the column:
<telerik:GridViewDataColumn Header="Checkbox Column" IsReadOnly="True">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=BooleanProperty, Mode=TwoWay}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
Note that I've added the property IsReadOnly="True" to the column. This doesn't make the column read-only; you should still be able to click on the checkbox and set your boolean property. What this property does is to prevent the cells in the column from using the CellEditTemplate when you click on them.
Normally, a RadGridView column uses the CellTemplate for viewing and the CellEditTemplate when the cell goes into edit mode. However, we don't need to use the CellEditTemplate here, because the CellTemplate is perfectly capable of changing the value of these boolean properties on its own.
The telerik documentation site now has some alternatives to the approach listed in the accepted answer:
PROBLEM
If you have a GridViewCheckBox column to your gridview you need to
click three times by default in order to change the value of the
checkbox - the first two clicks will enter the edit mode and the last
one will change the value.
The following solutions will give you options to control the number of
clicks needed to change the value of the checkbox column.
SOLUTION
First approach
2 clicks solution
By setting the EditTriggers="CellClick" property of the
GridViewCheckBoxColumn the cells will enter edit mode with a single
click only. Now you will need one more click to change the value of
the checkbox.
1 clicks solution
In addition to the EditTriggers="CellClick" property, you can set the
AutoSelectOnEdit="True" property of the GridViewCheckBox column. This
property will alter the checked state of the checkbox as soon as the
cell enters edit mode, thus changing the value on a single click.
Please note that the GridView has to be focused.
This could be done in XAML or in code behind when the columns are
AutoGenerated:
XAML
<telerik:GridViewCheckBoxColumn Name="CheckBoxColumn"
EditTriggers="CellClick"
AutoSelectOnEdit="True"
DataMemberBinding="{Binding IsChampion}" />
C#
private void gridView_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
var dataColumn = e.Column as GridViewDataColumn;
if (dataColumn != null)
{
if (dataColumn.UniqueName.ToString() == "IsChampion")
{
// create GridViewCheckBoxColumn
GridViewCheckBoxColumn newColumn = new GridViewCheckBoxColumn();
newColumn.DataMemberBinding = dataColumn.DataMemberBinding;
newColumn.Header = dataColumn.Header;
newColumn.UniqueName = dataColumn.UniqueName;
newColumn.EditTriggers = Telerik.Windows.Controls.GridView.GridViewEditTriggers.CellClick;
newColumn.AutoSelectOnEdit = true;
e.Column = newColumn;
}
}
}

Resources