How to know when a XAML element is finished loading - wpf

I have a custom control I'm developing that has a collection of items. When adding an item to the collection you're meant to do:
myCustomControl.BeginAddItems();
myCustomControl.Items.Add("a");
myCustomControl.Items.Add("b");
myCustomControl.Items.Add("c");
myCustomControl.EndAddItems();
If defining in XAML it would be:
<MyControl>
<Items>
<Item Name="a" />
<Item Name="b" />
<Item Name="c" />
</Items>
</MyControl>
How can I have EndAddItems (and ideally BeginAddItems) called when loading from XAML? Is there any way that MyControl can be notified by XAML that it has finished loading?

You can use the Loaded event

Related

How to change column title datagrid?

How to change column title datagrid ?
I need to change the caption of the columns, but I'm not getting.
The Code:
<List title="Todos Usuários" {...props}>
<Datagrid>
<TextField title="Codigo" --> not worked source="id" />
<TextField source="name" />
<EmailField source="email" />
</Datagrid>
</List>
Use label instead of title, but it is correct to use translation files to automatically get the required field labels: "Translating Resource and Field Names": https://marmelab.com/react-admin/Translation.html

Change Background color of React Native NativeModules.UIManager.showPopupMenu

can we change the background color of NativeModules.UIManager.showPopupMenu menu ? It shows white background by default. I'm creating an app which has darker theme so need to chnage the background color.
Yes, you can do this with some simple changes.
Your React theme should have these 2 properties :
<style name="ReactAppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- if using android.widget.PopupMenu -->
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<!-- if using android.support.v7.widget.PopupMenu -->
<item name="popupMenuStyle">#style/PopupMenu</item>
</style>
and then define your PopupMenu theme like this :
<style name="PopupMenu" parent="Theme.AppCompat.DayNight">
<item name="android:textColor">some color</item>
<item name="android:colorBackground">some color</item>
<item name="android:popupBackground">some color</item>
</style>

No record display when grid is empty - Kendo React Grid

We have a Kendo React grid and we need to show the No record found the message when data is empty.
<Grid
sortable
filterable
expandField="expanded"
detail={props => <DetailComponent
{...props}
onChange={this.handleDetailTemplateChange}
changed={[]}
/>}
onExpandChange={this.expandChange}
pageable={this.state.pageable}
// scrollable="true"
editField="inEdit"
data={this.state.providersPage}
sort={this.state.sort}
onSortChange={this.handleSortChange}
filter={this.state.filter}
onFilterChange={this.handleFilterChange}
onPageChange={this.handlePageChange}
total={this.state.total}
skip={this.state.skip}
pageSize={this.state.pageSize}
onItemChange={this.handleProviderChange}
resizable>
<GridColumn field="affiliationRelationshipStatusName" title="Network Relationship" filterCell={this.CategoryFilterCell}
cell={NetworkRelationshipCell} width="245px"/>
<GridColumn field="address" title="Places" filterable={false} cell={NetworkPlaceCell}
width="245px"/>
</Grid>
See Kendo documentation but couldn't find any solution. Please suggest
The packages comes with GridNoRecords exported component, that you can place inside the grid. It will be rendered when there are no records.
Import it as you import the grid itself:
import { Grid, GridColumn, GridNoRecords } from '#progress/kendo-react-grid'
Then place it inside the grid, with some content inside it.
<Grid data={[]}>
<GridNoRecords>
There is no data available
</GridNoRecords>
<GridColumn field="id" />
<GridColumn field="name" />
</Grid>
The above example is from the official documentation. I believe this is what you are looking for.

Nesting form in admin-on-rest not working

I am new using admin-on-rest framework, I need to make nested form working.
I have two models show and song.show() can have multiple songs. I have show edit form it will work as expected.
I need to add a song form inside show edit form, so I can add multiple songs for each show.
I tried all ways but i am not able to get it done.
This is my code:
<Edit title="Edit Show" {...this.props}>
<SimpleField>
<TextInput source="name" style={{ display: 'inline-block' }} />
//here need to add song add form without reloading page
//this is songs grid
<ReferenceManyField reference="songs" target="show_id" label="Set List" perPage={5} >
<Datagrid>
<TextField source="song_name" />
<EditButton />
<DeleteButton />
</Datagrid>
</ReferenceManyField>
//Here need to add song form, so i can add songs
</SimpleField>
</Edit>
How can I achieve this?
Not sure if that answers your question.. if songs pre-exist then you just need to do that:
<Edit title="Edit Show" {...this.props}>
<TextInput source="name" style={{ display: 'inline-block' }} />
<ReferenceArrayInput label="Songs" source="songs_property_on_show" reference="songs" allowEmpty>
<SelectArrayInput optionText="song_name" translate={false}/>
</ReferenceArrayInput>
</Edit>
if you want to create them on the fly while you are creating the show or in other words have a form inside the other this needs to be done in a custom way (using redux-form) as commented under my question: how to create an entity inside another in the same form using admin-on-rest?

Images are not displayed on the buttons

I use the Fluent Ribbon (fluent.codeplex.com). I want to arrange four buttons side by side.
I use the following code:
<Fluent:RibbonGroupBox Header="Some Header">
<Fluent:RibbonToolBar>
<Fluent:RibbonToolBar.LayoutDefinitions>
<Fluent:RibbonToolBarLayoutDefinition Size="Small">
<Fluent:RibbonToolBarRow>
<Fluent:RibbonToolBarControlGroupDefinition>
<Fluent:RibbonToolBarControlDefinition Target="buttonFirst" />
<Fluent:RibbonToolBarControlDefinition Target="buttonPrevious" />
<Fluent:RibbonToolBarControlDefinition Target="buttonNext" />
<Fluent:RibbonToolBarControlDefinition Target="buttonLast" />
</Fluent:RibbonToolBarControlGroupDefinition>
</Fluent:RibbonToolBarRow>
</Fluent:RibbonToolBarLayoutDefinition>
</Fluent:RibbonToolBar.LayoutDefinitions>
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/First_16.png" x:Name="buttonFirst" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Previous_16.png" x:Name="buttonPrevious" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Next_16.png" x:Name="buttonNext" />
<Fluent:Button Size="Small" Icon="/WpfApplication1;component/Resources/Last_16.png" x:Name="buttonLast" />
</Fluent:RibbonToolBar>
</Fluent:RibbonGroupBox>
The buttons are aligned correctly, but the buttons don't have a image. Where is the problem?
(The image files are available)
Sometimes you need to change 'Copy to Output Directory" setting. I usually use 'Always'. Or IfNewer if you have a lot and don't want a rebuild to constantly wipe and recopy.

Resources